function right(e) {
//disables right mouse and stops unauthorized copy of webcontent
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("Sorry, right click function inoperative.");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;


function DHTime_Orlando_villas()
{                                                                                        
//For date and time setting on displayed webpage
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym='0'+daym
var dayarray=new Array('Sun','Mon','Tues','Wed','Thur','Fri','Sat')
var montharray=new Array('January','February','March','April','May','June','July','August','September','October','November','December')
document.write(dayarray[day]+', '+montharray[month]+' '+daym+', '+year)

}


var dValue = 0
var dValuepoolheat = 0 ;
var dValuechildpack = 0 ;
var dValuegrocerypack = 0 ; 
var dValuemidstayclean = 0 ;
var dValuepcwithinternet = 2 ; 



 function setfocus()
	{
//For generic setting of mouse or windows position. Used in several docs
		var nowDate = new Date()

//ordercreditcard worldpay html and ordercredicardpaypal.htm
		document.frmOrder.arrDay.focus()
		document.frmOrder.txttotalcost.value =  0.00 ;    
	//	document.frmOrder.txtfloridatax.value =  0.00 ;  
	//	document.frmOrder.txtdiscount.value =  0.00 ;  
		document.frmOrder.txtpaydeposit.value =  0.00 ; 
		document.frmOrder.txtpaytotal.value =  0.00 ;  

//extraservices

		document.frmExtraServiceOrder.arrDay.focus()
		document.frmExtraServiceOrder.txtpoolheat.value =  0.00 ;    
		document.frmExtraServiceOrder.txtchildpack.value =  0.00 ;  
		document.frmExtraServiceOrder.txtgrocerypack.value =  0.00 ;  
		document.frmExtraServiceOrder.txtmidstayclean.value =  0.00 ; 
		document.frmExtraServiceOrder.txtpcwithinternet.value =  0.00 ;  
	        document.frmExtraServiceOrder.txttotalcost.value =  0.00 ; 
//faxorders
		document.frmfaxOrder.arrDay.focus()
		document.frmfaxOrder.txtAnswer1.value =  0.00 ;    
		document.frmfaxOrder.txtAnswer2.value =  0.00 ;  
//mailorder
		document.frmmailOrder.arrDay.focus()
		document.frmmailOrder.txtAnswer1.value =  0.00 ;    
		document.frmmailOrder.txtAnswer2.value =  0.00 ;  

			 
	}




 function checkdropaline(f) {
//For checking of input form completed. Checks name, mail, arrivdates dept dates
	
   if(document.dropaline.name.value == ""){alert("Enter your name please.");return false;}   	
   if(document.dropaline.email.value == ""){alert("Enter your E-mail address please.");return false;}
   	if(document.dropaline.phone.value == ""){alert("Enter your contact phone number please.");return false;}

   if(document.dropaline.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.dropaline.arrMonth.value,document.dropaline.arrYear.value)
	if (document.dropaline.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.dropaline.arrDay.value == ""){alert("Select Arrival Day.");return false;}
   if(document.dropaline.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userarrDate = new Date(document.dropaline.arrYear.value,document.dropaline.arrMonth.value-1,document.dropaline.arrDay.value)
	
	if (userarrDate.getTime() < nowDate.getTime() || document.dropaline.arrDay.value > dm)  
			{alert("Invalid Arrival Date, Month and/or Year - Please re-select.");return false;}
			
			
   if(document.dropaline.depMonth.value == ""){alert("Select Departure Month.");return false;}
   var dm = daysmonth(document.dropaline.depMonth.value,document.dropaline.depYear.value)
	if (document.dropaline.depDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.dropaline.depDay.value == ""){alert("Select Departure Day.");return false;}
   if(document.dropaline.depYear.value == "" ){alert("Select Departure Year.");return false;}
   
   var userdepDate = new Date(document.dropaline.depYear.value,document.dropaline.depMonth.value-1,document.dropaline.depDay.value)
	
	if (userdepDate.getTime() < nowDate.getTime() || document.dropaline.depDay.value > dm)  
			{alert("Invalid Departure Date, Month and/or Year - Please re-select.");return false;}

   if (userdepDate.getTime() < userarrDate.getTime() )  
	 {alert("Ooops Invalid Entry: Your Departure Date, Month and/or Year is earlier than Arrival Date - Please re-select.");return false;}
   
}

function daysmonth(m,y)
	{
//For check days in the months including Feb 28 & 29 or 31 
		if 
		(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
			return 31;
		else
			{
				if (m==4 || m==6 || m==9 || m==11)
					return 30;
				else
					{
						if (isleapyear(y))
							return 29;
						else
							return 28;
					}
			}
	}
	
function isleapyear(y)
	{
//For checking leap years 
		if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
			return true;
		else
			return false;
	}
	


// OKStrOfMN
// rounds off X to N decimal places, ensuring there are at least M leading 0's
// http://www.merlyn.demon.co.uk/js-maths.htm
function OKStrOfMN(X, M, N) {
	var T, S=new String(Math.round(X*Number("1e"+N)))
	while (S.length<M+N) S='0'+S
	var y = S.substr(0, T=(S.length-N));
	if(N>0) {
		y += '.' + S.substr(T, N);
		}
	 return y;
	}


 function checkdatagbp(f) {
// check data for Currency if £GBP
// calculation of payamount in ordercreditcard.html	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

   
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
    
   if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	
   
// Check amount for arrival date
       var amount1 = checkdata2(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
       var amountMidWk1 = checkdata2(MidWk1Datemonth,MidWk1daym)
 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
       var amountStartwk2 = checkdata2(Startwk2Datemonth,Startwk2daym)
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
       var amountendDay = checkdata2(deptDatemonth,deptdaym)
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
     
				
	  var totaldisc;
		 totaldisc= (0.0*0.14285714*n*0.66667);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
		 dposit = 100 ;   // If UK, deposit is £100
	
     	 
         document.frmOrder.txttotalcost.value = "£"+grandtotal ; 
 
        
  //     if(document.frmOrder.country.value == "UK")    
  //       document.frmOrder.txtfloridatax.value = "£"+ fltax ;  
  //     else 
  //      document.frmOrder.txtfloridatax.value = "$"+ fltax  ; 
 
  //    if(document.frmOrder.country.value == "UK")    
  //       document.frmOrder.txtdiscount.value =  "£"+totaldisc ;  
  //     else 
  //      document.frmOrder.txtdiscount.value =  "$"+totaldisc  ; 
 
              
         document.frmOrder.txtpaydeposit.value =  "£"+dposit ;  //whatopay ; 

         document.frmOrder.txtpaytotal.value =  "£"+grandtotal ;  //whatopay ; 
 

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to pay deposit or total cost and proceed to secure server for details.");return false;}
     
    // Next check if booking is wihin 14days of arrival and prompt for full payment 
   
	//	var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
	//	var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
  	   Datediff = (userDate - nowDate)/(24*60*60*1000);
      
   //  alert("nowTimexx="+nowDate);
   //  alert("userDate="+userDate);
	//  alert(Datediff);
	   
	   if(dValue=="1") 
			{
				if (Datediff<=14)
					{alert("You arrive in "+Datediff+" days. Please select to pay total cost and proceed - full payment required if arriving within 14-days of this booking");return false;}
			}
		
	   
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ;
         
      var balanceleft = grandtotal - whatopay ;    
 
 
      //Unique Order ID
	  
       var nowTime = new Date()
   		var date=nowTime.getDate()
		var month=nowTime.getMonth()+1
		var year=nowTime.getYear()
		var time=nowTime.getTime()
	
     
      var ad = document.frmOrder.arrDay.value;
      var am = document.frmOrder.arrMonth.value;
      var ay = document.frmOrder.arrYear.value - 2000;
      var nts = document.frmOrder.nights.value;
      var yn  = year - 2000 ; 

    //	cartId = (date+"/"+month+"/"+year+"/"+time+"/"+document.frmOrder.name.value); 
    //	cartId = (time+"/"+document.frmOrder.name.value); 
    //cartId2 = ("CD"+date+month+year+"F"+document.frmOrder.arrDay.value+document.frmOrder.arrMonth.value+document.frmOrder.arrYear.value); 
    //cartId = (date+month+year+time+"CD"); 
    // cartId = ("Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+"-"+month+"-"+year); 

    //alert("CatID = "+"Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn); 


 
  //setup to announce/describe the planned arrival arriveday(eg sat), arrivedate, arrivemonth and arriveyear in receipt
  var thearrivedate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value);  
  var thearriveyear=thearrivedate.getYear()
  if (thearriveyear < 1000) thearriveyear+=1900
  var thearriveday=thearrivedate.getDay()
  var thearrivemonth=thearrivedate.getMonth()
  var daymarrive=thearrivedate.getDate()
  if (daymarrive<10) daymarrive="0"+daymarrive
  var thearrivedayarray=new Array("Sun","Mon","Tues","Wed","Thu","Fri","Sat");
  var thearrivemontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var keyday = thearrivedayarray[thearriveday] ;
  var keymonth = thearrivemontharray[thearrivemonth]
  
		
//setupfuture payamount to be paid 14-days BUT ALLOW 12-DAYS just incase before arrival if total is not paid now
  var futurepaydate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value-12);   
   var futurepayyear=futurepaydate.getYear()
   if (futurepayyear < 1000) futurepayyear+=1900
   var futurepayday=futurepaydate.getDay()
   var futurepaymonth=futurepaydate.getMonth()+1
   var daym=futurepaydate.getDate()
//workout month name
  var futurepaymontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var fbalmonth = futurepaymontharray[futurepaymonth-1]

 var fbaldate =(fbalmonth+daym+","+futurepayyear); 
// alert (fbaldate) ;

//submission of variable and data to Paypal
    document.submitform.item_number.value=("Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn);
    document.submitform.amount.value=whatopay;
//    document.submitform.currency_code.value="GBP";
  

//	 document.submitform.name.value=(document.frmOrder.title.value+". "+document.frmOrder.name.value);
//	 document.submitform.address.value=document.frmOrder.address.value;
//	 document.submitform.postcode.value=document.frmOrder.postcode.value;
//    document.submitform.country.value=document.frmOrder.country.value;
//	 document.submitform.email.value=document.frmOrder.email.value;
//	 document.submitform.tel.value=document.frmOrder.telephone.value;
//	 document.submitform.fax.value=document.frmOrder.fax.value;
	 
	 
   if(dValue=="1")
   document.submitform.item_name.value=("Deposit for DelitHomes Orlando Villa Rental Florida for: "+nts+"nights from "+keyday+","+keymonth+" "+daymarrive+", "+thearriveyear +". Balance of £"+balanceleft+ " will be received around "+fbaldate+". Thank you! "+" Address & direction to your Delithome villa will follow in the next 48hrs");
  else if(dValue=="2") 
  document.submitform.item_name.value=("Full Cost for DelitHomes Orlando Villa Rental Florida for: "+nts+"nights from "+ keyday+","+keymonth+" "+daymarrive+", "+thearriveyear+", with full payment being made now. Thank you and see you soon in Orlando!"+" Address & direction to your Delithome villa will follow in the next 48hrs");

   
//   alert("Proceeding to secured site for payment details. Press OK")
   
 }


function checkradio(f)
	{
		if (f.value == 1)
			dValue = 1;
		if (f.value == 2)
			dValue = 2;
	}


	
 function checkcostdatagbp(f) {
// Costdata in £GBP
//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}

  var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
	
	if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	   
// Check amount for arrival date
       var amount1 = checkdata2(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
       var amountMidWk1 = checkdata2(MidWk1Datemonth,MidWk1daym)
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
       var amountStartwk2 = checkdata2(Startwk2Datemonth,Startwk2daym)
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
       var amountendDay = checkdata2(deptDatemonth,deptdaym)
  
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
	  		
	  var totaldisc;
		 totaldisc= (0.0*0.14285714*n*0.66667);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
		 dposit = 100 ;   // If UK, deposit is £100
     	 
         document.frmOrder.txttotalcost.value = "£"+grandtotal ; 
        
    //   if(document.frmOrder.country.value == "UK")     
    //     document.frmOrder.txtfloridatax.value = "£"+ fltax ;  
    //   else 
    //    document.frmOrder.txtfloridatax.value = "$"+ fltax  ; 
 
    //  if(document.frmOrder.country.value == "UK")    
    //     document.frmOrder.txtdiscount.value =  "£"+totaldisc ;  
    //   else 
    //    document.frmOrder.txtdiscount.value =  "$"+totaldisc  ; 
 
              
         document.frmOrder.txtpaydeposit.value =  "£"+dposit ;  //whatopay ; 

  
         document.frmOrder.txtpaytotal.value =  "£"+grandtotal ;  //whatopay ; 

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
   // a must to proceed or not a must if just checking cost.
   //  if (dValue == "0") {alert("Please select to either pay deposit or total cost and proceed.");return false;}
     
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ;
        
     var nts = document.frmOrder.nights.value ;   
//   alert("Rate based on your arrival details--> An Executive Delithome sleeps 2-10 persons!");	   
     alert("Rate for "+nts+"nights --> in an Executive Delithome --> Sleeps 2-10 persons!");	
}


function checkdata2(m,d)
{
 
//UK prices
  if (m==1) if (d <=3)return 693 ; 
  if (m==1) if (d >3) return 490 ;
  if (m==2) return 553 ; 
  if (m==3) return 623 ; 
  if (m==4) if (d <=25)return 693 ; 
  if (m==4) if (d >25) return 623 ;
  if (m==5) return 623 ; 
  if (m==6) return 623 ; 
  if (m==7) return 693 ; 
  if (m==8) return 693 ; 
  if (m==9) return 553 ; 
  if (m==10) if (d <=15)return 553 ; 
  if (m==10) if (d >15) return 623 ;
  if (m==11) if (d <=2)return 623 ; 
  if (m==11) if (d >2) return 490 ;
  if (m==12) if (d <=18)return 490 ; 
  if (m==12) if (d >18) return 693 ;  
}

function checkdata3(m,d)
//US Prices
{
 
  if (m==1) if (d <=3)return 1015 ; 
  if (m==1) if (d >3) return 735 ;
  if (m==2) return 805 ; 
  if (m==3) return 905 ; 
  if (m==4) if (d <=25)return 1015 ; 
  if (m==4) if (d >25) return 905 ;
  if (m==5) return 905 ; 
  if (m==6) return 905 ; 
  if (m==7) return 1015 ; 
  if (m==8) return 1015 ; 
  if (m==9) return 805 ; 
  if (m==10) if (d <=15)return 805 ; 
  if (m==10) if (d >15) return 905 ;
  if (m==11) if (d <=2)return 905 ; 
  if (m==11) if (d >2) return 735 ;
  if (m==12) if (d <=18)return 735 ; 
  if (m==12) if (d >18) return 1015 ;
}


 function checkdatausd(f) {
//check costdata in $USD	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
 
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
    
   if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	
   
// Check amount for arrival date
     var amount1 = checkdata3(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountMidWk1 = checkdata3(MidWk1Datemonth,MidWk1daym) ;
 	 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountStartwk2 = checkdata3(Startwk2Datemonth,Startwk2daym);
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
 	   var amountendDay = checkdata3(deptDatemonth,deptdaym) ;
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
     
				
	  var totaldisc;
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
     	 dposit= 150;   // Others, deposit is $150
     	  
        document.frmOrder.txttotalcost.value = "$"+grandtotal ; 
        
        document.frmOrder.txtpaydeposit.value =  "$"+dposit ;  //whatopay ;

        document.frmOrder.txtpaytotal.value =  "$"+grandtotal ;  //whatopay ;

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to pay deposit or total cost and proceed to secure server for details.");return false;}
     
    // Next check if booking is wihin 14days of arrival and prompt for full payment 
   
	//	var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
	//	var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
  	   Datediff = (userDate - nowDate)/(24*60*60*1000);
      
   //  alert("nowTimexx="+nowDate);
   //  alert("userDate="+userDate);
	//  alert(Datediff);
	   
	   if(dValue=="1") 
			{
				if (Datediff<=14)
					{alert("You arrive in "+Datediff+" days. Please select to pay total cost and proceed - full payment required if arriving within 14-days of this booking");return false;}
			}
		
	   
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ;
      
     var balanceleft = grandtotal - whatopay ;    
    
 
      //Unique Order ID
	  
       var nowTime = new Date()
   		var date=nowTime.getDate()
		var month=nowTime.getMonth()+1
		var year=nowTime.getYear()
		var time=nowTime.getTime()
	
     
      var ad = document.frmOrder.arrDay.value;
      var am = document.frmOrder.arrMonth.value;
      var ay = document.frmOrder.arrYear.value - 2000;
      var nts = document.frmOrder.nights.value;
      var yn  = year - 2000 ; 

 
  //setup to announce/describe the planned arrival arriveday(eg sat), arrivedate, arrivemonth and arriveyear in receipt
  var thearrivedate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value);  
  var thearriveyear=thearrivedate.getYear()
  if (thearriveyear < 1000) thearriveyear+=1900
  var thearriveday=thearrivedate.getDay()
  var thearrivemonth=thearrivedate.getMonth()
  var daymarrive=thearrivedate.getDate()
  if (daymarrive<10) daymarrive="0"+daymarrive
  var thearrivedayarray=new Array("Sun","Mon","Tues","Wed","Thu","Fri","Sat");
  var thearrivemontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var keyday = thearrivedayarray[thearriveday] ;
  var keymonth = thearrivemontharray[thearrivemonth]
  
		
//setupfuture payamount to be paid 14-days BUT ALLOW 12-DAYS just incase before arrival if total is not paid now
  var futurepaydate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value-12);   
   var futurepayyear=futurepaydate.getYear()
   if (futurepayyear < 1000) futurepayyear+=1900
   var futurepayday=futurepaydate.getDay()
   var futurepaymonth=futurepaydate.getMonth()+1
   var daym=futurepaydate.getDate()
//workout month name
  var futurepaymontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var fbalmonth = futurepaymontharray[futurepaymonth-1]

 var fbaldate =(fbalmonth+daym+","+futurepayyear); 
// alert (fbaldate) ;

//submission of cartID and other variables and data to Paypal  
 
   document.submitform.item_number.value=("Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn);
   document.submitform.amount.value=whatopay;
  
   if(dValue=="1")
   document.submitform.item_name.value=("Deposit for DelitHomes Orlando Villa Rental Florida for:"+nts+"nights from "+keyday+", "+keymonth+" "+daymarrive+", "+thearriveyear +". Balance:$"+balanceleft+" due around "+fbaldate+".   Thank you!");
  else if(dValue=="2") 
  document.submitform.item_name.value=("Full Cost for DelitHomes Orlando Villa Rental Florida for:"+nts+"nights from "+ keyday+", "+keymonth+""+daymarrive+","+thearriveyear+". Thank you!"+" Details follow within 48hrs");

//   alert("Proceeding to secured site for payment details. Press OK")
   
 }

 function checkdatausd2checkout(f) {
//check costdata in $USD	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
 
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
    
   if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	
   
// Check amount for arrival date
     var amount1 = checkdata3(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountMidWk1 = checkdata3(MidWk1Datemonth,MidWk1daym) ;
 	 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountStartwk2 = checkdata3(Startwk2Datemonth,Startwk2daym);
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
 	   var amountendDay = checkdata3(deptDatemonth,deptdaym) ;
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
     
				
	  var totaldisc;
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
     	 dposit= 150;   // Others, deposit is $150
     	  
        document.frmOrder.txttotalcost.value = "$"+grandtotal ; 
        
        document.frmOrder.txtpaydeposit.value =  "$"+dposit ;  //whatopay ;

        document.frmOrder.txtpaytotal.value =  "$"+grandtotal ;  //whatopay ;

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to pay deposit or total cost and proceed to secure server for details.");return false;}
     
    // Next check if booking is wihin 14days of arrival and prompt for full payment 
   
	//	var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
	//	var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
  	   Datediff = (userDate - nowDate)/(24*60*60*1000);
      
   //  alert("nowTimexx="+nowDate);
   //  alert("userDate="+userDate);
	//  alert(Datediff);
	   
	   if(dValue=="1") 
			{
				if (Datediff<=14)
					{alert("You arrive in "+Datediff+" days. Please select to pay total cost and proceed - full payment required if arriving within 14-days of this booking");return false;}
			}
		
	   
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ;
      
     var balanceleft = grandtotal - whatopay ;    
    
 
      //Unique Order ID
	  
       var nowTime = new Date()
   		var date=nowTime.getDate()
		var month=nowTime.getMonth()+1
		var year=nowTime.getYear()
		var time=nowTime.getTime()
	
     
      var ad = document.frmOrder.arrDay.value;
      var am = document.frmOrder.arrMonth.value;
      var ay = document.frmOrder.arrYear.value - 2000;
      var nts = document.frmOrder.nights.value;
      var yn  = year - 2000 ; 

 
  //setup to announce/describe the planned arrival arriveday(eg sat), arrivedate, arrivemonth and arriveyear in receipt
  var thearrivedate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value);  
  var thearriveyear=thearrivedate.getYear()
  if (thearriveyear < 1000) thearriveyear+=1900
  var thearriveday=thearrivedate.getDay()
  var thearrivemonth=thearrivedate.getMonth()
  var daymarrive=thearrivedate.getDate()
  if (daymarrive<10) daymarrive="0"+daymarrive
  var thearrivedayarray=new Array("Sun","Mon","Tues","Wed","Thu","Fri","Sat");
  var thearrivemontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var keyday = thearrivedayarray[thearriveday] ;
  var keymonth = thearrivemontharray[thearrivemonth]
  
		
//setupfuture payamount to be paid 14-days BUT ALLOW 12-DAYS just incase before arrival if total is not paid now
  var futurepaydate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value-12);   
   var futurepayyear=futurepaydate.getYear()
   if (futurepayyear < 1000) futurepayyear+=1900
   var futurepayday=futurepaydate.getDay()
   var futurepaymonth=futurepaydate.getMonth()+1
   var daym=futurepaydate.getDate()
//workout month name
  var futurepaymontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var fbalmonth = futurepaymontharray[futurepaymonth-1]

 var fbaldate =(fbalmonth+daym+","+futurepayyear); 
// alert (fbaldate) ;

//submission of cartID and other variables and data to Paypal  
 
  //  document.submitform.item_number.value=("Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn);
  
  document.submitform.total.value=whatopay;
  
   if(dValue=="1")
   document.submitform.cart_order_id.value=("Deposit for DelitHomes Orlando Villa Rental Florida for:"+nts+"nights from "+keyday+", "+keymonth+" "+daymarrive+", "+thearriveyear +". Balance:$"+balanceleft+" due around "+fbaldate+".   Thank you!");
  else if(dValue=="2") 
  document.submitform.cart_order_id.value=("Full Cost for DelitHomes Orlando Villa Rental Florida for:"+nts+"nights from "+ keyday+", "+keymonth+""+daymarrive+","+thearriveyear+". Thank you!"+" Details follow within 48hrs");

//   alert("Proceeding to secured site for payment details. Press OK")
   
 }

function checkcostdatausd(f) {
// costdata in currency $USD 
//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}

  var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
	
	if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	   
// Check amount for arrival date
 	 var amount1 = checkdata3(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value) ;
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountMidWk1 = checkdata3(MidWk1Datemonth,MidWk1daym) ;
 	 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountStartwk2 = checkdata3(Startwk2Datemonth,Startwk2daym) ;
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
 	   var amountendDay = checkdata3(deptDatemonth,deptdaym) ;
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
	  		
	  var totaldisc;
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
     	 dposit= 150;   // Others, deposit is $150
     	 
    
       document.frmOrder.txttotalcost.value = "$"+grandtotal ; 
                      
        document.frmOrder.txtpaydeposit.value =  "$"+dposit ;  //whatopay ;

        document.frmOrder.txtpaytotal.value =  "$"+grandtotal ;  //whatopay ;

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
   // a must to proceed or not a must if just checking cost.
   //  if (dValue == "0") {alert("Please select to either pay deposit or total cost and proceed.");return false;}
     
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ;
        
     var nts = document.frmOrder.nights.value ;   
//   alert("Rate based on your arrival details--> An Executive Delithome sleeps 2-10 persons!");	   
     alert("Rate for "+nts+"nights --> in an Executive Delithome --> Sleeps 2-10 persons!");	
}

 function checkdataExtraServices(f) {
	
   if(document.frmExtraServiceOrder.name.value == ""){alert("Enter your name.");return false;}
   	if(document.frmExtraServiceOrder.email.value == ""){alert("Enter your E-mail address.");return false;}
	if(document.frmExtraServiceOrder.address.value == ""){alert("Enter your full address including street, city & zipcode.");return false;}
	if(document.frmExtraServiceOrder.postcode.value == ""){alert("Enter your Zip/Post Code.");return false;}
	if(document.frmExtraServiceOrder.country.value == ""){alert("Enter Country.");return false;}
   	if(document.frmExtraServiceOrder.telephone.value == ""){alert("Enter your Contact Phone number.");return false;}
	if(document.frmExtraServiceOrder.fax.value == ""){alert("Enter a Fax number.");return false;}
   if(document.frmExtraServiceOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmExtraServiceOrder.arrMonth.value,document.frmExtraServiceOrder.arrYear.value)
	if (document.frmExtraServiceOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmExtraServiceOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmExtraServiceOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmExtraServiceOrder.arrYear.value,document.frmExtraServiceOrder.arrMonth.value-1,document.frmExtraServiceOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmExtraServiceOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
	if(document.frmExtraServiceOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}


   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variables
     if (dValuepoolheat == "") {alert("Please select poolheat option");return false;}
     if (dValuechildpack == "") {alert("Please select childpack option");return false;}
     if (dValuegrocerypack == "") {alert("Please select Grocery pack option");return false;}
     if (dValuemidstayclean == "") {alert("Please select Mid-stay cleaning option");return false;}
     if (dValuepcwithinternet == "") {alert("Please select PC with Internet Option.");return false;}


   // Next check if booking is wihin 14days of arrival and prompt for full payment 
   
       Datediff = (userDate - nowDate)/(24*60*60*1000);
      
	   
	   if(dValuegrocerypack=="1") 
			{
				if (Datediff<2)
					{alert("You arrive in "+Datediff+" days. Grocery Pack Service needs to be requested at least 2-days ahead of arrival");return false;}
			}
	
      if (Datediff<2) dValuegrocerypack=2 ; //set it to NO to prevent any addition of this service request violation
      
  //Now work out cost for the services requested
  

   	  var  n=eval(document.frmExtraServiceOrder.nights.value);      // n = the number of nights input
	  
   //Poolheating  	
    	if(dValuepoolheat=="1") 
			{
				if(document.frmExtraServiceOrder.country.value == "UK")
				 var poolheatcost = (85.0*n/7.00) ; 
				else
				 var poolheatcost = (120.0*n/7.00) ; 				
			}
        
        else
			var poolheatcost = 0;

          poolheatcost=OKStrOfMN(poolheatcost, 2, 2);  //round off to 2decimal places

	

   //childpack 	
    	if(dValuechildpack=="1") 
			{
				if(document.frmExtraServiceOrder.country.value == "UK")
				 var childpackcost = (20.0*n/7.00) ; 
				else
				 var childpackcost = (30.0*n/7.00) ; 				
			}
        else
			var childpackcost = 0;

          childpackcost=OKStrOfMN(childpackcost, 2, 2);  //round off to 2decimal places

  //grocerypack 	
    	if(dValuegrocerypack=="1") 
			{
				if(document.frmExtraServiceOrder.country.value == "UK")
				 var grocerypackcost = (20.0*1.0) ; 
				else
				 var grocerypackcost = (30.0*1.0) ; 				
			}
        else
			var grocerypackcost = 0;
        
          grocerypackcost=OKStrOfMN(grocerypackcost, 2, 2);  //round off to 2decimal places


   //midstayclean 	
    	if(dValuemidstayclean=="1") 
			{
				if(document.frmExtraServiceOrder.country.value == "UK")
				 var midstaycleancost = (35.0*1.0) ; 
				else
				 var midstaycleancost = (50.0*1.0) ; 				
			}
			
       else
			var midstaycleancost = 0;

       midstaycleancost=OKStrOfMN(midstaycleancost, 2, 2);  //round off to 2decimal places

           
  //pcwithinternet 	
    	if(dValuepcwithinternet=="1"){alert("PC with Internet Service Unavailable. Please contact Delithomes to confirm availability & cost! Proceed with other services above.")} 
	
         var pcwithinternetcost = 0.00 ;
         pcwithinternetcost=OKStrOfMN(pcwithinternetcost, 2, 2);  //round off to 2decimal places
 

  //Round off costs  places
	  var exsgrandtotal 
	   exsgrandtotal =Math.round(100* (poolheatcost*1.0+childpackcost*1.0+grocerypackcost*1.0+midstaycleancost*1.0+pcwithinternetcost*1.0))/100; ; //pc cost not included set to zero!

     exsgrandtotal=OKStrOfMN(exsgrandtotal,2,2); 
	    
	    
//write to display the various cost of form	    
		 
       if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txtpoolheat.value = "£"+ poolheatcost ; 
       else 
         document.frmExtraServiceOrder.txtpoolheat.value = "$"+ poolheatcost ; 
      
 		 
       if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txtchildpack.value = "£"+ childpackcost ; 
       else 
         document.frmExtraServiceOrder.txtchildpack.value = "$"+ childpackcost ; 
      
 
       if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txtgrocerypack.value = "£"+ grocerypackcost ; 
       else 
         document.frmExtraServiceOrder.txtgrocerypack.value = "$"+ grocerypackcost ; 
            

  	    if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txtmidstayclean.value = "£"+ midstaycleancost ; 
       else 
         document.frmExtraServiceOrder.txtmidstayclean.value = "$"+ midstaycleancost ; 
            

     	 if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txtpcwithinternet.value = "£"+pcwithinternetcost ; 
       else 
         document.frmExtraServiceOrder.txtpcwithinternet.value = "$"+pcwithinternetcost ; 
               
  
       if(document.frmExtraServiceOrder.country.value == "UK")  //   
         document.frmExtraServiceOrder.txttotalcost.value = "£"+exsgrandtotal ; 
       else 
         document.frmExtraServiceOrder.txttotalcost.value = "$"+exsgrandtotal ; 
               
   
   	  //Dont proceed if no Extra Services requested. 
	   if(exsgrandtotal<=0) {alert("No Extra Service Requested for your stay!");return false;}
		

 
      
  	
	//	if(exsgrandtotal>0) 
	//		{
	//			if (Datediff<2)
	//				{alert("You arrive in "+Datediff+" day+"(s)."+" Extra Service needs to be requested at least 2-days ahead of arrival");return false;}
	//		}
	

	   var whatopay = exsgrandtotal ;
    
      //Unique Order ID
	  

       var nowTime = new Date()
   		var date=nowTime.getDate()
		var month=nowTime.getMonth()+1
		var year=nowTime.getYear()
		var time=nowTime.getTime()
	
     
      var ad = document.frmExtraServiceOrder.arrDay.value;
      var am = document.frmExtraServiceOrder.arrMonth.value;
      var ay = document.frmExtraServiceOrder.arrYear.value - 2000;
      var nts = document.frmExtraServiceOrder.nights.value;
      var yn  = year - 2000 ; 


 //submission of data to Paypal
 //  check if payment is in US or UK currency
    document.submitform.item_number.value=("Ref#: ES-D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn);
    document.submitform.amount.value=whatopay;
    if(document.frmExtraServiceOrder.country.value == "UK")  //   
       document.submitform.currency_code.value="GBP";
    else 
       document.submitform.currency_code.value="USD";


  //setup to announce/describe the planned arrival arriveday(eg sat), arrivedate, arrivemonth and arriveyear in receipt
  var thearrivedate=new Date(document.frmExtraServiceOrder.arrYear.value,document.frmExtraServiceOrder.arrMonth.value-1,document.frmExtraServiceOrder.arrDay.value);  
  var thearriveyear=thearrivedate.getYear()
  if (thearriveyear < 1000) thearriveyear+=1900
  var thearriveday=thearrivedate.getDay()
  var thearrivemonth=thearrivedate.getMonth()
  var daymarrive=thearrivedate.getDate()
  if (daymarrive<10) daymarrive="0"+daymarrive
  var thearrivedayarray=new Array("Sun","Mon","Tues","Wed","Thu","Fri","Sat");
  var thearrivemontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var keyday = thearrivedayarray[thearriveday] ;
  var keymonth = thearrivemontharray[thearrivemonth] ;
  
  //let me see if I can list requested services
   if(dValuepoolheat=="1") 
      var plh = "Pool heating";
   else 
       var plh = "";
       
//childpack 	
    if(dValuechildpack=="1") 
    	 var cpk = "Child pack";
   else 
       var cpk = "";

 //grocerypack 	
    if(dValuegrocerypack=="1") 
    	 var gpk = "Grocery pack";
   else 
        var gpk = "";

   
 //midstayclean 	
    	if(dValuemidstayclean=="1") 
     		 var msc = "Midstay clean";
       else 
           var msc = "";
	
   	
//pcwithinternet 	
    	if(dValuepcwithinternet=="1")
    	   	var pci = "PC with Internet";
       else 
           var pci = "";

    var listrequest = (plh+" "+cpk+" "+gpk+" "+msc+" "+pci);	
  //  alert("pl="+listrequest);
    
		
  document.submitform.item_name.value=("ExtraServices request"+ " ("+listrequest+") with DelitHomes Orlando Florida for: "+nts+"nights from "+ keyday+", "+keymonth+" "+daymarrive+", "+thearriveyear+", with full payment being made now. Thank you and see you soon in Orlando!");

  //  document.submitform.testMode.value="100"  

//	 document.submitform.name.value=(document.frmExtraServiceOrder.title.value+". "+document.frmExtraServiceOrder.name.value);
//	 document.submitform.address.value=document.frmExtraServiceOrder.address.value;
//	 document.submitform.postcode.value=document.frmExtraServiceOrder.postcode.value;
//            document.submitform.country.value=document.frmExtraServiceOrder.country.value;
//	 document.submitform.email.value=document.frmExtraServiceOrder.email.value;
//	 document.submitform.tel.value=document.frmExtraServiceOrder.telephone.value;
//	 document.submitform.fax.value=document.frmExtraServiceOrder.fax.value;
	 


//   alert("Proceeding to secured site for payment details. Press OK") ;
   
 }





function checkpoolheatradio(f)
	{
		if (f.value == 1)
			dValuepoolheat = 1;
		if (f.value == 2)
			dValuepoolheat = 2;
	}

function checkchildpackradio(f)
	{
		if (f.value == 1)
			dValuechildpack = 1;
		if (f.value == 2)
			dValuechildpack = 2;
	}

function checkgrocerypackradio(f)
	{
		if (f.value == 1)
			dValuegrocerypack = 1;
		if (f.value == 2)
			dValuegrocerypack = 2;
	}

function checkmidstaycleanradio(f)
	{
		if (f.value == 1)
			dValuemidstayclean = 1;
		if (f.value == 2)
			dValuemidstayclean = 2;
	}

function checkpcwithinternetradio(f)
	{
		if (f.value == 1)
			dValuepcwithinternet = 1;  //Service high risk. So make it NOT not available!!!
		if (f.value == 2)
			dValuepcwithinternet = 2;
	}
	


function checkfaxOrderform(f) {
	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

   if(document.frmfaxOrder.name.value == ""){alert("Form not ready - Please type your Full Name.");return false;}
// if(document.frmfaxOrder.email.value == ""){alert("Form not ready - Please type your E-mail address.");return false;}
 // if(document.frmfaxOrder.lname.value == ""){alert("Form not ready - Please type your Last name.");return false;}
	if(document.frmfaxOrder.address.value == ""){alert("Form not ready - Please type your full Address including street, city & zipcode.");return false;}
// if(document.frmfaxOrder.city.value == ""){alert("Form not ready - Please type name of your City/Town.");return false;}
//	if(document.frmfaxOrder.postcode.value == ""){alert("Form not ready - Please type your Zip/PostCode.");return false;}
	if(document.frmfaxOrder.country.value == ""){alert("Form not ready - Please type/select Country.");return false;}
   	if(document.frmfaxOrder.phone.value == ""){alert("Form not ready - Please type your Contact Phone number.");return false;}
	if(document.frmfaxOrder.fax.value == ""){alert("Form not ready - Please type your Fax number.");return false;}
// if(document.frmfaxOrder.country.value == "US") if(document.frmfaxOrder.state.value == ""){alert("Form not ready - Please Enter your State.");return false;}
   
   if(document.frmfaxOrder.arrMonth.value == ""){alert("Form not ready - Please select Arrival Month.");return false;}
   var dm = daysmonth(document.frmfaxOrder.arrMonth.value,document.frmfaxOrder.arrYear.value)
	if (document.frmfaxOrder.arrDay.value > dm) {alert("Form not ready - Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmfaxOrder.arrDay.value == ""){alert("Form not ready - Please select Arrival Date.");return false;}
   if(document.frmfaxOrder.arrYear.value == ""){alert("Form not ready - Please select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmfaxOrder.arrYear.value,document.frmfaxOrder.arrMonth.value-1,document.frmfaxOrder.arrDay.value);
	
	if (userDate.getTime() < nowDate.getTime() || document.frmfaxOrder.arrDay.value > dm)  
			{alert("Form not ready - Invalid Date, Month and/or Year - Please re-select.");return false;}
	
   if(document.frmfaxOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	   
// Check amount for arrival date
   if(document.frmfaxOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amount1 = checkfaxOrderform2(document.frmfaxOrder.arrMonth.value,document.frmfaxOrder.arrDay.value)
   else
 	 var amount1 = checkfaxOrderform3(document.frmfaxOrder.arrMonth.value,document.frmfaxOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmfaxOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmfaxOrder.arrYear.value,document.frmfaxOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
   if(document.frmfaxOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountMidWk1 = checkfaxOrderform2(MidWk1Datemonth,MidWk1daym)
   else
 	 var amountMidWk1 = checkfaxOrderform3(MidWk1Datemonth,MidWk1daym)
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmfaxOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmfaxOrder.arrYear.value,document.frmfaxOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
   if(document.frmfaxOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountStartwk2 = checkfaxOrderform2(Startwk2Datemonth,Startwk2daym)
   else
 	 var amountStartwk2 = checkfaxOrderform3(Startwk2Datemonth,Startwk2daym)
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmfaxOrder.arrDay.value)
	 NoNights    = eval(document.frmfaxOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmfaxOrder.arrYear.value,document.frmfaxOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
   if(document.frmfaxOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountendDay = checkfaxOrderform2(deptDatemonth,deptdaym)
   else
 	   var amountendDay = checkfaxOrderform3(deptDatemonth,deptdaym)
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmfaxOrder.nights.value);      // n = the number of nights input
				
	  var totaldisc;
	  if(document.frmfaxOrder.country.value == "UK")  // Need to check if US price or UK price to use!!!!
		 totaldisc= (0.0*0.14285714*n*0.66667);   // Calculate/Remove discount at 50x0.1427 per night????
	  else
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
	  if(document.frmfaxOrder.country.value == "UK")  // Need to check if US price or UK price to use!!!!
		 dposit = 100 ;   // If UK, deposit is £100
	  else
     	 dposit= 150;   // Others, deposit is 150
     	
 // checkfaxorderradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to either pay deposit or total cost.");return false;}
     
     if(document.frmfaxOrder.cardnumber.value == ""){alert("Type your Card number. Alternatively print form and enter Number by hand.");return false;}
     if(document.frmfaxOrder.cardtype.value == ""){alert("Select type of Credit Card.");return false;}
     if(document.frmfaxOrder.cardexpMonth.value == ""){alert("Select Card expiration Month.");return false;}
     if(document.frmfaxOrder.cardexpYear.value == ""){alert("Select Card expiration Year.");return false;}
     
 //Next check if booking is wihin 14days of arrival and prompt for full payment 
  	 var  Datediff = (userDate - nowDate)/(24*60*60*1000);
      
	//  alert(Datediff);
	   
	   if(dValue=="1") 
			{
				if (Datediff<=14)
					{alert("You arrive in "+Datediff+" days. Please select to pay total cost and proceed - full payment required if arriving within 14-days of this booking");return false;}
			}
   

     var whatopay;     // v = determines whether deposit or total pay chosen
    
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ; 
                  
       if(document.frmfaxOrder.country.value == "UK")  //   
         document.frmfaxOrder.txtAnswer1.value =  "£"+dposit ;  //whatopay ; 
       else 
        document.frmfaxOrder.txtAnswer1.value =  "$"+dposit ;  //whatopay ;

       if(document.frmfaxOrder.country.value == "UK")  //   
         document.frmfaxOrder.txtAnswer2.value =  "£"+grandtotal ;  //whatopay ; 
       else 
        document.frmfaxOrder.txtAnswer2.value =  "$"+grandtotal ;  //whatopay ;
   
     alert("Form is ready, please continue with the print - thank you!");
    
}

function checkfaxorderradio(f)
	{
	

		if (f.value == 1)
			dValue = 1;
		if (f.value == 2)
			dValue = 2;
	}


	

function checkfaxOrderform2(m,d)
{
 
  if (m==1) if (d <=3)return 693 ; 
  if (m==1) if (d >3) return 490 ;
  if (m==2) return 553 ; 
  if (m==3) return 623 ; 
  if (m==4) if (d <=25)return 693 ; 
  if (m==4) if (d >25) return 623 ;
  if (m==5) return 623 ; 
  if (m==6) return 623 ; 
  if (m==7) return 693 ; 
  if (m==8) return 693 ; 
  if (m==9) return 553 ; 
  if (m==10) if (d <=15)return 553 ; 
  if (m==10) if (d >15) return 623 ;
  if (m==11) if (d <=2)return 623 ; 
  if (m==11) if (d >2) return 490 ;
  if (m==12) if (d <=18)return 490 ; 
  if (m==12) if (d >18) return 693 ; 
}

function checkfaxOrderform3(m,d)
{
 
  if (m==1) if (d <=3)return 1015 ; 
  if (m==1) if (d >3) return 735 ;
  if (m==2) return 805 ; 
  if (m==3) return 905 ; 
  if (m==4) if (d <=25)return 1015 ; 
  if (m==4) if (d >25) return 905 ;
  if (m==5) return 905 ; 
  if (m==6) return 905 ; 
  if (m==7) return 1015 ; 
  if (m==8) return 1015 ; 
  if (m==9) return 805 ; 
  if (m==10) if (d <=15)return 805 ; 
  if (m==10) if (d >15) return 905 ;
  if (m==11) if (d <=2)return 905 ; 
  if (m==11) if (d >2) return 735 ;
  if (m==12) if (d <=18)return 735 ; 
  if (m==12) if (d >18) return 1015 ;
}


 function checkmailOrderform(f) {
	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

   if(document.frmmailOrder.name.value == ""){alert("Form not ready - Please type your Full Name.");return false;}
// if(document.frmmailOrder.email.value == ""){alert("Form not ready - Please type your E-mail address.");return false;}
 // if(document.frmmailOrder.lname.value == ""){alert("Form not ready - Please type your Last name.");return false;}
	if(document.frmmailOrder.address.value == ""){alert("Form not ready - Please type your full Address including street, city & zipcode.");return false;}
// if(document.frmmailOrder.city.value == ""){alert("Form not ready - Please type name of your City/Town.");return false;}
//	if(document.frmmailOrder.postcode.value == ""){alert("Form not ready - Please type your Zip/PostCode.");return false;}
	if(document.frmmailOrder.country.value == ""){alert("Form not ready - Please type/select Country.");return false;}
   	if(document.frmmailOrder.phone.value == ""){alert("Form not ready - Please type your Contact Phone number.");return false;}
	if(document.frmmailOrder.fax.value == ""){alert("Form not ready - Please type your Fax number.");return false;}
// if(document.frmmailOrder.country.value == "US") if(document.frmmailOrder.state.value == ""){alert("Enter your State.");return false;}
   
   if(document.frmmailOrder.arrMonth.value == ""){alert("Form not ready - Please select Arrival Month.");return false;}
   var dm = daysmonth(document.frmmailOrder.arrMonth.value,document.frmmailOrder.arrYear.value)
	if (document.frmmailOrder.arrDay.value > dm) {alert("Form not ready - Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmmailOrder.arrDay.value == ""){alert("Form not ready - Please select Arrival Date.");return false;}
   if(document.frmmailOrder.arrYear.value == "" ){alert("Form not ready - Please select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmmailOrder.arrYear.value,document.frmmailOrder.arrMonth.value-1,document.frmmailOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmmailOrder.arrDay.value > dm)  
			{alert("Form not ready - Invalid Date, Month and/or Year - Please re-select.");return false;}
	
     if(document.frmmailOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	   
 // Check amount for arrival date
   if(document.frmmailOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amount1 =checkmailOrderform2(document.frmmailOrder.arrMonth.value,document.frmmailOrder.arrDay.value)
   else
 	 var amount1 =checkmailOrderform3(document.frmmailOrder.arrMonth.value,document.frmmailOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmmailOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmmailOrder.arrYear.value,document.frmmailOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
   if(document.frmmailOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountMidWk1 =checkmailOrderform2(MidWk1Datemonth,MidWk1daym)
   else
 	 var amountMidWk1 =checkmailOrderform3(MidWk1Datemonth,MidWk1daym)
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmmailOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmmailOrder.arrYear.value,document.frmmailOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
   if(document.frmmailOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountStartwk2 =checkmailOrderform2(Startwk2Datemonth,Startwk2daym)
   else
 	 var amountStartwk2 =checkmailOrderform3(Startwk2Datemonth,Startwk2daym)
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmmailOrder.arrDay.value)
	 NoNights    = eval(document.frmmailOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmmailOrder.arrYear.value,document.frmmailOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
   if(document.frmmailOrder.country.value == "UK")    // Need to check if US price or UK price to use!!!!
       var amountendDay =checkmailOrderform2(deptDatemonth,deptdaym)
   else
 	   var amountendDay =checkmailOrderform3(deptDatemonth,deptdaym)
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmmailOrder.nights.value);      // n = the number of nights input
     
				
	  var totaldisc;
	  if(document.frmmailOrder.country.value == "UK")  // Need to check if US price or UK price to use!!!!
		 totaldisc= (0.0*0.14285714*n*0.66667);   // Calculate/Remove discount at 50x0.1427 per night????
	  else
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=Math.round(100*(1.12*totalbtx))/100;  
		                // Grand total =  Totals minus discount plus tax 
         grandtotal= OKStrOfMN(grandtotal, 2, 2); 
         
      var dposit  
	  if(document.frmmailOrder.country.value == "UK")  // Need to check if US price or UK price to use!!!!
		 dposit = 100 ;   // If UK, deposit is £100
	  else
     	 dposit= 150;   // Others, deposit is 150
     	
 // checkfaxorderradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to either pay deposit or total cost.");return false;}
     
 //Next check if booking is wihin 14days of arrival and prompt for full payment 
  	 var  Datediff = (userDate - nowDate)/(24*60*60*1000);
      
	//  alert(Datediff);
	   
	   if(dValue=="1") 
			{
				if (Datediff<=14)
					{alert("You arrive in "+Datediff+" days. Please select to pay total cost and proceed - full payment required if arriving within 14-days of this booking");return false;}
			}
   

     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
	  else if(dValue=="2") 
        whatopay = grandtotal ; 
                  
       if(document.frmmailOrder.country.value == "UK")  //   
         document.frmmailOrder.txtAnswer1.value =  "£"+dposit ;  //whatopay ; 
       else 
        document.frmmailOrder.txtAnswer1.value =  "$"+dposit ;  //whatopay ;

       if(document.frmmailOrder.country.value == "UK")  //   
         document.frmmailOrder.txtAnswer2.value =  "£"+grandtotal ;  //whatopay ; 
       else 
        document.frmmailOrder.txtAnswer2.value =  "$"+grandtotal ;  //whatopay ;
        
     alert("Form is ready, please continue with the print - thank you!");
   
   
}

function checkfaxorderradio(f)
	{
	

		if (f.value == 1)
			dValue = 1;
		if (f.value == 2)
			dValue = 2;
	}


	

function checkmailOrderform2(m,d)
{
 
  if (m==1) if (d <=3)return 693 ; 
  if (m==1) if (d >3) return 490 ;
  if (m==2) return 553 ; 
  if (m==3) return 623 ; 
  if (m==4) if (d <=25)return 693 ; 
  if (m==4) if (d >25) return 623 ;
  if (m==5) return 623 ; 
  if (m==6) return 623 ; 
  if (m==7) return 693 ; 
  if (m==8) return 693 ; 
  if (m==9) return 553 ; 
  if (m==10) if (d <=15)return 553 ; 
  if (m==10) if (d >15) return 623 ;
  if (m==11) if (d <=2)return 623 ; 
  if (m==11) if (d >2) return 490 ;
  if (m==12) if (d <=18)return 490 ; 
  if (m==12) if (d >18) return 693 ; 
}

function checkmailOrderform3(m,d)
{
 
  if (m==1) if (d <=3)return 1015 ; 
  if (m==1) if (d >3) return 735 ;
  if (m==2) return 805 ; 
  if (m==3) return 905 ; 
  if (m==4) if (d <=25)return 1015 ; 
  if (m==4) if (d >25) return 905 ;
  if (m==5) return 905 ; 
  if (m==6) return 905 ; 
  if (m==7) return 1015 ; 
  if (m==8) return 1015 ; 
  if (m==9) return 805 ; 
  if (m==10) if (d <=15)return 805 ; 
  if (m==10) if (d >15) return 905 ;
  if (m==11) if (d <=2)return 905 ; 
  if (m==11) if (d >2) return 735 ;
  if (m==12) if (d <=18)return 735 ; 
  if (m==12) if (d >18) return 1015 ;
}


function checkdatausdpst(f) {
//check costdata in $USD	
	
 //   var thedate=new Date()
 //	  var thisdate=thedate.getDate()
 // 	var thismonth=thedate.getMonth()+1
 //	  var thisyear=thedate.getYear()
 // 	var thistime=thedate.getTime()

//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
 
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}
   
   var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
    
   if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	
   
// Check amount for arrival date
     var amount1 = checkdata3(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value)
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountMidWk1 = checkdata3(MidWk1Datemonth,MidWk1daym) ;
 	 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountStartwk2 = checkdata3(Startwk2Datemonth,Startwk2daym);
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
 	   var amountendDay = checkdata3(deptDatemonth,deptdaym) ;
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
     
				
	  var totaldisc;
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=100 ;  	 // Grand total =  Just to take deposit only 

      var dposit  
     	 dposit= 100;   // Others, deposit is $100
     	  
        document.frmOrder.txttotalcost.value = "$"+grandtotal ; 
        
        document.frmOrder.txtpaydeposit.value =  "$"+dposit ;  //whatopay ;

  //      document.frmOrder.txtpaytotal.value =  "$"+grandtotal ;  //whatopay ;

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
     if (dValue == "0") {alert("Please select to pay deposit and proceed to secure server for details.");return false;}
     
       var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;
      
     var balanceleft = 0 ;    
    
 
      //Unique Order ID
	  
       var nowTime = new Date()
   		var date=nowTime.getDate()
		var month=nowTime.getMonth()+1
		var year=nowTime.getYear()
		var time=nowTime.getTime()
	
     
      var ad = document.frmOrder.arrDay.value;
      var am = document.frmOrder.arrMonth.value;
      var ay = document.frmOrder.arrYear.value - 2000;
      var nts = document.frmOrder.nights.value;
      var yn  = year - 2000 ; 

 
  //setup to announce/describe the planned arrival arriveday(eg sat), arrivedate, arrivemonth and arriveyear in receipt
  var thearrivedate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value);  
  var thearriveyear=thearrivedate.getYear()
  if (thearriveyear < 1000) thearriveyear+=1900
  var thearriveday=thearrivedate.getDay()
  var thearrivemonth=thearrivedate.getMonth()
  var daymarrive=thearrivedate.getDate()
  if (daymarrive<10) daymarrive="0"+daymarrive
  var thearrivedayarray=new Array("Sun","Mon","Tues","Wed","Thu","Fri","Sat");
  var thearrivemontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var keyday = thearrivedayarray[thearriveday] ;
  var keymonth = thearrivemontharray[thearrivemonth]
  
		
//setupfuture payamount to be paid 14-days BUT ALLOW 12-DAYS just incase before arrival if total is not paid now
  var futurepaydate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value-12);   
   var futurepayyear=futurepaydate.getYear()
   if (futurepayyear < 1000) futurepayyear+=1900
   var futurepayday=futurepaydate.getDay()
   var futurepaymonth=futurepaydate.getMonth()+1
   var daym=futurepaydate.getDate()
//workout month name
  var futurepaymontharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var fbalmonth = futurepaymontharray[futurepaymonth-1]

 var fbaldate =(fbalmonth+daym+","+futurepayyear); 
// alert (fbaldate) ;

//submission of cartID and other variables and data to Paypal  
 
   document.submitform.item_number.value=("Ref#: D"+ad+"H"+am+"0"+ay+"C"+nts+"-"+date+month+"0"+yn);
   document.submitform.amount.value=whatopay;
  
   if(dValue=="1")
   document.submitform.item_name.value=("Deposit Villa Resrv  Thank you!");

//   alert("Proceeding to secured site for payment details. Press OK")
   
 }


function checkcostdatausdpst(f) {
// costdata in currency $USD 
//	if(document.frmOrder.country.value == ""){alert("Enter Country.");return false;}
   if(document.frmOrder.arrMonth.value == ""){alert("Select Arrival Month.");return false;}
   var dm = daysmonth(document.frmOrder.arrMonth.value,document.frmOrder.arrYear.value)
	if (document.frmOrder.arrDay.value > dm) {alert("Invalid Date for month entered!");return false;} 
	                                                          //alert("Number of days in month exceeded");
   if(document.frmOrder.arrDay.value == ""){alert("Select Arrival Date.");return false;}
   if(document.frmOrder.arrYear.value == "" ){alert("Select Arrival Year.");return false;}

  var nowTime = new Date()
   var	nowDate = new Date(nowTime.getYear(),nowTime.getMonth(),nowTime.getDate())
   var userDate = new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,document.frmOrder.arrDay.value)
	
	if (userDate.getTime() < nowDate.getTime() || document.frmOrder.arrDay.value > dm)  
			{alert("Invalid Date, Month and/or Year - Please re-select.");return false;}
	
	if(document.frmOrder.nights.value == "" ){alert("Select number of Nights for your stay.");return false;}
	   
// Check amount for arrival date
 	 var amount1 = checkdata3(document.frmOrder.arrMonth.value,document.frmOrder.arrDay.value) ;
	 	
//1st week should Day1 and Day5...midweek
// Check when depart date is .&check if stay price straddles between seasons 
// and Find Departure calendar Date....works out even if it straddles to new month  
	 ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Midwk1  = (4+ArrivalDate)
    var MidWk1Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Midwk1);     
    var MidWk1Dateyear=MidWk1Date.getYear()
    if (MidWk1Dateyear < 1000)MidWk1Dateyear+=1900
     var MidWk1day=MidWk1Date.getDay()
     var MidWk1Datemonth=MidWk1Date.getMonth()+1
     var MidWk1daym=MidWk1Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountMidWk1 = checkdata3(MidWk1Datemonth,MidWk1daym) ;
 	 
//Now compare and chose the higher	
	if (amount1 < amountMidWk1)
	   amountwk1 = amountMidWk1 
	else
	   amountwk1 = amount1

//2nd and higher week use Day8 and 1-day before departure 
// Check when depart date is .&check if stay price straddles between seasons 
// Find price for start of week2   
//	ArrivalDate = eval(document.frmOrder.arrDay.value)
	 Startwk2  = (7+ArrivalDate)
    var Startwk2Date=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1, Startwk2);     
    var Startwk2Dateyear=Startwk2Date.getYear()
    if (Startwk2Dateyear < 1000)Startwk2Dateyear+=1900
     var Startwk2day=Startwk2Date.getDay()
     var Startwk2Datemonth=Startwk2Date.getMonth()+1
     var Startwk2daym=Startwk2Date.getDate()
// Then Check price amount and pick higher  	
 	 var amountStartwk2 = checkdata3(Startwk2Datemonth,Startwk2daym) ;
 	 
 	  
 // Check when depart date is .&check if stay price straddles between seasons 
// Dow check depart date Find Departure calendar Date....works out even if it straddles to new month  
//  ArrivalDate = eval(document.frmOrder.arrDay.value)
	 NoNights    = eval(document.frmOrder.nights.value)
	 WhenDepart  = (NoNights+ArrivalDate)   
// Give allowance and Use 1 days before departure to check new price on departure date....
     WhenDepart = (WhenDepart - 1)
//  Now Find Calendar for 1 days before departure
   var deptDate=new Date(document.frmOrder.arrYear.value,document.frmOrder.arrMonth.value-1,WhenDepart);     
    var deptDateyear=deptDate.getYear()
    if (deptDateyear < 1000)deptDateyear+=1900
     var deptday=deptDate.getDay()
     var deptDatemonth=deptDate.getMonth()+1
     var deptdaym=deptDate.getDate()

// Then Check price amount for 1-day or midweek before departure date 	
 	   var amountendDay = checkdata3(deptDatemonth,deptdaym) ;
 	 
//Now compare and chose the higher	
	if (amountStartwk2 < amountendDay)
	   amountlast = amountendDay 
	else
	   amountlast = amountStartwk2
	    	 
//Week1 Amount 
   var vWK1;
		 vWK1 =eval( amountwk1 );   // amount for first week

//Amount for remaing weeks
   var vWKRm;
		 vWKRm =eval( amountlast );   // amount for first week
   var nDaysRm ;
      nDaysRm = ( NoNights - 7) ;
	  var totalvDaysRm;
		 totalvDaysRm=(vWKRm*0.14285714*nDaysRm); //Total cost = number of nights X seanonal daily rate (weekly divided into 7)
		 totalvDaysRm= OKStrOfMN(totalvDaysRm, 2, 2);  // Round off value to 2 decimal places
     
//Sum the two together
	var totalv ; 
	    totalv = Math.round(100*(vWK1*1.0+totalvDaysRm*1.0))/100;
	    totalv =OKStrOfMN(totalv, 2, 2);
   
 	 
   	  var n;
   	    n=eval(document.frmOrder.nights.value);      // n = the number of nights input
	  		
	  var totaldisc;
     	 totaldisc= (0.0*0.14285714*n);   // Calculate/Remove discount at 50x0.1427 per night????
	  
	    totaldisc=OKStrOfMN(totaldisc, 2, 2);
	    
	    	 
	  var totalbtx;
		  totalbtx=Math.round(100*(totalv-totaldisc))/100;
				// Totals after Discount, but before Tax 
	     totalbtx= OKStrOfMN(totalbtx, 2, 2);  // Round off value to 2 decimal places
              
	  var fltax1;
         fltax1  = 0.12*totalv ;   // Calculate FL Tourist Tax if No discount
         fltax1 = OKStrOfMN(fltax1, 2, 2);  // Round off value to 2 decimal places
      
  
	  var fltax;
         fltax  = 0.12*totalbtx ;   // Calculate final FL Tourist Tax after discount applied
         fltax = OKStrOfMN(fltax, 2, 2);  // Round off value to 2 decimal places
      
   
	  var totalb4d;
		 totalb4d = 1.12*totalv;	//  Totals with tax before discount 
        totalb4d = OKStrOfMN(totalb4d, 2, 2);  // Round off value to 2 decimal places
        
     var grandtotal;
		  grandtotal=100 ;    // Grand total =  Just deposit only

         
      var dposit  
     	 dposit= 100;   // Others, deposit is $150
     	 
    
       document.frmOrder.txttotalcost.value = "$"+grandtotal ; 
                      
        document.frmOrder.txtpaydeposit.value =  "$"+dposit ;  //whatopay ;

 //       document.frmOrder.txtpaytotal.value =  "$"+grandtotal ;  //whatopay ;

   // checkradio(f)  customer to indicate what (s)he wants to do now through radio global variable
   // a must to proceed or not a must if just checking cost.
   //  if (dValue == "0") {alert("Please select to either pay deposit or total cost and proceed.");return false;}
     
     var whatopay;     // v = determines whether deposit or total pay chosen
    
     if(dValue=="1")
       whatopay = dposit ;

        
     var nts = document.frmOrder.nights.value ;   
//   alert("Rate based on your arrival details--> An Executive Delithome sleeps 2-10 persons!");	   
     alert("Reservation Deposit for "+nts+"nights --> in an Executive Delithome --> Sleeps 2-10 persons!");	
}


