/*
**************************************************************************
ResortSearchForm.js
JS Functions used on the Resort Search Form
**************************************************************************
*/
/*function Load()
	{
	frm = document.basic;
	//document.getElementById('quicksearch').style.display ='block';
    //document.getElementById('advsearch').style.display ='none';
	}*/

function checkRequests(){
var strRequestMessage;
var intRequestCount;
var intCounter;
	
	/*
		strRequestMessage = "U kunt maximaal 6 wensen aangeven";
		intRequestCount = 0
	for(intCounter =1;intCounter <13;intCounter++)
	{
		strCurrentField = "chkPref" + intCounter; 
		if (document.basic(strCurrentField).checked==true)
			intRequestCount++;
	}
		if (intRequestCount > 6)
		
				alert(strRequestMessage);*/
	}
	
function Warn(url)
	{
	msg = "Would you like to cancel this booking?";
	if (confirm(msg))
		{
		document.location.href = url;
		}
	else
		{
		return false;	
		}
	}

function submitForm()
{  
// Hide the code in first div tag  
//	document.getElementById('formDiv').style.display = 'none';  
// Display code in second div tag  
//	document.getElementById('pleaseWaitDiv').style.display = 'block'; 
var intparty = 	(parseInt(document.basic.adults.value) + parseInt(document.basic.children.value) + parseInt(document.basic.infants.value));
var intpets = 	(parseInt(document.basic.pets.value))
var myRegion = (document.basic.region.value)
var d = new Date();//Get today's date
var dd = d.getDate();//This is the day
var mm = (d.getMonth() + 1);//This is the month (javascript uses 0 - 11)

var yy = d.getYear();//This is the year
var tyy = document.basic.arrivalYear.value;
var tmm = document.basic.arrivalMonth.value;
var tdd = document.basic.arrivalDate.value;
var startDate = new Date();//Create a new year variable to test minimum number of days a booking can be made.
startDate.setMonth(document.basic.arrivalMonth.value - 1);// Remember Javascript uses 0 - 11
startDate.setDate(document.basic.arrivalDate.value);
startDate.setYear(document.basic.arrivalYear.value);
var ONE_DAY = 1000 * 60 * 60 * 24 ;// Converts milliseconds into days
var dz = ((startDate)-(d));
var dzdiff = (dz/ONE_DAY)+1;
var dzmess = ("You have searched for a holiday which starts in the next 7 days.\n"+
              "Please call our last minute hotline on 0870 9098 909 for the latest deals.")
if (dd < 10)
	   {
	    dd = "0" + dd;
	   }
if (mm < 10)
	   {
	    mm = "0" + mm;
	   }	

       

if (intparty >8)
  {alert ("A maximum of 8 people are allowed. Please amend your search criteria.");
  }
else
	{
	if ((tyy == yy)&&(tmm < mm))
	   {alert ("This date is in the past, please amend your search date.");
	    }
  	else
	if ((tyy == yy)&&(tmm == mm)&&(tdd <= dd))
	   {alert ("This date is in the past, please amend your search date.");
		} 
	 /*else
	 if ((tyy == yy)&&(tmm >10))
		{
	   alert("Our latest campsite opening date is 28th October 2008. Please amend your search date.");
		}
	else
	if ((tyy != yy)&&(tmm < 2))
		{
	   alert("Our earliest campsite opening date is 9th February 2008. Please amend your search date.");
		}
	else
	if ((tmm == 2)&&(tdd <9))
		{
	   alert("Our earliest campsite opening date is 9th February 2008. Please amend your search date.");
		}
	else
	if ((tyy != yy)&&(tmm > 10))
		{
	   alert("Please note that arrivals are possible from 9th February until 28th October. Please amend your search date.");
		}*/
	/*else 
	if (((tmm == 2)||((tmm == 3)&&(tdd <31)))&&(myRegion != 38))
		{
			alert("The only region with availability before 31st March is Spain - Andalucia. Please amend your search region.");
		}*/
	else
	if (dzdiff <= 7)
	   {alert (dzmess);
	   }
	else{
	/*document.basic.arrivalDate.value = document.basic.ResortDate.value.substr(0, 2)
    document.basic.arrivalMonth.value = document.basic.ResortDate.value.substr(3, 2)
	document.basic.arrivalYear.value = document.basic.ResortDate.value.substr(6, 4)*/
	document.basic.submit();
		}
	}
}

/*function submitFormAdv()
{  
// Hide the code in first div tag  
//	document.getElementById('formDiv').style.display = 'none';  
// Display code in second div tag  
//	document.getElementById('pleaseWaitDiv').style.display = 'block'; 
var intparty = 	(parseInt(document.basic.adults.value) + parseInt(document.basic.children.value) + parseInt(document.basic.infants.value));
var intpets = 	(parseInt(document.basic.pets.value))
var d = new Date();//Get today's date
var dd = d.getDate();//This is the day
var mm = (d.getMonth() + 1);//This is the month (javascript uses 0 - 11)
var yy = d.getYear();//This is the year
var tyy = document.basic.arrivalYear.value;
var tmm = document.basic.arrivalMonth.value;
var tdd = document.basic.arrivalDate.value;
var startDate = new Date();//Create a new year variable to test minimum number of days a booking can be made.
startDate.setMonth(document.basic.arrivalMonth.value - 1);// Remember Javascript uses 0 - 11
startDate.setDate(document.basic.arrivalDate.value);
startDate.setYear(document.basic.arrivalYear.value);
var ONE_DAY = 1000 * 60 * 60 * 24 ;// Converts milliseconds into days
var dz = ((startDate)-(d));
var dzdiff = (dz/ONE_DAY);
var dzmess = ("Online kunt u geen last minute boeken.\n"+
	          "Wij raden u aan om contact op te nemen met onze reserveringsmedewerkers: tel. 033 460 27 22.")
if (dd < 10)
	   {
	    dd = "0" + dd;
	   }
if (mm < 10)
	   {
	    mm = "0" + mm;
	   }	
if (intparty >8)
  {alert ("Er zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
   return false;
  }
if (document.basic.region.value == 0)
  {alert("Kies een land/streek.");
  return false;
	}
else
	{
	if ((tyy == yy)&&(tmm < mm))
	   {alert ("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04 en 28/10)");
		return false;	   
	    }
  	else
	if ((tyy == yy)&&(tmm == mm)&&(tdd <= dd))
	   {alert ("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04 en 28/10)");
		return false;
		} 
	 else
	 if ((tyy == yy)&&(tmm >10))
		{
	   alert("Vul een geldige aankomstdatum in (aankomst mogelijk tot 28/10");
       return false;
		}
	else
	if ((tyy != yy)&&(tmm < 4))
		{
	   alert("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04/2006 en 28/10/2006)");
       return false;
		}
	else
	if ((tyy != yy)&&(tmm > 10))
		{
	   alert("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04/2006 en 28/10/2006)");
       return false;
		}
	else
	if (dzdiff <= 7)
	   {alert (dzmess);
	   return false;
	   }
	else
	if ((document.basic.chkAccom6.checked==true) && (intparty > 7))
		{alert("In een Venezia stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom11.checked==true) && (intparty > 7))
		{alert("In een Verona stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom10.checked==true) && (intparty > 8))
		{alert("In een Siena stacaravan zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom1.checked==true) && (intparty > 8))
		{alert("In een Monaco de Luxe stacaravan zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom2.checked==true) && (intparty > 8))
		{alert("In een Matisse stacaravan zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom3.checked==true) && (intparty > 7))
		{alert("In een Monet stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom4.checked==true) && (intparty > 7))
		{alert("In een Monaco stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom5.checked==true) && (intparty > 7))
		{alert("In een Versailles stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom7.checked==true) && (intparty > 8))
		{alert("In een Renoir stacaravan zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom8.checked==true) && (intparty > 7))
		{alert("In een Deauville stacaravan zijn max. 7 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom9.checked==true) && (intparty > 6))
		{alert("In een Cezanne stacaravan zijn max. 6 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.chkAccom12.checked==true) && (intparty > 5))
		{alert("In een Lautrec stacaravan zijn max. 5 personen toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else
	if ((document.basic.AccomValue == "MH") && (intpets > 0))
		{alert("In een stacaravan zijn honden niet toegestaan. Verander uw selectiecriteria.");
		return false;
		}
	else{
	document.basic.submit();
		}
	}
}*/

function submitAmendSearch()
{  
// Hide the code in first div tag  
//	document.getElementById('formDiv').style.display = 'none';  
// Display code in second div tag  
//	document.getElementById('pleaseWaitDiv').style.display = 'block'; 
var d = new Date();//Get today's date
var dd = d.getDate();//This is the day
var mm = (d.getMonth() + 1);//This is the month (javascript uses 0 - 11)
var yy = d.getYear();//This is the year
var myRegion = (document.basic.region.value)
var tyy = document.basic.arrivalYear.value;
var tmm = document.basic.arrivalMonth.value;
var tdd = document.basic.arrivalDate.value;
var startDate = new Date();//Create a new year variable to test minimum number of days a booking can be made.
startDate.setMonth(document.basic.arrivalMonth.value - 1);// Remember Javascript uses 0 - 11
startDate.setDate(document.basic.arrivalDate.value);
startDate.setYear(document.basic.arrivalYear.value);
var ONE_DAY = 1000 * 60 * 60 * 24 ;// Converts milliseconds into days
var dz = ((startDate)-(d));
var dzdiff = (dz/ONE_DAY);
var dzmess = ("You have searched for a holiday starting within the next 7 days.\n"+
              "Please call our last minute hotline on 0870 9098 909 for the latest deals.")
//var dzmess = ("Online bookings cannot be made within 7 working days of departure.\n"+
//	          "Please call our Reservations Team on 0870 9019 401 who will be happy to check availability.")

if (dd < 10)
	   {
	    dd = "0" + dd;
	   }
if (mm < 10)
	   {
	    mm = "0" + mm;
	   }	
if (document.basic.region.value == 0)
  {alert("Please choose a region");
  return false;
	}
else
	{
	if ((tyy == yy)&&(tmm < mm))
	   {alert ("This date is in the past. Please complete with a valid date.");
		return false;	   
	    }
  	else
	if ((tyy == yy)&&(tmm == mm)&&(tdd <= dd))
	   {alert ("This date is in the past. Please complete with a valid date.");
		return false;
		} 
	 /*else
	 if ((tyy == yy)&&(tmm >10))
		{
	   alert("Our campsites are open until 31st October 2008. Please amend your search criteria.");
       return false;
		}
	else
	if ((tyy != yy)&&(tmm < 2))
		{
	   alert("Our campsites are open from 9th February 2008. Please amend your search criteria.");
       return false;
		}
	else
	if ((tyy != yy)&&(tmm == 2)&&(tdd <91))
		{
	   alert("Our campsites are open from 9th February 2008. Please amend your search criteria.");
       return false;
		}
	else
	if ((tyy != yy)&&(tmm > 10))
		{
	   alert("Our campsites are open until 31st October 2008. Please amend your search criteria.");
       return false;
		}*/
	else
	if (((tmm == 1)||((tmm == 2)&&(tdd <31)))&&(myRegion != 38))
		{
			alert("The only region with availability before 31st March is Spain - Andalucia. Please amend your search region.");
		}

	else
	
	if (dzdiff <= 7)
	   {alert (dzmess);
	   return false;
	   }
	else
	if (document.basic.nights > 21)
	   {
	   alert ("Please note that a maximum of 21 nights can be booked online.");
	   }
	else{
	/*document.basic.arrivalDate.value = document.basic.ResortDate.value.substr(0, 2)
    document.basic.arrivalMonth.value = document.basic.ResortDate.value.substr(3, 2)
	document.basic.arrivalYear.value = document.basic.ResortDate.value.substr(6, 4)*/
	document.basic.submit();
		}
	}
}

function submitForm2()
{  
// Hide the code in first div tag  
//	document.getElementById('formDiv').style.display = 'none';  
// Display code in second div tag  

//	document.getElementById('pleaseWaitDiv').style.display = 'block'; 
var intparty = 	(parseInt(document.basic2.adults.value) + parseInt(document.basic2.children.value) + parseInt(document.basic2.infants.value));
var d = new Date();//Get today's date
var dd = d.getDate();//This is the day
var mm = (d.getMonth() + 1);//This is the month (javascript uses 0 - 11)
var yy = d.getYear();//This is the year
var tyy = document.basic2.arrivalYear.value;
var tmm = document.basic2.arrivalMonth.value;
var tdd = document.basic2.arrivalDate.value;
var startDate = new Date();//Create a new year variable to test minimum number of days a booking can be made.
startDate.setMonth(document.basic2.arrivalMonth.value - 1);// Remember Javascript uses 0 - 11
startDate.setDate(document.basic2.arrivalDate.value);
startDate.setYear(document.basic2.arrivalYear.value);
var ONE_DAY = 1000 * 60 * 60 * 24 ;// Converts milliseconds into days
var dz = ((startDate)-(d));
var dzdiff = (dz/ONE_DAY);
var dzmess = ("You have searched for a holiday which starts in the next 7 days.\n"+
              "Please call our last minute hotline on 0870 9098 909 for the latest deals.")
//var dzmess = ("Online bookings cannot be made within 7 working days of departure.\n"+
//	          "Please call our Reservations Team on 0870 9019 401 who will be happy to check availability.")
if (dd < 10)
	   {
	    dd = "0" + dd;
	   }
if (mm < 10)
	   {
	    mm = "0" + mm;
	   }	
if (intparty >8)
  {alert ("Er zijn max. 8 personen toegestaan. Verander uw selectiecriteria.");
   return false;
  }
if (document.basic2.region.value == 0)
  {alert("Kies een land/streek.");
  return false;
	}
else
	{
	if ((tyy == yy)&&(tmm < mm))
	   {alert ("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04 en 28/10)");
		return false;	   
	    }
  	else
	if ((tyy == yy)&&(tmm == mm)&&(tdd <= dd))
	   {alert ("Vul een geldige aankomstdatum in (aankomst mogelijk tussen 08/04 en 28/10)");
		return false;
		} 
	 else
	 if ((tyy == yy)&&(tmm >10))
		{
	   alert("Vul een geldige aankomstdatum in (aankomst mogelijk tot 28/10");
       return false;
		}
	else
	if (dzdiff <= 7)
	   {alert (dzmess);
	   return false;
	   }
	else{
	/*document.basic2.arrivalDate.value = document.basic2.ResortDate.value.substr(0, 2)
    document.basic2.arrivalMonth.value = document.basic2.ResortDate.value.substr(3, 2)
	document.basic2.arrivalYear.value = document.basic2.ResortDate.value.substr(6, 4)*/
	document.basic2.submit();
		}
	}
}


function SwapAdvance()
{  
// Hide the code in first div tag
document.getElementById('quicksearch').style.display ='none';
document.getElementById('advsearch').style.display ='block';
/*document.QuickSearchAccomm.traveloption[0].checked = false; //flight
document.QuickSearchAccomm.traveloption[1].checked = true; //accom

}
function divSwapFlt()
{  
// Hide the code in first div tag
document.getElementById('flightaccom').style.display ='block';
document.getElementById('accomonly').style.display ='none';
document.basic2.traveloption[0].checked = true; //flight
document.basic2.traveloption[1].checked = false; //accom
}*/
}
function popurl(url, w, h)
{
	if (w==0)
	{
	  w = 800; //default width
	}
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width='+ w + ',height=' + h +'');
	self.name = "mainWin";
	sealWin.focus()
}



