if (document.images) {
	img1over = new Image();
	img1over.src = url + "stBoHome_On.gif";
	img2over = new Image();
	img2over.src = url + "stBoContactenos_On.gif";
	img3over = new Image();
	img3over.src = url + "stBoLaEmpresa_On.gif";
	img4over = new Image();
	img4over.src = url + "stBoBuscar_On.gif";
	img5over = new Image();
	img5over.src = url + "stBoQuiereVender_On.gif";
	img6over = new Image();
	img6over.src = url + "stBoPeticiones_On.gif";
	img7over = new Image();
	img7over.src = url + "stBoPromocionesVenta_On.gif";
	img9over = new Image();
	img9over.src = url + "boAlquilar_On.gif";
	img10over = new Image();
	img10over.src = url + "boCalcularHipoteca_On.gif";
	img11over = new Image();
	img11over.src = url + "spBoIniciarBusqueda_On.gif";

	img1out = new Image();
	img1out.src = url + "stBoHome_Off.gif";
	img2out = new Image();
	img2out.src = url + "stBoContactenos_Off.gif";
	img3out = new Image();
	img3out.src = url + "stBoLaEmpresa_Off.gif";
	img4out = new Image();
	img4out.src = url + "stBoBuscar_Off.gif";
	img5out = new Image();
	img5out.src = url + "stBoQuiereVender_Off.gif";
	img6out = new Image();
	img6out.src = url + "stBoPeticiones_Off.gif";
	img7out = new Image();
	img7out.src = url + "stBoPromocionesVenta_Off.gif";
	img9out = new Image();
	img9out.src = url + "boAlquilar_Off.gif";
	img10out = new Image();
	img10out.src = url + "boCalcularHipoteca_Off.gif";
	img11out = new Image();
	img11out.src = url + "spBoIniciarBusqueda_Off.gif";
}

function turnOn(imgName) {if (document[imgName]){document[imgName].src = eval( imgName + "over.src");}}
function turnOff(imgName) {if (document[imgName]){if (document.images) {document[imgName].src = eval(imgName + "out.src");}}}

function rollOn(obj){
	file=obj.src;
	obj.src=file.replace('_Off','_On');
}

function rollOff(obj){
	file=obj.src;
	obj.src=file.replace('_On','_Off');
}

function mostrarprovincia(object) {
	if (document.all && document.all[object]) {
		document.all[object].style.visibility = 'visible';}
	if (document.getElementById(object)) {
		document.getElementById(object).style.visibility = 'visible';}
}

function ocultarprovincia(object) {
	if (actualprov==''){
	if (document.all && document.all[object]) {
		document.all[object].style.visibility = 'hidden';}
	if (document.getElementById(object)) {
		document.getElementById(object).style.visibility = 'hidden';}
	}
}

var actualprov = '';
function mostrarpanel(object) {
	if (document.all && document.all.Panel) {
		document.all.panelprovincia.innerHTML = object;
		document.all.Panel.style.visibility = 'visible';
		document.all.Barrera.style.visibility = 'visible';}
	if (document.getElementById('Panel')) {
		document.getElementById('panelprovincia').innerHTML = object;
		document.getElementById('Panel').style.visibility = 'visible';
		document.getElementById('Barrera').style.visibility = 'visible';}
	mostrarprovincia(object);
	actualprov=object;
	frames['autocomplete'].location.href=urlauto+'?panmodalidad='+object+'&idioma='+idioma;
}

function ocultarpanel() {
	if (document.all && document.all.Panel) {
		document.all.Panel.style.visibility = 'hidden';
		document.all.Barrera.style.visibility = 'hidden';}
	if (document.getElementById('Panel')) {
		document.getElementById('Panel').style.visibility = 'hidden';
		document.getElementById('Barrera').style.visibility = 'hidden';}
	prov=actualprov;
	actualprov='';
	ocultarprovincia(prov);
}

var tt0=true;
function autocompletarModalidades(){
	if (tt0){document.buscador.provincia.options[0]=null;tt0=false;}
	frames['autocomplete'].location.href=urlauto+'?panmodalidad='+document.buscador.provincia.options[document.buscador.provincia.options.selectedIndex].text+'&idioma='+idioma;
	tt6=true;
}

var tt1=true;
function autocompletarProvincias(ti,modalidad,idioma){
	if (tt1){document.buscador.tipodeinmueble.options[0]=null;tt1=false;}
	frames['autocomplete'].location.href=urlauto+'?ti='+ti+'&mod='+modalidad+'&idioma='+idioma;
	tt2=true;
}

var tt2=true;
function autocompletarCiudades(ti,provincia,modalidad,idioma){
	if (tt2){document.buscador.provincia.options[0]=null;tt2=false;}
	frames['autocomplete'].location.href=urlauto+'?ti='+ti+'&prov='+provincia+'&mod='+modalidad+'&idioma='+idioma;
	tt3=true;
}

function autocompletarDistritos(ti,provincia,ciudad,modalidad,idioma){
	frames['autocomplete'].location.href=urlauto+'?ti='+ti+'&prov='+provincia+'&ciu='+ciudad+'&mod='+modalidad+'&idioma='+idioma;
}

var tt4=true;
function autocompletarCiudadesHome(ti,modalidad,idioma){
	//if(document.all){provincia=document.all.panelprovincia.innerHTML}
	//if(document.getElementById('panelprovincia')){provincia=document.getElementById('panelprovincia').innerHTML}
	if (tt4){document.buscador['tipodeinmueble_'+idioma].options[0]=null;tt4=false;}
	provincia=document.buscador.provincia.options[document.buscador.provincia.selectedIndex].text;
	frames['autocomplete'].location.href=urlauto+'?panti='+ti+'&panprov='+provincia+'&panmod='+modalidad+'&idioma='+idioma;
}

function avanzada(){
	val=document.buscador.modalidad[document.buscador.modalidad.selectedIndex].value
	if(val==0){document.location.href='comprar/'}
	if(val==1){document.location.href='comprar/'}
	if(val==2){document.location.href='alquilar/'}
}

var tt6=true;
function autocompletarTipoDeInmuebleHome(modalidad,idioma){
	if (tt6){document.buscador['modalidad_'+idioma].options[0]=null;tt6=false;}
	//if(document.all){provincia=document.all.panelprovincia.innerHTML}
	//if(document.getElementById('panelprovincia')){provincia=document.getElementById('panelprovincia').innerHTML}
	//document.buscador.provname.value=provincia;
	provincia=document.buscador.provincia.options[document.buscador.provincia.selectedIndex].text;
	frames['autocomplete'].location.href=urlauto+'?pantipo='+provincia+'&panmod='+modalidad+'&idioma='+idioma;
	tt4=true;
}

//---
var tt30=true;
function autocompletarTipoDeInmuebles1(prov,ciu,distrito,modalidad,idioma){
	if(distrito==0){
		autocompletarDistritos1(ciu,prov,modalidad,idioma);
	}else{
		frames['autocomplete'].location.href=urlauto+'?home2tipodeinmuebles='+distrito+'&mod='+modalidad+'&idioma='+idioma;
		tt31=true;
	}
}

function autocompletarClasificaciones1(prov,ciu,ti,modalidad,idioma){
	document.getElementById('viviendas').style.display='none';
	document.getElementById('chalets').style.display='none';
	if(ti==1){
		document.getElementById('viviendas').style.display='block';
	}
	if(ti==2){
		document.getElementById('chalets').style.display='block';
	}
	if(parent.document.getElementById('distrito').options.selectedIndex==-1){
		dis=0;
	}else{
		dis=parent.document.getElementById('distrito').options[parent.document.getElementById('distrito').options.selectedIndex].value;
	};
	frames['autocomplete'].location.href=urlauto+'?home2clasificaciones=ok&prov='+prov+'&ciu='+ciu+'&dis='+dis+'&jti='+ti+'&mod='+modalidad+'&idioma='+idioma;
}

var tt31=true;
function autocompletarProvincias1(mod,idioma){
	frames['autocomplete'].location.href=urlauto+'?home2provincias=ok&mod='+mod+'&idioma='+idioma;
	tt32=true
}

function autocompletarCiudades1(prov,mod,idioma){
	if(document.buscador['provincia'].options[0].value=='0'){
		document.buscador['provincia'].options[0]=null;
	}
	frames['autocomplete'].location.href=urlauto+'?home2ciudades='+prov+'&hmod='+mod+'&idioma='+idioma
}
function autocompletarDistritos1(ciu,prov,mod,idioma){
	if(ciu==0){
		autocompletarCiudades1(prov,mod,idioma);
	}else{
		frames['autocomplete'].location.href=urlauto+'?home2distritos='+ciu+'&hprov='+prov+'&hmod='+mod+'&idioma='+idioma
	}
}


//---

function modificaClasificacion(titulo){
	inm=document.buscador.tipodeinmueble.options[document.buscador.tipodeinmueble.selectedIndex].text;
	if (document.all) {document.all.titclas.innerHTML = titulo+inm;}
	if (document.getElementById('titclas')) {document.getElementById('titclas').innerHTML = titulo+inm;}
}

var tt7=true;
function modificaClasificacionQV(titulo,ti,modalidad,idioma){
	modificaClasificacion(titulo);
	if (tt7){document.buscador['tipodeinmueble'].options[0]=null;tt7=false;}
	frames['autocomplete'].location.href=urlauto+'?ti='+ti+'&mod='+modalidad+'&idioma='+idioma;
}

var Key='';
function keyhandler(e) {
   	if ((Key >=48 && Key <=57) || (Key >=96 && Key <=105) || Key==46 || Key==8 || Key==9 || Key==188 || (Key >=37 && Key <=40)){return true}else{return false};
}

function almacenar(capa){
	var htmlcontent='';
	if (document.all) {htmlcontent=document.all[capa].innerHTML;}
	if (document.getElementById(capa)){htmlcontent=document.getElementById(capa).innerHTML;}
	return htmlcontent;
}

function vaciar(capa){
	if (document.all) {document.all[capa].innerHTML='';}
	if (document.getElementById(capa)){document.getElementById(capa).innerHTML='';}
}

function mostarcaresp(idtipodeinmueble){
	if (document.all) {
		document.all.caresp.innerHTML='';
		document.all.caresp.innerHTML= eval('capa'+idtipodeinmueble);}
	if (document.getElementById('caresp')){
		document.getElementById('caresp').innerHTML='';
		document.getElementById('caresp').innerHTML= eval('capa'+idtipodeinmueble);}
}

function runSlideShow(){
	if (document.all){
		document.images.PictureBox.style.filter="blendTrans(duration=2)";
		document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
		document.images.PictureBox.filters.blendTrans.Apply();}
		document.images.PictureBox.src = preLoad[jss].src;
	if (document.all) document.images.PictureBox.filters.blendTrans.Play();
		jss = jss + 1;
		if (jss > (pss)) jss=1;
		tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function printpage(id){
	frames['imprimir'].location.href='imprimir.php?id='+id;
}

function printpageprom(id){
	frames['imprimir'].location.href='imprimirpromocion.php?id='+id;
}

function ajuste(tagId,cantidadPorLinea){
	cantidadPorLinea++;
	var i=1;
	var t=1;
	var z=1;
	var maxheight=Array();
	while (document.getElementById(tagId+i)!=null){
		if(!maxheight[t]>=1){maxheight[t]=0;}

		if(document.getElementById(tagId+i).clientHeight>=maxheight[t]){
			maxheight[t]=document.getElementById(tagId+i).clientHeight;
			
		}

		i++;
		z++;
		if(z==cantidadPorLinea){t++;z=1;}
	}

	i=1;
	t=1;
	z=1;
	pp='';
	while (document.getElementById(tagId+i)!=null){
		if(i%2==0){
			altob=maxheight[t]+5
			document.getElementById(tagId+i).height = altob+'px';
			alturatd=document.getElementById(tagId+i).height;
			altura=-alturatd-3;
			document.getElementById('LayerTable'+i).style.top=altura+'px';
		}else{
			altob=maxheight[t]+10
			document.getElementById(tagId+i).height = altob+'px';
			alturatd=document.getElementById(tagId+i).height;
			altura=-alturatd-3;
			document.getElementById('LayerTable'+i).style.top=altura+'px';
		}

		i++;
		z++;
		if(z==cantidadPorLinea){t++;z=1;}
	}

}

function ajuste2(tagId,cantidadPorLinea){
	cantidadPorLinea++;
	var i=1;
	var t=1;
	var z=1;
	var maxheight=Array();
	while (document.getElementById(tagId+i)!=null){
		if(!maxheight[t]>=1){maxheight[t]=0;}

		if(document.getElementById(tagId+i).clientHeight>=maxheight[t]){
			maxheight[t]=document.getElementById(tagId+i).clientHeight;
		}

		i++;
		z++;
		if(z==cantidadPorLinea){t++;z=1;}
	}

	i=1;
	t=1;
	z=1;
	pp='';
	while (document.getElementById(tagId+i)!=null){
		document.getElementById(tagId+i).height = maxheight[t]+'px';

		i++;
		z++;
		if(z==cantidadPorLinea){t++;z=1;}
	}

};