function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// begin absolutely positioned scrollable area object scripts 
// Extension developed by David G. Miles 
// Original Scrollable Area code developed by Thomas Brattli 
function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser();
 
 
var speed=50 ;
var moveTotal =0;
 
var loop, timer 
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y; 
    this.css.left=this.x;
	this.css.top=this.y+"px";
} 
 
function MoveAreaDown(move){ 
	if(this.y>moveTotal){
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	}
} 
function MoveAreaUp(move){ 
	if(this.y<0){
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 

var delete_image = new Image(); delete_image.src = '../../img/arrow-down-green_over.gif';
var delete_image = new Image(); delete_image.src = '../../img/arrow-up-green_over.gif';

function _changeImage(id,nImage){
	var i = document.getElementById(id);
	if (i){
		i.src = '../../img/'+nImage;	
	}
}

function PerformScroll(speed){
	if(initialised){ 
		loop=true;
		if(speed>0) {
			dvContent = document.getElementById('divContent').clientHeight;
			dvContainer = document.getElementById('divContainer').clientHeight;
			moveTotal = (-dvContent+dvContainer);
			objScroller.down(speed) ;}
		else objScroller.up(speed) 
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 
var initialised; 
function InitialiseScrollableArea(){
	if (!document.getElementById("divContainer")) return;
    objContainer=new ConstructObject('divContainer') ;
    objScroller=new ConstructObject('divContent','divContainer') ;
    objScroller.MoveArea(0,0);
    objContainer.css.visibility='visible';
    initialised=true; 
	initialice_zonas();
} 
// end absolutely positioned scrollable area object scripts

function MM_findObj(n, d) { //v4.01
  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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.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=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  var textURL = theURL.toLowerCase();
  
  if ((textURL.indexOf('.gif') > 0) || (textURL.indexOf('.png') > 0) || (textURL.indexOf('.jpg') > 0))
  { 
	cargando_foto(theURL);
	return false;
  }
  nwWindow = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
  if (window.focus) 
  	{nwWindow.focus();}
  return false;
  
}

function mostrar() {
var ops = "top=" + ((screen.height - _img_grande.height) / 2);
ops += ",left=" + ((screen.width - _img_grande.width) / 2);
ops += ",width=" + _img_grande.width + ",height=" + _img_grande.height;
var contenido = "<html><body style='padding:2px;margin:0px;background-image: url(" + _img_grande.src + ")'><p style='text-align:right;'><a href='javascript:;' onclick='window.close()' style='font-family:Arial,Helvetica; font-size:10px; color:#000000;background-color:#96AC02; padding:2px;'>X Close</a></p></body></html>";
var ventana = window.open("", "", ops);
ventana.document.write(contenido);
ventana.document.close();
}

function cargando() {
if (_img_grande.complete) mostrar();
else setTimeout("cargando()", 100);
}

function cargando_foto(imagen) {
_img_grande = new Image();
_img_grande.src = imagen;
cargando();
}


var newwindow = '';

function popitupTam(url,width,height,param){
		if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		newwindow=window.open(url,'popupRentals',param+((param!='')?',':'')+'height='+height+',width='+width);
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) 
		{newwindow.focus();}
	return false;
}

function popitup(url) {
	return popitup(url,'150','200','');
}

function writelog(msg)
{
	document.getElementById("log").innerHTML += "<br>"+msg;	
}
function cleanLog()
{
document.getElementById('log').innerHTML='';
writelog("divApart: "+document.getElementById('divApart').offsetHeight);
writelog("divContent: "+document.getElementById('divContent').offsetHeight);
writelog("divContainer: "+document.getElementById('divContainer').offsetHeight);
writelog("Total: "+((-document.getElementById('divContent').offsetHeight)+(document.getElementById('divContainer').offsetHeight)));
moveTotal = ((-document.getElementById('divContent').offsetHeight)+(document.getElementById('divContainer').offsetHeight));
}

function initialice_zonas()
{
	var zonas;
	if (listZonas.length > 0){
		zonas = listZonas.split(",");
	}
	/*for (n = 0;n<zonas.length;n++)
	{
		viewZona("check_"+zonas[n]);
	}*/
}
function viewZona(nameZona)
{
	objZona = document.getElementById(nameZona);
	if (objZona.style.display == 'none')
	{objZona.style.display = 'block';}
	else
	{objZona.style.display = 'none';}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateForm1() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm1.arguments;
  if (!$("read_terms").checked)
  {errors = "You need to check the terms & conditions.\n";}
  if ($("email").value!=$("email_rep").value) { errors += 'Check your e-mail adress\n'; } 
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function avisar(message){
	window.alert(message);
}

function chgSelectCity(obj){
	obj.form.submit();
}