﻿var getObjXmlHttp=function(){var http_request;http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}
return http_request;}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");return http_request;}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");return http_request;}catch(e){}}}
if(!http_request){alert('Falla :( No es posible crear una instancia XMLHTTP');return false;}}
function imprResultado()
{if(document.getElementById("resultados")){var ficha=document.getElementById("resultados");var ventimp=window.open(' ','popimpr');ventimp.document.write(ficha.innerHTML);ventimp.document.close();ventimp.print();ventimp.close();}}
function contenidoVisible(enseñar,capa){if(document.getElementById(capa)){var elemento=document.getElementById(capa);if(enseñar=="2"){elemento.style.display="block";}else{elemento.style.display="none";}}else{setTimeout("contenidoVisible('"+enseñar+"', '"+capa+"')",200);}}
function fnCapaOpciones(){if(document.getElementById("opcionesBuscador")){var capa=document.getElementById("opcionesBuscador");if(capa.style.display=="none"){capa.style.display="block";document.getElementById("lnkOptBuscador").innerHTML="- Opciones";}else{capa.style.display="none";document.getElementById("lnkOptBuscador").innerHTML="+ Opciones";}}}
function posicionCursor(input)
{var tb=document.getElementById(input)
var cursor=-1;if(document.selection&&(document.selection!='undefined'))
{var _range=document.selection.createRange();var contador=0;while(_range.move('character',-1))
contador++;cursor=contador;}
else if(tb.selectionStart>=0)
cursor=tb.selectionStart;return cursor;}
function insertaTextoInput(texto)
{var elemento=inputFocused;if(elemento!=null)
{var posicion=posicionCursor(elemento.id);var tex=elemento.value.substring(0,posicion)
tex+=texto;tex+=elemento.value.substring(posicion);elemento.value=tex;elemento.focus();}}
var inputFocused=null;function focusTXT(){if(inputFocused)
inputFocused.focus();}
var esTextoInicial=true;function guardaFocus(el){inputFocused=el;if(el.id=="cadena"&&esTextoInicial){el.style.color="black";el.style.fontWeight="normal";el.value="";esTextoInicial=false;}}
function quitarFocus(){}
function cargaCalendario(){if(document.getElementById("fecha_res")&&document.getElementById("fecha_res2")&&document.getElementById("cal-button-1")&&document.getElementById("cal-button-2")){Calendar.setup({inputField:"fecha_res",ifFormat:"%d/%m/%Y",button:"cal-button-1",align:"Br",weekNumbers:"false",firstDay:1});Calendar.setup({inputField:"fecha_res2",ifFormat:"%d/%m/%Y",button:"cal-button-2",align:"Br",weekNumbers:"false",firstDay:1});}else{setTimeout("cargaCalendario()",200);}}
function limpiarFormulario(){try{var elementos=document.getElementById("buscadores");var texts=elementos.getElementsByTagName("input");for(var i=0;i<texts.length;i++){if(texts[i].type=="text"){texts[i].value="";}}
var sel=elementos.getElementsByTagName("select");for(var j=0;j<sel.length;j++){sel[j].selectedIndex=0;}}catch(e){}}
function agregarFav(){try{var title='Decanato Autonomico de Madrid-Colegio de Registradores'
var url='http://www.registradoresdemadrid.org';if(window.sidebar){window.sidebar.addPanel(title,url,"");}
else if(window.opera&&window.print)
{var dcE=document.createElement('a');dcE.setAttribute('rel','sidebar');dcE.setAttribute('href',url);dcE.setAttribute('title',title);dcE.click();}
else{window.external.AddFavorite(url,title);}}catch(e){alert(e)}}
window.onload=function(){if(document.getElementById("buscadores")){var inputButons=document.getElementById("buscadores").getElementsByTagName('input');for(i=0;i<inputButons.length;i++){if(inputButons[i].type=='submit'){inputButons[i].onclick=function(){if(document.getElementById("cadena")){var contenidoCadena=new String();contenidoCadena=document.getElementById("cadena").value;if(contenidoCadena.substring(0,12)=="Búsqueda en "){document.getElementById("cadena").value="";return false;}else{document.getElementById("buscadores").submit();}}};}}}}
contenidoVisible(1,"contenidoOpcional");cargaCalendario();
