function priceIt(){
	document.resform.checkin.value=document.resform.check_in_date.value; 
var checkin=document.resform.checkin.value

document.resform.checkout.value=document.resform.check_out_date.value;
var checkout=document.resform.checkout.value

var indate=new Date(checkin);
indate=indate.getTime();

var outdate=new Date(checkout);
outdate=outdate.getTime();

var stay=Math.round((outdate - indate)/86400000)
document.resform.stay.value=stay

var today=new Date();
var present=today.getTime();
var twodayslater =new Date(present+172800000);

twodayslater=twodayslater.getTime();

if ((outdate<indate) || (outdate==indate)){alert("Your check-out date must be at least 1 day later than your check-in date"); return false}
if (indate<present){
alert("Your check-in date has already passed or is not valid for an online booking."); return false;}

var meal
var mealplan=new Array('No Meal Plan','2 Meal Plan','3 Meal Plan')
var theplan
for (var i=0; i<document.resform.mealplan.length; i++)
{
if(document.resform.mealplan[i].checked==true){meal=document.resform.mealplan[i].value; theplan=mealplan[i]; document.resform.theplan.value=theplan;}
}

var rooms=document.resform.rooms.options[document.resform.rooms.selectedIndex].value

var guests=document.resform.guests.options[document.resform.guests.selectedIndex].value

var therate;
var theindate= new Date(checkin)
var the_inmonth=theindate.getMonth()
var theinday=theindate.getDate()

var theoutdate= new Date(checkout)
var the_outmonth=theoutdate.getMonth()
var theoutday=theoutdate.getDate()

if((the_inmonth==11)&&(theinday>14) || (the_inmonth==0)|| (the_inmonth==1)|| (the_inmonth==2) || (the_inmonth==3)&&(theinday<16) ||(the_outmonth==11)&&(theoutday>14) || (the_outmonth==0)|| (the_outmonth==1)|| (the_outmonth==2) || (the_outmonth==3)&&(theoutday<16)){therate=85;}
else {therate=65;}

var meals=Math.round(meal*guests*stay)
var rate=Math.round(therate*rooms)
var subtotal=Math.round(rate*stay)
var charges=Math.round(.1*subtotal)
var total=Math.round(subtotal+meals+charges)
document.resform.meals2.value=meals
document.resform.rate2.value=subtotal
document.resform.charges2.value=charges
document.resform.total2.value=total



if (document.all){
document.all.rate.innerHTML="$"+stay*rate;}
else if (document.getElementById){
document.getElementById("rate").innerHTML="$"+stay*rate;}

if (document.all){
document.all.meals.innerHTML="$"+meals;}
else if (document.getElementById){
document.getElementById("meals").innerHTML="$"+meals;}

if (document.all){
document.all.charges.innerHTML="$"+charges;}
else if (document.getElementById){
document.getElementById("charges").innerHTML="$"+charges;}

if (document.all){
document.all.total.innerHTML="$"+total;}
else if (document.getElementById){
document.getElementById("total").innerHTML="$"+total;}

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")


var date=new Date(checkin);
var day=date.getDay()
day=dayarray[day];
var month=date.getMonth()
month=montharray[month];
var numday=date.getDate()
var year=date.getUTCFullYear()
fulldate=day+", "+month+" "+numday+", "+year
document.resform.checkin.value=fulldate

var odate=new Date(checkout);
var oday=odate.getDay()
oday=dayarray[oday];
var omonth=odate.getMonth()
omonth=montharray[omonth];
var onumday=odate.getDate()
var oyear=odate.getUTCFullYear()
ofulldate=oday+", "+omonth+" "+onumday+", "+oyear
document.resform.checkout.value=ofulldate

}

function checkForm(){

document.resform.checkin.value=document.resform.todaydate.value; 
var checkin=document.resform.checkin.value

document.resform.checkout.value=document.resform.orderdate.value;
var checkout=document.resform.checkout.value

var indate=new Date(checkin);
indate=indate.getTime();

var outdate=new Date(checkout);
outdate=outdate.getTime();

var stay=Math.round((outdate - indate)/86400000)
document.resform.stay.value=stay

var today=new Date();
var present=today.getTime();
var twodayslater =new Date(present+172800000);

twodayslater=twodayslater.getTime();

if ((outdate<indate) || (outdate==indate)){alert("Your check-out date must be at least 1 day later than your check-in date"); return false}
if (indate<present){
alert("Your check-in date has already passed or is not valid for an online booking."); return false;}

var meal
var mealplan=new Array('No Meal Plan','2 Meal Plan','3 Meal Plan')
var theplan
for (var i=0; i<document.resform.mealplan.length; i++)
{
if(document.resform.mealplan[i].checked==true){meal=document.resform.mealplan[i].value; theplan=mealplan[i]; document.resform.theplan.value=theplan;}
}

var rooms=document.resform.rooms.options[document.resform.rooms.selectedIndex].value

var guests=document.resform.guests.options[document.resform.guests.selectedIndex].value

var therate;
var theindate= new Date(checkin)
var the_inmonth=theindate.getMonth()
var theinday=theindate.getDate()

var theoutdate= new Date(checkout)
var the_outmonth=theoutdate.getMonth()
var theoutday=theoutdate.getDate()

if((the_inmonth==11)&&(theinday>14) || (the_inmonth==0)|| (the_inmonth==1)|| (the_inmonth==2) || (the_inmonth==3)&&(theinday<16) ||(the_outmonth==11)&&(theoutday>14) || (the_outmonth==0)|| (the_outmonth==1)|| (the_outmonth==2) || (the_outmonth==3)&&(theoutday<16)){therate=85;}
else {therate=65;}

var meals=Math.round(meal*guests*stay)
var rate=Math.round(therate*rooms)
var subtotal=Math.round(rate*stay)
var charges=Math.round(.1*subtotal)
var total=Math.round(subtotal+meals+charges)
document.resform.meals2.value=meals
document.resform.rate2.value=subtotal
document.resform.charges2.value=charges
document.resform.total2.value=total



if (document.all){
document.all.rate.innerHTML="$"+stay*rate;}
else if (document.getElementById){
document.getElementById("rate").innerHTML="$"+stay*rate;}

if (document.all){
document.all.meals.innerHTML="$"+meals;}
else if (document.getElementById){
document.getElementById("meals").innerHTML="$"+meals;}

if (document.all){
document.all.charges.innerHTML="$"+charges;}
else if (document.getElementById){
document.getElementById("charges").innerHTML="$"+charges;}

if (document.all){
document.all.total.innerHTML="$"+total;}
else if (document.getElementById){
document.getElementById("total").innerHTML="$"+total;}

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")


var date=new Date(checkin);
var day=date.getDay()
day=dayarray[day];
var month=date.getMonth()
month=montharray[month];
var numday=date.getDate()
var year=date.getUTCFullYear()
fulldate=day+", "+month+" "+numday+", "+year
document.resform.checkin.value=fulldate

var odate=new Date(checkout);
var oday=odate.getDay()
oday=dayarray[oday];
var omonth=odate.getMonth()
omonth=montharray[omonth];
var onumday=odate.getDate()
var oyear=odate.getUTCFullYear()
ofulldate=oday+", "+omonth+" "+onumday+", "+oyear
document.resform.checkout.value=ofulldate

var fname=document.resform.fname.value;
var lname=document.resform.lname.value;
var phone=document.resform.telephone.value;
var email=document.resform.email.value;

if ((fname=="")||(fname.length<2)||(fname==" ")){alert("Please enter your first name."); document.resform.fname.focus();  return false}
if ((lname=="")||(lname.length<2)||(lname==" ")){alert("Please enter your last name."); document.resform.lname.focus();  return false}
if (phone==""){alert("Please enter your contact number."); document.resform.telephone.focus();  return false}
if (phone.length<10){alert("Please enter your full contact number including 3 digit area code."); document.resform.telephone.focus();  return false}

var theat=email.indexOf("@")
var thedot=email.indexOf(".")
var aspace=email.indexOf(" ")

if (email==""){alert ("Please enter your email address for contact."); document.resform.email.focus(); return false}
else if (theat==0 || thedot==-1 || thedot==0 || thedot==email.length-1 || aspace>-1 || theat==email.length-1){alert ("Invalid Email address"); document.resform.email.focus(); return false}
else if (theat==-1){alert ("Your Email is missing an \"@\" sign"); document.resform.email.focus(); return false}


return true
}

function getRate(){
document.rates.checkin.value=document.rates.todaydate.value; 
var checkin=document.rates.checkin.value
var therate;
var theindate= new Date(checkin)
var the_inmonth=theindate.getMonth()
var theinday=theindate.getDate()

if((the_inmonth==11)&&(theinday>14) || (the_inmonth==0)|| (the_inmonth==1)|| (the_inmonth==2) || (the_inmonth==3)&&(theinday<16)){therate="Winter";}
else {therate="Summer";}
document.rates.therate.value=therate;


var indate=new Date(checkin);
indate=indate.getTime();



var today=new Date();
var present=today.getTime();
var twodayslater =new Date(present+172800000);

twodayslater=twodayslater.getTime();

if (indate<present){
alert("Your check-in date has already passed or is not valid for an online booking."); return;}

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")


var date=new Date(checkin);
var day=date.getDay()
day=dayarray[day];
var month=date.getMonth()
month=montharray[month];
var numday=date.getDate()
var year=date.getUTCFullYear()
fulldate=day+", "+month+" "+numday+", "+year
document.rates.checkin.value=fulldate

document.rates.submit()
}

function checkCForm(){
var name=document.resform.name.value;
var phone=document.resform.telephone.value;
var email=document.resform.email.value;

if ((name=="")||(name.length<2)||(name==" ")){alert("Please enter your name."); document.resform.name.focus();  return false}
if (phone==""){alert("Please enter your contact number."); document.resform.telephone.focus();  return false}
if (phone.length<10){alert("Please enter your full contact number including 3 digit area code."); document.resform.telephone.focus();  return false}

var theat=email.indexOf("@")
var thedot=email.indexOf(".")
var aspace=email.indexOf(" ")

if (email==""){alert ("Please enter your email address for contact."); document.resform.email.focus(); return false}
else if (theat==0 || thedot==-1 || thedot==0 || thedot==email.length-1 || aspace>-1 || theat==email.length-1){alert ("Invalid Email address"); document.resform.email.focus(); return false}
else if (theat==-1){alert ("Your Email is missing an \"@\" sign"); document.resform.email.focus(); return false}

	
}

function checkWForm(){
document.resform.checkin.value=document.resform.orderdate.value; 
var checkin=document.resform.checkin.value

var indate=new Date(checkin);
indate=indate.getTime();

var today=new Date();
var present=today.getTime();
var twodayslater =new Date(present+172800000);

twodayslater=twodayslater.getTime();

if (indate<twodayslater){
alert("Your wedding date must be at least 3 days from now. Please call from US 1-877-7MONTEGO, or from Jamaica 1-876-953-7459 to discuss rush options."); return false;}
	
var name=document.resform.name.value;
var phone=document.resform.telephone.value;
var email=document.resform.email.value;

if ((name=="")||(name.length<2)||(name==" ")){alert("Please enter your name."); document.resform.name.focus();  return false}
if (phone==""){alert("Please enter your contact number."); document.resform.telephone.focus();  return false}
if (phone.length<10){alert("Please enter your full contact number including 3 digit area code."); document.resform.telephone.focus();  return false}

var theat=email.indexOf("@")
var thedot=email.indexOf(".")
var aspace=email.indexOf(" ")

if (email==""){alert ("Please enter your email address for contact."); document.resform.email.focus(); return false}
else if (theat==0 || thedot==-1 || thedot==0 || thedot==email.length-1 || aspace>-1 || theat==email.length-1){alert ("Invalid Email address"); document.resform.email.focus(); return false}
else if (theat==-1){alert ("Your Email is missing an \"@\" sign"); document.resform.email.focus(); return false}

	
}

function bookIt(){ 
			var expyear=document.resform.expyear1.options[document.resform.expyear1.selectedIndex].text;
			expyear=expyear.substring(2);
			document.resform.expyear.value=expyear;
			//alert (expyear);
			}