function gallerypopup(id) {
		  wn=window.open('/easyconsole.cfm?page=photoviewer&id='+id,'gpopup','width=640,height=550,resizable=yes,scrollbars=yes');
}

var myimages=new Array()
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

preloadimages("/images/header_topmenu_divider.gif",
			  "/images/left_menu_dotted_divider.gif",
			  "/images/bt_more.gif",
			  "/images/header_logo.gif");

function handover (id) {
	id.style.cursor='Hand';	
}

function menuout (row_id) {
	row_id.style.backgroundColor='';
}

function visit(id) {
   location.href='/easyconsole.cfm?id='+id;
 }
 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function changeColor(color)
{
	this.style.backgroundColor ='#'+color;
}

function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    }
	
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}

function ValidateSubscription () {
	var errorCheck=0;
	if ((newsletterfrm.fullname.value.length==0) || (newsletterfrm.fullname.value==null)) {
		alert('Enter your name');
		errorCheck=1
		return false;
	}
	if ((newsletterfrm.emailaddress.value.length==0) || (newsletterfrm.emailaddress.value==null)) {
		alert('Enter your email');
		errorCheck=1
		return false;
	} 
	
   if (! isValidEmail(newsletterfrm.emailaddress.value)) {
       alert("Please enter a valid email address");
	   errorCheck=1
       return false;
   }
	
	if (errorCheck==0) {
		document.newsletterfrm.submit();
	}
}

function help_airport() {
	alert('If possible enter more than just one airport, separated by comma, starting from the airport with the highest priority.');
}

function toggledisplay(id,id2){
	if (document.getElementById){
		obj = document.getElementById("DIV"+id);
		obj2 = document.getElementById(id2);
		
		if (obj2.value==1)
		{
			if (obj.style.display == "none"){
				obj.style.display = "";
			} 
			else 
			{
				obj.style.display = "none";
			}
		}
		else
			obj.style.display="none";
	}
}


function toggledisplayadults(id){
	var i=0;
	var j=0;

	for (i=1;i<=6;i++) {
		show_tr=eval("DIVP"+i);
		show_tr.style.display='none';
	}

	for (j=1;j<=id;j++) {
		show_tr=eval("DIVP"+j);
		show_tr.style.display='block';
	}
}

function toggledisplaychildren(id){
	var i=0;
	var j=0;

	for (i=1;i<=6;i++) {
		show_tr=eval("DIVK"+i);
		show_tr.style.display='none';
	}

	for (j=1;j<=id;j++) {
		show_tr=eval("DIVK"+j);
		show_tr.style.display='block';
	}
}

function toggledisplayinfants(id) {
	var i=0;
	var j=0;

	for (i=1;i<=4;i++) {
		show_tr=eval("DIVIN"+i);
		show_tr.style.display='none';
	}

	for (j=1;j<=id;j++) {
		show_tr=eval("DIVIN"+j);
		show_tr.style.display='block';
	}
}

function OpenCars(id) { 
	window.open('/easyconsole.cfm?page=carspopup','newwindow', 'toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=465,height=500');
}

function toggledisplaycardelivery (id,id2) {

	if (document.getElementById){
		obj2 = document.getElementById(id2);
		obj = document.getElementById(id);
		if (obj2.value == 'Villa')
			obj.style.display="block";
		else
			obj.style.display="none";
	}
}


function togglereferrerother () {
	
	if (document.enquiryfrm.referrer.value == 'other') {
		other_referrer.style.display='block';
	} else { other_referrer.style.display='none'; }
}


function disableForm(theform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < theform.length; i++) {
			var tempobj = theform.elements[i];
			if (tempobj.type.toLowerCase() == "submit")
				tempobj.disabled = true;
			}
		return true;
	} 
}

function toggledisplay(id){
	show_tr=eval("DIV"+id);
	
	if (show_tr.style.display == 'none') {
		show_tr.style.display='block';
		}
	else {
		show_tr.style.display='none';
	}
}




