$(document).ready(function(){	
	$("#ListaProvincias").html("<select name=\"provincia_norm\" id=\"provincia_norm\"  style=\"width:179px !important; padding:2px;\"><option value=\"todas\">(Seleccionar)</option><option value=\"a-coruna\" >A Coru&ntilde;a</option><option value=\"alava\" >&Aacute;lava</option><option value=\"albacete\" >Albacete</option><option value=\"alicante\" >Alicante</option><option value=\"almeria\" >Almer&iacute;a</option><option value=\"asturias\" >Asturias</option><option value=\"avila\" >&Aacute;vila</option><option value=\"badajoz\" >Badajoz</option><option value=\"barcelona\">Barcelona</option><option value=\"burgos\" >Burgos</option><option value=\"caceres\" >C&aacute;ceres</option><option value=\"cadiz\" >C&aacute;diz</option><option value=\"cantabria\" >Cantabria</option><option value=\"castellon\" >Castell&oacute;n</option><option value=\"ciudad-real\" >Ciudad Real</option><option value=\"cordoba\" >C&oacute;rdoba</option><option value=\"cuenca\" >Cuenca</option><option value=\"girona\" >Girona</option><option value=\"granada\" >Granada</option><option value=\"guadalajara\" >Guadalajara</option><option value=\"guipuzcoa\" >Guip&uacute;zcoa</option><option value=\"huelva\" >Huelva</option><option value=\"huesca\" >Huesca</option><option value=\"islas-baleares\" >Islas Baleares</option><option value=\"jaen\" >Ja&eacute;n</option><option value=\"la-rioja\" >La Rioja</option><option value=\"las-palmas\" >Las Palmas</option><option value=\"leon\" >Le&oacute;n</option><option value=\"lleida\" >Lleida</option><option value=\"lugo\" >Lugo</option><option value=\"madrid\" >Madrid</option><option value=\"malaga\" >M&aacute;laga</option><option value=\"murcia\" >Murcia</option><option value=\"navarra\" >Navarra</option><option value=\"ourense\" >Ourense</option><option value=\"palencia\" >Palencia</option><option value=\"pontevedra\" >Pontevedra</option><option value=\"salamanca\" >Salamanca</option><option value=\"santa-cruz-de-tenerife\" >S. Cruz de Tenerife</option><option value=\"segovia\" >Segovia</option><option value=\"sevilla\" >Sevilla</option><option value=\"soria\" >Soria</option><option value=\"tarragona\" >Tarragona</option><option value=\"teruel\" >Teruel</option><option value=\"toledo\" >Toledo</option><option value=\"valencia\" >Valencia</option><option value=\"valladolid\" >Valladolid</option><option value=\"vizcaya\" >Vizcaya</option><option value=\"zamora\" >Zamora</option><option value=\"zaragoza\" >Zaragoza</option></select>");
	$("#provincia_norm").bind('change', function() { window.location='casas-rurales/'+$("#provincia_norm").val();});  
	
	$("#Buscar").bind('click', function(){

		var busqueda=$('#buscador').val();
	
		if (busqueda.length>2){
		
			busqueda=busqueda.replace(/ /g,"-");
			busqueda=busqueda.replace(/\//g,"-");
			location = "/"+busqueda+"_s"
		}
		return false;
	});
	
	$("#buscador").bind('keypress', function(event){
		if(event.keyCode == '13'){
			var busqueda=$('#buscador').val();
			if (busqueda.length>2){
				busqueda=busqueda.replace(/ /g,"-");
				busqueda=busqueda.replace(/\//g,"-");
				location = "/"+busqueda+"_s"
			}
			return false;
		}
	});
	
	$("#buscadorForm").bind('submit', function(){
		var busqueda=$('#buscador').val();
		if (busqueda.length>2){
			busqueda=busqueda.replace(/ /g,"-");
			busqueda=busqueda.replace(/\//g,"-");
			location = "/"+busqueda+"_s";
			
		}
		return false;
	});

	
}); 


//jquery.coda-slider.js
jQuery(function(){
	jQuery("div.csw").prepend('<div class="loading"><img src="img/ajaxloader.gif" alt="Cargando..."/ ></div>');
});
var j = 0;
jQuery.fn.codaSlider = function(settings) {
	 settings = jQuery.extend({
     easeFunc: "expoinout",
     easeTime: 750,
     toolTip: false
  }, settings);
	return this.each(function(){
		var container = jQuery(this);
		// Self-explanatory...
		container.removeClass("csw").addClass("stripViewer");
		// Get the width of a panel, set from CSS...
		var panelWidth = container.find("div.panel").width();
		// panelCount gives us a count of the panels in the container...
		var panelCount = container.find("div.panel").size();
		// Calculate the width of all the panels when lined up end-to-end...
		var stripViewerWidth = panelWidth*panelCount;
		// Use the above width to specify the CSS width for the panelContainer element...
		container.find("div.panelContainer").css("width" , stripViewerWidth);
		// Set the navWidth as a multiple of panelCount to account for margin-right on each li
		var navWidth = panelCount*2;
		
		// Specify the current panel.
		// If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...
		if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
			var cPanel = parseInt(location.hash.slice(1));
			var cnt = - (panelWidth*(cPanel - 1));
			jQuery(this).find("div.panelContainer").css({ left: cnt });
		// Otherwise, we'll just set the current panel to 1...
		} else { 
			var cPanel = 1;
		};
		
		// Create appropriate nav
		container.each(function(i) {
			// Create the Left and Right arrows
			jQuery(this).before("<div class='stripNavL' id='stripNavL" + j + "'><a href='#'>Left</a><\/div>");
			jQuery(this).after("<div class='stripNavR' id='stripNavR" + j + "'><a href='#'>Right</a><\/div>");
			
			// Create the Tabs
			jQuery(this).before("<div class='stripNav' id='stripNav" + j + "'><ul><\/ul><\/div>");
			jQuery(this).find("div.panel").each(function(n) {
						jQuery("div#stripNav" + j + " ul").append("<li class='tabs tab" + (n+1) + "'><a href='#" + (n+1) + "'>" + jQuery(this).attr("title") + "<\/a><\/li>");												
			});
			
			// Tab nav
			jQuery("div#stripNav" + j + " a").each(function(z) {
				// Figure out the navWidth by adding up the width of each li
				navWidth += jQuery(this).parent().width();
				// What happens when a nav link is clicked
				jQuery(this).bind("click", function() {
					// console.log( jQuery(this).parent()[0].tagName );
					jQuery(this).parent().addClass("current").parent().find("li").not(jQuery(this).parent()).removeClass("current"); // wow!
					var cnt = - (panelWidth*z);
					cPanel = z + 1;
					jQuery(this).parent().parent().parent().next().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				});
			});
			
			// Left nav
			jQuery("div#stripNavL" + j + " a").click(function(){
				if (cPanel == 1) {
					var cnt = - (panelWidth*(panelCount - 1));
					cPanel = panelCount;
					jQuery(this).parent().parent().find("div.stripNav li.current").removeClass("current").parent().find("li:last").addClass("current");
				} else {
					cPanel -= 1;
					var cnt = - (panelWidth*(cPanel - 1));
					jQuery(this).parent().parent().find("div.stripNav li.current").removeClass("current").prev().find("li").addClass("current");
				};
				jQuery(this).parent().parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				// Change the URL hash (cross-linking)...
				location.hash = cPanel;
				return false;
			});
			
			// Right nav
			jQuery("div#stripNavR" + j + " a").click(function(){
				if (cPanel == panelCount) {
					var cnt = 0;
					cPanel = 1;
					jQuery(this).parent().parent().find("div.stripNav li.current").removeClass("current").parent().find("li:eq(0)").addClass("current");
				} else {
					var cnt = - (panelWidth*cPanel);
					cPanel += 1;
					jQuery(this).parent().parent().find("div.stripNav li.current").removeClass("current").next().find("li").addClass("current");
				};
				jQuery(this).parent().parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				// Change the URL hash (cross-linking)...
				location.hash = cPanel;
				return false;
			});
			
			// Same-page cross-linking
			jQuery("a.cross-link").click(function(){
				jQuery(this).parents().find(".stripNav ul li a:eq(" + (parseInt(jQuery(this).attr("href").slice(1)) - 1) + ")").trigger('click');
			});	
			
			// Set the width of the nav using the navWidth figure we calculated earlier. This is so the nav can be centred above the slider
			// jQuery("div#stripNav" + j).css("width" , navWidth);
			
			// Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking).
			if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
				jQuery("div#stripNav" + j + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current");
			} else {
				jQuery("div#stripNav" + j + " a:eq(0)").addClass("current");
			}
			
		});
		
		// Remove the preloader gif...
		jQuery(".panel").show();
		jQuery("div.loading").remove();
		return;
		j++;
  });
};

//jquery-easing-compatibility.1.2.pack.js
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('0.C(0.1,{7:2(x,t,b,c,d){3 0.1.D(x,t,b,c,d)},5:2(x,t,b,c,d){3 0.1.6(x,t,b,c,d)},h:2(x,t,b,c,d){3 0.1.B(x,t,b,c,d)},A:2(x,t,b,c,d){3 0.1.m(x,t,b,c,d)},y:2(x,t,b,c,d){3 0.1.w(x,t,b,c,d)},v:2(x,t,b,c,d){3 0.1.u(x,t,b,c,d)},s:2(x,t,b,c,d){3 0.1.r(x,t,b,c,d)},q:2(x,t,b,c,d){3 0.1.p(x,t,b,c,d)},o:2(x,t,b,c,d){3 0.1.n(x,t,b,c,d)},8:2(x,t,b,c,d){3 0.1.l(x,t,b,c,d)},g:2(x,t,b,c,d){3 0.1.j(x,t,b,c,d)},i:2(x,t,b,c,d){3 0.1.k(x,t,b,c,d)},z:2(x,t,b,c,d){3 0.1.f(x,t,b,c,d)},e:2(x,t,b,c,d){3 0.1.a(x,t,b,c,d)},9:2(x,t,b,c,d){3 0.1.4(x,t,b,c,d)}});',40,40,'jQuery|easing|function|return|easeInOutBack|easeOut|easeOutQuad|easeIn|elasin|backinout|easeOutBack||||backout|easeInBack|elasout|easeInOut|elasinout|easeOutElastic|easeInOutElastic|easeInElastic|easeInExpo|easeInOutBounce|bounceinout|easeOutBounce|bounceout|easeInBounce|bouncein||easeInOutExpo|expoinout|easeOutExpo||expoout|backin|expoin|easeInOutQuad|extend|easeInQuad'.split('|'),0,{}));

// jquery-easing-1.3.pack.js
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}));


var theInt = null;
var $crosslink, $navthumb;
var curclicked = 0;

theInterval = function(cur){
	clearInterval(theInt);
	
	if( typeof cur != 'undefined' )
		curclicked = cur;
	
	$crosslink.removeClass("active-thumb");
	$navthumb.eq(curclicked).parent().addClass("active-thumb");
		$(".stripNav ul li a").eq(curclicked).trigger('click');
	
	theInt = setInterval(function(){
		$crosslink.removeClass("active-thumb");
		$navthumb.eq(curclicked).parent().addClass("active-thumb");
		$(".stripNav ul li a").eq(curclicked).trigger('click');
		curclicked++;
		if( $("#numofertas").val() == curclicked )
			curclicked = 0;
		
	}, 6000);
};


$(function(){
	
	$("#main-photo-slider").codaSlider();
	
	$navthumb = $(".nav-thumb");
	$crosslink = $(".cross-link");
	
	$navthumb
	.click(function() {
		var $this = $(this);
		theInterval($this.parent().attr('href').slice(1) - 1);
		return false;
	});
	
	theInterval();
});

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function P7_Snap() {
 var g,x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
 
  
}

function shl() {
  var i,p,v,obj,args=shl.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='s')?'visible':(v=='h')?'hidden':v; }
    obj.visibility=v; }
}

function OT(){
	shl('islas-baleares','','h','santa-cruz-de-tenerife','','h','las-palmas','','h','cuenca','','h','larioja','','h','madrid','','h','guadalajara','','h','toledo','','h','soria','','h','burgos','','h','acoruna','','h','lugo','','h','pontevedra','','h','ourense','','h','asturias','','h','leon','','h','palencia','','h','cantabria','','h','alava','','h','vizcaya','','h','gipuzcoa','','h','navarra','','h','zaragoza','','h','huesca','','h','lleida','','h','barcelona','','h','girona','','h','tarragona','','h','teruel','','h','castellon','','h','valencia','','h','alicante','','h','murcia','','h','almeria','','h','granada','','h','malaga','','h','cadiz','','h','huelva','','h','sevilla','','h','cordoba','','h','jaen','','h','albacete','','h','ciudadreal','','h','badajoz','','h','caceres','','h','avila','','h','salamanca','','h','zamora','','h','valladolid','','h','segovia','','h');	
}

function isNetscape() {
	return (navigator.appName == "Netscape");
}
function isOpera() {
	return (navigator.userAgent.indexOf("Opera")!=-1);
}
function isNetscape4() {
	return (isNetscape() && navigator.appVersion.charAt(0) == "4");
}
function isNetscape6() {
 	return (isNetscape() && navigator.appVersion.charAt(0) != "4");
}
function isExplorer() {
	return (!isNetscape() && !isOpera());
}
function isExplorer4() {
	return isExplorer();
}
function isMac() {
	return (navigator.appVersion.lastIndexOf('Mac')!=-1)
}

// BOCADILLO
var width = "115";
var desvioDcha = -50;
var desvioAbajo = 20;

var x = 0;
var y = 0;
var repetir = 0;
var se_muestra = 0;
var contador = 0;
var direccion = 0;
var entrada = 1;
var aux = 0;
var capa = 'inf';

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

if (isNetscape6())
{  // si se trata de Netscape 6
		Refcapa='document.getElementById("'
		Refestilo='").style'
		Reftop='.top'
		Refleft='.left'
		BugPixels='+"px"'
}
else if (isNetscape4())
{ // si se trata de Netscape 4
		Refcapa='document.'
		Refestilo=''
		Reftop='.top'
		Refleft='.left'
		BugPixels='+"px"'
}
else if (isExplorer4())
{ // si se trata de Internet Explorer 4
		Refcapa=''
		Refestilo='.style'
		Reftop='.pixelTop'
		Refleft='.pixelLeft'
		BugPixels=''
}

function iniciar()
{
	if (isExplorer4())
	{ 
		window.onscroll = subeBaja
	}
	document.onmousemove = mouseMove
	if (isNetscape4()) document.captureEvents(Event.MOUSEMOVE)
}

function setCapa(nombrecapa)
{
	capa = nombrecapa;
}

function subeBaja(){
	desvioAbajo = 18 + window.document.documentElement.scrollTop;
}

function mostrar(nombre,numero) {
	var txt = '';
	var ancho
	var factor = 4;
	if (nombre.length > numero.length)
		ancho = nombre.length * factor;
	else
		ancho = numero.length * factor;
	if(ancho > 80)
		ancho = 80; 
	txt +='<div id="CapaInfo">'
	txt +=nombre+'<br>'+numero+' casas rurales'
	txt +='</div>'

	setCapa(capa);
	mostrarCapa(capa,txt);
	display(capa);
}

function mouseMove(e) {
	if (isNetscape4() || isNetscape6()) {x=e.pageX; y=e.pageY}
	else {x=event.clientX; y=event.clientY}
	if (repetir) {
		eval(Refcapa+capa+Refestilo+Refleft+'='+(x+desvioDcha)+BugPixels);
		eval(Refcapa+capa+Refestilo+Reftop+'='+(y+desvioAbajo)+BugPixels);
	}
}

function display(capa) {
	if (repetir == 0) 	{
		eval(Refcapa+capa+Refestilo+Refleft+'='+(x+desvioDcha)+BugPixels);
		eval(Refcapa+capa+Refestilo+Reftop+'='+(y+desvioAbajo)+BugPixels);
		eval(Refcapa+capa+Refestilo+'.visibility="visible"');
		repetir = 1
	}
}

function mouseMove(e) {
	if (isNetscape4() || isNetscape6()) {x=e.pageX; y=e.pageY}
	else {x=event.clientX; y=event.clientY}
	if (repetir) {
		eval(Refcapa+capa+Refestilo+Refleft+'='+(x+desvioDcha)+BugPixels);
		eval(Refcapa+capa+Refestilo+Reftop+'='+(y+desvioAbajo)+BugPixels);

	}
}


function mostrarCapa(capa,texto)
{	if (isExplorer4() || isNetscape6()) 
	{ 	
		element = document.getElementById(capa);
		element.innerHTML = texto;
	}
	else
	{
		ejecuta = Refcapa + capa + ".document.write(texto)";
		eval(ejecuta); 
	}

}  

function ocultarCapa(capa)
{	
	if (isNetscape4())
	{ 
		eval(Refcapa+capa+Refestilo+'.visibility="hide"'); 
		ejecuta = "document." + capa + '.document.close()';
		eval(ejecuta);
	}
	else 
	{
		eval(Refcapa+capa+Refestilo+'.visibility="hidden"'); 
	}
	repetir = 0;

}

iniciar();

