function closead() {
		document.getElementById("toplayer").style.display="none";
		document.getElementById("iduration").style.display="block";
		document.getElementById("idepairport").style.display="block";
		document.getElementById("aduration").style.display="block";
		document.getElementById("adepairport").style.display="block";

}
function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}

function changeImages() {
    preloadFlag = true;
  if (document.images && (preloadFlag == true)) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    }
  }
}


function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}
var preloadFlag = false;


function help ( content)
{
	if (content != '') return overlib (content);
}

function doff()
{
	return nd();
}

function preloadImages() {
  if (document.images) {
    home_on = newImage("images/home_.gif");
    lapland_info_on = newImage("images/lapland_info_.gif");
    accomodation_on = newImage("images/accomodation_.gif");
    weather_on = newImage("images/weather_.gif");
    premier_on = newImage("images/premier_.gif");    
    brochures_on = newImage("images/brochures_.gif");    
    about_on = newImage("images/about_us_.gif");    
    contact_on = newImage("images/contact_.gif");    	 
    preloadFlag = true;
  }
}



 function showpicture(url,width, height)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
	}

 function showpicturebig(url,width, height)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=1,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes')
	}

function check_contact() {
	if (document.contact_form.contact_name.value=="" || document.contact_form.contact_email.value=="" ||	document.contact_form.contact_email.value=="") {
		alert ('All fields marked with * are required!');
		return false;
	}
	else {
		return true; 
	}
}

function check_email() {
	emcheck=document.subscribe_form.email.value;
	
	if (!(emcheck.indexOf(".") > 2) || !(emcheck.indexOf("@") > 0)) {
		alert ('Please type proper e-mail address!');
		return false;
	}
	else {
		return true; 
	}
	
}
function check_airport_fields() {
	if (document.search_form.dep_airport_id.options[document.search_form.dep_airport_id.options.selectedIndex].value=='' &&
		 document.search_form.duration.options[document.search_form.duration.options.selectedIndex].value=='')
		 {
		alert ('You must select at least one option!');
		return false;
	}
	else {
		return true; 
	}
}

function check_airport_fields2() {
	if (document.search_form2.dep_airport_id.options[document.search_form2.dep_airport_id.options.selectedIndex].value=='' &&
		 document.search_form2.duration.options[document.search_form2.duration.options.selectedIndex].value=='')
		 {
		alert ('You must select at least one option!');
		return false;
	}
	else {
		return true; 
	}
}
function showagefields() {
		document.getElementById("age1").style.display="none";
		document.getElementById("age2").style.display="none";
		document.getElementById("age3").style.display="none";		
		document.getElementById("age4").style.display="none";		
		document.getElementById("age5").style.display="none";		
		document.getElementById("age6").style.display="none";
	amount=document.enquiry_form.children.options[document.enquiry_form.children.options.selectedIndex].value;
	if (amount==0) {
		document.getElementById("age1").style.display="none";
		document.getElementById("age2").style.display="none";
		document.getElementById("age3").style.display="none";		
		document.getElementById("age4").style.display="none";		
		document.getElementById("age5").style.display="none";		
		document.getElementById("age6").style.display="none";
	}	
	if (amount==1) {
		document.getElementById("age1").style.display="block";
	}
	if (amount==2) {
		document.getElementById("age1").style.display="block";
		document.getElementById("age2").style.display="block";		
	}
	if (amount==3) {
		document.getElementById("age1").style.display="block";
		document.getElementById("age2").style.display="block";		
		document.getElementById("age3").style.display="block";
	}
	if (amount==4) {
		document.getElementById("age1").style.display="block";
		document.getElementById("age2").style.display="block";		
		document.getElementById("age3").style.display="block";
		document.getElementById("age4").style.display="block";
	}
	if (amount==5) {
		document.getElementById("age1").style.display="block";
		document.getElementById("age2").style.display="block";		
		document.getElementById("age3").style.display="block";
		document.getElementById("age4").style.display="block";	
		document.getElementById("age5").style.display="block";
	}
	if (amount==6) {
		document.getElementById("age1").style.display="block";
		document.getElementById("age2").style.display="block";		
		document.getElementById("age3").style.display="block";
		document.getElementById("age4").style.display="block";	
		document.getElementById("age5").style.display="block";		
		document.getElementById("age6").style.display="block";
	}					
}


function check_enquiry_form() {

	if (document.enquiry_form.e_firstname.value=="" || 
		document.enquiry_form.e_surname.value=="" ||	
		document.enquiry_form.e_email.value=="" ||	
		document.enquiry_form.e_phone.value=="" ||	
		document.enquiry_form.e_mobile.value=="") {
		alert ('All fields marked with * are required!');
		return false;
	}
	else {
		return true; 
	}
}

function check_ages() {
	var err=0;
		if (document.getElementById("age1").style.display=="block" && document.enquiry_form.age1.options[document.enquiry_form.age1.options.selectedIndex].value==0) err++;
		if (document.getElementById("age2").style.display=="block" && document.enquiry_form.age2.options[document.enquiry_form.age2.options.selectedIndex].value==0) err++;
		if (document.getElementById("age3").style.display=="block" && document.enquiry_form.age3.options[document.enquiry_form.age3.options.selectedIndex].value==0) err++;
		if (document.getElementById("age4").style.display=="block" && document.enquiry_form.age4.options[document.enquiry_form.age4.options.selectedIndex].value==0) err++;
		if (document.getElementById("age5").style.display=="block" && document.enquiry_form.age5.options[document.enquiry_form.age5.options.selectedIndex].value==0) err++;
		if (document.getElementById("age6").style.display=="block" && document.enquiry_form.age6.options[document.enquiry_form.age6.options.selectedIndex].value==0) err++;
	if (err>0) {
		alert ('Please specify children ages!');
		return false;
}
	else return true;
}


function check_agreement() {
	if (document.enquiry_form.agreement.checked==false) {
		alert ('You must agree to terms and conditions!');
		return false;
	}
	else {
		return true; 
	}
}

function set_button() {
	which=document.enquiry_form.e_hotel.options[document.enquiry_form.e_hotel.options.selectedIndex].value;
	if (which!='') {
		document.getElementById("butdet").innerHTML="&nbsp;<input type='button' class='button' value='check details' onclick=showpicturebig('http://www.santaclaustrips.co.uk/accomodation.php?id="+which+"',850,800)>";
}
	else {document.getElementById("butdet").innerHTML="";}

}