// JavaScript Document

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
	} // Ends the "getSelectedRadio" function
	


function makevisible(){
	if(falert==false){	
	
	document.getElementById('FormSection1').style.visibility = 'visible';
	
	//if(loc3plus==false){
	//document.getElementById('FormButton1').style.visibility="visible";	 
	//}	
	
	//}else{
	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
	//alert(falertmessage);
	}	 
	 
}

function getmtype(mastype,sel,indivangelhour){
	document.getElementById('messagetype').value = mastype;	
	document.getElementById('finalangelcost').value = sel;
	document.getElementById('indivangelhour').value = indivangelhour;
	
	
	if(mastype=='RH'){
	document.getElementById('angelmin').value = document.getElementById('angelmin1').value;
	document.getElementById('noofangel').value = document.getElementById('noofangel1').value;
	document.getElementById('nightcost').value = document.getElementById('nightcost1').value;
	document.getElementById('transport').value = document.getElementById('transport1').value;
	document.getElementById('booking').value = document.getElementById('booking1').value;
		
	ajaxpage('updatebookingytpe.php?Booking_ID='+document.getElementById('bookingid').value+'&Booking_Type=RH','bookingdiv','loadgif');
	
	}
	
	if(mastype=='HH'){
	document.getElementById('angelmin').value = document.getElementById('angelmin2').value;
	document.getElementById('noofangel').value = document.getElementById('noofangel2').value;
	document.getElementById('nightcost').value = document.getElementById('nightcost2').value;
	document.getElementById('transport').value = document.getElementById('transport2').value;
	document.getElementById('booking').value = document.getElementById('booking2').value;
		
	ajaxpage('updatebookingytpe.php?Booking_ID='+document.getElementById('bookingid').value+'&Booking_Type=HH','bookingdiv','loadgif');
	
	}
	if(mastype=='DH'){
	document.getElementById('angelmin').value = document.getElementById('angelmin3').value;
	document.getElementById('noofangel').value = document.getElementById('noofangel3').value;
	document.getElementById('nightcost').value = document.getElementById('nightcost3').value;
	document.getElementById('transport').value = document.getElementById('transport3').value;
	document.getElementById('booking').value = document.getElementById('booking3').value;
		
	ajaxpage('updatebookingytpe.php?Booking_ID='+document.getElementById('bookingid').value+'&Booking_Type=DH','bookingdiv','loadgif');
	
	}
	if(mastype=='SB'){
	document.getElementById('angelmin').value = document.getElementById('angelmin4').value;
	document.getElementById('noofangel').value = document.getElementById('noofangel4').value;
	document.getElementById('nightcost').value = document.getElementById('nightcost4').value;
	document.getElementById('transport').value = document.getElementById('transport4').value;
	document.getElementById('booking').value = document.getElementById('booking4').value;
		
	ajaxpage('updatebookingytpe.php?Booking_ID='+document.getElementById('bookingid').value+'&Booking_Type=SB','bookingdiv','loadgif');
	
	}
	
	//document.getElementById('mtype1').checked = false;	
	
}


/*
function loaddivs(){
	document.getElementById('FormSection1').innerHTML = "<div class=cost1 id=cost1></div><div class=cost2 id=cost2></div><div class=cost3 id=cost3></div><div class=cost4 id=cost4></div>";
}
*/

//------------------------------------start calculate--------------------

function calculate1(){
	
	var angelno, time, flag, peopleno, peopleno0;
	
	var FirstName, LastName, Email, AC, WP, Mobile;
	
	flag=true;
	
	falertmessage='';	
	
	//if(getSelectedRadio(document.quote.mtype)==-1){
	//flag=false;
	//}
	if(document.quote.location.options[document.quote.location.selectedIndex].value=="0"){
	falertmessage=falertmessage+'Please Select Location\n';
	flag=false;	
	}
	if(document.quote.time.options[document.quote.time.selectedIndex].value=="0"){
	falertmessage=falertmessage+'Please Select Time\n';
	flag=false;
	}
	
		if(document.quote.FirstName.value==""){
		//alert("Please enter the First Name");
		//document.quote.FirstName.focus();
		falertmessage=falertmessage+'Please enter First Name\n';
		flag=false;
		}
	
		if(document.quote.LastName.value==""){
		//alert("Please enter the Last Name");
		//document.quote.LastName.focus();
		falertmessage=falertmessage+'Please enter Last Name\n';
		flag=false;
		}
		/*
		if(document.quote.WP.value==""){
		//alert("Please enter the Work Phone");
		//document.quote.WP.focus();
		flag=false;
		}
		
		if(document.quote.AC.value==""){
		//alert("Please enter the Area Code");
		//document.quote.AC.focus();
		flag=false;
		}
		*/
		if(document.quote.Mobile.value==""){
		//alert("Please enter Mobile");
		//document.quote.Mobile.focus();
		falertmessage=falertmessage+'Please enter Mobile\n';
		flag=false;
		}
		
		if(document.quote.Email.value==""){
		//alert("Please enter the Email");
		//document.quote.Email.focus();
		falertmessage=falertmessage+'Please enter Email\n';
		flag=false;
		}		
		
		if(date1==null || date1==''){
		falertmessage=falertmessage+'Please select the date(s) would you like to have your Angel(s)\n';
		}
	
	peopleno = document.quote.peopleno.value;
	
	if(peopleno==''){
		falertmessage=falertmessage+'Please enter the number of people you will like to have massaged. It must be numeric\n';
	}		
	
	//alert(peopleno);
	peopleno0 = document.quote.peopleno.value;
	
	time = document.quote.time.value;	
	
	FirstName = document.quote.FirstName.value;
	LastName = document.quote.LastName.value;
	Email = document.quote.Email.value;
	AC = document.quote.AC.value;
	WP = document.quote.WP.value;
	Mobile = document.quote.Mobile.value;
	
	var location = document.quote.location.options[document.quote.location.selectedIndex].value;	
	/*	
	for (var i=0; i < document.quote.mtype.length; i++)
	   {
	   if (document.quote.mtype[i].checked)
		  {
		  var mtype = document.quote.mtype[i].value;
		  }
	 }
	 */
	 var mtype = "RH";
   
	 //alert(peopleno+hour+minute+ampm+mtype+location);		 
	 //alert('OK');
	 var angelmin, angelhour, angelcost, noofangel, nightcost, transport, totalcost;
	 
	 //peopleno1 = Math.round(peoplenoinitial/10)*10;
	 
	 var startpeople, noofpeopleperhour, adjustmessage, adjustmessage1, mtypedisp;
	 adjustmessage1="";
	
	if(!isNaN(peopleno) && flag==true && date1!=null && date1!=''){
	falert=false;
	/*		 
	 if(mtype=='RH'){
	 	mtypedisp = 'Regular Halo';
	 }
	 if(mtype=='HH'){
	 	mtypedisp = 'Hand Halo';
	 }
	 if(mtype=='DH'){
	 	mtypedisp = 'Double Halo';
	 }
	 if(mtype=='SB'){
	 	mtypedisp = 'Stress Buster';
	 }
	 */
	 if(mtype=='RH'){
	 	//angelmin = peopleno * 5;
		startpeople = 20;
		noofpeopleperhour = 10;	
		if(startpeople>peopleno){	
		peopleno = startpeople;
		}
		if(peopleno%10>0){
			//adjustmessage1 = " The no of people is rounded off to blocks of 10 as this is the no of people that can be messaged in an hour. So "+peopleno+" has been rounded off to "+Math.round(peopleno/10)*10;
			
			if(peopleno%10<=5){
			var pne = 5;
			}
			if(peopleno%10>5 && peopleno%10<=9){
			var pne = 10;
			}
			peopleno = Math.floor(peopleno/10)*10+pne;
			
			adjustmessage1 = " The no of people is rounded off to multiples of 10 and 5 as the no of people that can be massaged in an hour is 10 and half an hour is 5. So "+peopleno0+" has been rounded off to "+peopleno;
		
		}
		
		adjustmessage = "Minimum no of people for Regular Halo or Hand Halo is 20." + adjustmessage1;
		//angelmin = Math.round(peopleno/10)*60;
		angelmin = peopleno/10*60;		
		
	 }
	 	 	 	 
	 document.getElementById('peopleno1').value = peopleno;
	 
	 angelhour = 1/60 * angelmin;	 
	 angelcost = angelhour * angelrateperhour;
	 
	 //document.getElementById('angelmin').value = angelmin;
	 
	 if(angelhour>=4.5){
		 noofangel = angelhour / 4.5;	 
		 noofangel = Math.ceil(noofangel);		 
	 }else{
	 	noofangel = 1;
	 }
	 
	 var adj = 0;
	 var indivangelhour = angelhour/noofangel;
	 var indivdivider = Math.floor(indivangelhour);
	 		//alert(indivangelhour%indivdivider);			
	 		if(indivangelhour%indivdivider>0 && indivangelhour%indivdivider<=0.5){
			adj = 0.5;
			}
			if(indivangelhour%indivdivider>0.5 && indivangelhour%indivdivider<=0.99){
			adj = 1;
			}			
			//alert(adj);
		indivangelhour = Math.floor(indivangelhour)+adj;
		//alert(indivangelhour);
	
	angelcost = indivangelhour * angelrateperhour * noofangel;
	 
	 
	 //document.getElementById('noofangel').value = noofangel;	 

	 nightcost = 0;
	 
	 var timeportion_array, hourmin_array, hour, ampm;
	 timeportion_array = time.split(" ");
	 ampm = timeportion_array[1];
	 
	 hourmin_array = timeportion_array[0].split(":");
	 hour = hourmin_array[0];
	 minutes = hourmin_array[1];	
	 
	 //alert(hour);
	 minutesdec = Number(minutes) / 60
	 if((hour==12 || hour==1 || hour==2 || hour==3 || hour==4 || hour==5 || hour==6 || hour==7) && ampm=='AM'){	 	
		nightcost = noofangel * 33;				
	 }
	 if ( (hour==7) && (ampm=='AM') && (minutes==30) ) {
		 nightcost = 0;
	 }
	 endhour = Number(indivangelhour)+Number(hour)+Number(minutesdec);
	 if ((endhour>=12) && (ampm=='PM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((endhour>=1) && (endhour<=7) && (ampm=='AM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((hour==12) && (ampm=='PM')) {
		 nightcost = 0;
	 }	 	 
 
	 /*
	 if(ampm=='PM'){
	 	var hourend = angelmin/60;	
		var thishour = hour;	
		if(hour==12){
		thishour = 0;
		}
		//alert(angelmin);
		//alert(hourend);
		//alert(thishour/10*10+minutes/60+hourend);
		//if(thishour/10*10+minutes/60+hourend > 11.99){
		if(thishour>=10){	
		nightcost = noofangel * 30;	
		}
	 }
	 */
	 
	 
	 transport=0;
	 if(location==1 || location==2 || location==3 || location==4){
	 	transport = 33 * location * noofangel;
	 }
	 
	 //-----dates thing---------------
	 
	 //alert(date1);
	 	 
	 var where_is_mytool=date1.toString();
	 var mytool_array=where_is_mytool.split(",");
	 var tsize = mytool_array.length;
	 
	 var darray = new Array();
	 	 
	 for (var i=0; i < tsize; i++){
	 	var tmonth;
	 	var tdate = mytool_array[i];		
		var tday = tdate.substring(8,10);
				
		if(navigator.appName=="Microsoft Internet Explorer"){			
			var tyear = tdate.substring(29,33);
			if(tday>=1 && tday<=9){
			var tyear = "2"+tyear;
			}
		}else{	
		var tyear = tdate.substring(11,15);
		}
		
		var tmon = tdate.substring(4,7);		
		//alert(tday+"."+tmon+"."+tyear);
			if(tmon=="Jan"){
			tmonth = "01";
			}
			if(tmon=="Feb"){
			tmonth = "02";
			}
			if(tmon=="Mar"){
			tmonth = "03";
			}
			if(tmon=="Apr"){
			tmonth = "04";
			}
			if(tmon=="May"){
			tmonth = "05";
			}
			if(tmon=="Jun"){
			tmonth = "06";
			}
			if(tmon=="Jul"){
			tmonth = "07";
			}
			if(tmon=="Aug"){
			tmonth = "08";
			}
			if(tmon=="Sep"){
			tmonth = "09";
			}
			if(tmon=="Oct"){
			tmonth = "10";
			}
			if(tmon=="Nov"){
			tmonth = "11";
			}
			if(tmon=="Dec"){
			tmonth = "12";
			}
			var tdate1 = tday+"/"+tmonth+"/"+tyear;
			darray[i]=tdate1;
	 }
	 
	 darray.sort( dmyOrdA );
	 
	 var dbdate='';
	 for(var i=0; i < tsize; i++){
	 	dbdate = dbdate+darray[i]+',';
	 }
	 
	 document.getElementById('dbdate').value = dbdate;
	 	 
	 //alert(darray[0]);
	 
	 var darrayy=darray[0].substring(6,10);
	 var darrayd=darray[0].substring(0,2);	 
	 var darraym=darray[0].substring(3,5);
	 
	 if(darraym.substring(0,1)=='0'){
	 darraym = darraym.substring(1,2);
	 }
	 darraym=darraym-1;
	 
	 if(darrayd.substring(0,1)=='0'){
	 darrayd = darrayd.substring(1,2);
	 }
	 
	 //alert(darrayy+"/"+darrayd+"/"+darraym);
	 
	 
	 var days = 0;
	 var difference = 0;	
	 startdate = new Date(darrayy,darraym,darrayd);	
	 today = new Date();	
	 difference = startdate - today;	
	 days = Math.round(difference/(1000*60*60*24));
	 days = days+1;
	 
	 //alert(days+1);	 
	 	 
	 //-------------------------------
	 
	 totalcost = angelcost+nightcost+transport;
	 
	 var booking=0;
	 if(days<=7){
	 booking = 20/100*totalcost;
	 //totalcost = totalcost+booking;
	 }
	 /*
	 var totalcostbeforegst=totalcost;
	 var gst = 1/10*totalcost;
	 totalcost = totalcost+gst;
	 
	 totalcostdays = totalcost * tsize;
	 totalcostdays = totalcostdays.toFixed(2);
	 
	 /*
	 if(nightcost>0){
	 document.getElementById('nightcost').value = nightcost * tsize;
	 }
	 if(transport>0){
	 document.getElementById('transport').value = transport * tsize;
	 }
	 if(booking>0){
	 document.getElementById('booking').value = booking;
	 }
	 */
	   
	 //alert("Your Total Quote is AU$ "+totalcost+". \nThis is an estimated cost and subject to review from 3MA Management");
	 //document.getElementById('cost').innerHTML = adjustmessage+"<br>&nbsp;<br><table width=100% border=0 cellpadding=10 cellspacing=2><tr><td><table width=60% border=1 align=left cellpadding=10 cellspacing=2><tr><td>Angel Charge</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td>Total Cost Before GST</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td>Total per day</td><td align=right>"+totalcost.toFixed(2)+"</td></tr><tr><td>No of Days</td><td align=right>"+tsize+"</td></tr><tr><td>Grand Total</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</b></td></tr></table><br>"; 
	 
	 //-----------------changes----------------------------
	 
	 var b1,t1,n1;
	 
	 if(booking>0){
	 b1 = "<tr><td>Within 7 Days Booking Fee</td><td align=right valign=bottom>$"+booking.toFixed(2)+"</td></tr>" + 
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 b1 = "";
	 }
	 
	 if(nightcost>0){
	 n1 = "<tr><td>Late Night Fee</td><td align=right valign=bottom>$"+nightcost*tsize.toFixed(2)+"</td></tr>" +
 	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 n1 = "";
	 }
	 
	 if(transport>0){
	 t1 = "<tr><td><nobr>Travel Allowance</nobr></td><td align=right valign=bottom>$"+transport*tsize.toFixed(2)+"</td></tr>" +
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 t1 = "";
	 }
	 
	 angelcost = angelcost * tsize;
	 totalcostbeforegst = angelcost+booking+nightcost*tsize+transport*tsize;
	 gst = 1/10*totalcostbeforegst;
	 totalcostdays = totalcostbeforegst+gst;
	 
	 if(location=='m'){
	 
	 	document.getElementById('FormButton1').style.visibility="hidden";		
		loc3plus = true;
	
		document.getElementById('FormSection1').innerHTML = "<table width=80% border=0 align=center><tr><th scope=col>&nbsp;&nbsp;</th><th scope=col><font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br>Thankyou very much for your enquiry. Due to the distance our Angel(s) will need to travel to your location we will need to discuss this with you. Our team will be in touch.<br></font></th></tr></table>"; 
	 	
		ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
		
		alert('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'');
		
		var threepl = document.quote.bookingid.value;		
		
		ajaxpage('threepluslocation.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'&bookingid='+threepl+'','bookingdiv','loadgif');
	 
	}else{
	 
	 //document.getElementById('cost').innerHTML = adjustmessage+"<font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td><table width=80% border=0 align=left cellpadding=10 cellspacing=2><tr><td>"+noofangel+" Angel(s) @ $80 p/hr "+mtypedisp+"</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=right>Subtotal</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td align=right>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td align=right>TOTAL</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b><font face='Arial, Helvetica, sans-serif' color=#888 size=2>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</font></b></td></tr></table><br></font>";
	 
	 loc3plus = false;
	 
	 //document.getElementById('FormSection1').innerHTML = "<a name=C4>&nbsp;</a><h2><span>Type of Angel Massage</span></h2><table id=FieldSet1 border=0 cellpadding=0 cellspacing=0 width=98% align=center><tbody><tr><td id=FieldSetTopRow colspan=6><h3 class=style10>3</h3></td></tr><tr><td colspan=4 id=FieldArea><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for=ddWhatsItFor><span class=style47>Now that you have given us some details please choose your type of massage.</span></label><br><br></td></tr><tr><td id=FieldSetTopRow>&nbsp;</td><td id=FieldSetTopRow><span class=style10>&nbsp;&nbsp;&nbsp;Regular halo&nbsp;<a href=javascript:void(0) onmouseover=doTooltip(event,4) onmouseout=hideTip() style=text-decoration:none><img src=images/questionmark.gif border=0 /></a></span></td><td id=FieldSetTopRow><span class=style10>&nbsp;&nbsp;&nbsp;Hand Halo &nbsp;<a href=javascript:void(0) onmouseover=doTooltip(event,5) onmouseout=hideTip() style=text-decoration:none><img src=images/questionmark.gif border=0 /></a></span></td><td id=FieldSetTopRow><span class=style10>&nbsp;&nbsp;&nbsp;Double Halo&nbsp;<a href=javascript:void(0) onmouseover=doTooltip(event,6) onmouseout=hideTip() style=text-decoration:none><img src=images/questionmark.gif border=0 /></a> </span></td><td id=FieldSetTopRow><span class=style10>&nbsp;&nbsp;&nbsp;Stress Buster&nbsp;<a href=javascript:void(0) onmouseover=doTooltip(event,7) onmouseout=hideTip() style=text-decoration:none><img src=images/questionmark.gif border=0 /></a></span></td><td id=FieldSetTopRow><span class=style11></span></td></tr><tr><td id=FieldArea1 valign=top>&nbsp;</td><td id=FieldArea1 valign=top><table width=100% border=0><tr><td id=MoreInfo1><div class=cost1 id=cost1></div></td></tr></table></td><td id=FieldArea1 valign=top><table width=100% border=0><tr><td id=MoreInfo2><div class=cost2 id=cost2></div></td></tr></table></td><td id=FieldArea1 valign=top><table width=100% border=0><tr><td id=MoreInfo1><div class=cost3 id=cost3></div></td></tr></table></td><td id=FieldArea1 valign=top><table width=100% border=0><tr><td id=MoreInfo1><div class=cost4  id=cost4></div></td></tr></table></td></tr><tr></tr><tr><tr><td colspan=4 id=FieldArea><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for=ddWhatsItFor><span class=style47>For more information on our massages please <a href=javascript:void(0) onclick=mypopup();>click here</a></span></label><br><br></td></tr><td id=FieldSetBottomRow2 colspan=6>&nbsp;</td></tr></tbody></table>";
	 
	 document.getElementById('cost1').innerHTML = "<font face='lucida sans unicode' color=#333333 style='font-size:11px'>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
      n1 + "" + t1 + "" + b1 +
     "<tr><td align=left style='height: 25px;' >Subtotal</td><td align=right>$"+totalcostbeforegst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
	 "<tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr></table>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0 style='clear:both'><tr style='height:30px;' ><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 
	 
	 document.getElementById('selectype1').innerHTML = "<center>Select Regular Halo <input name=mtype1 id=mtype1 type=checkbox value=RH onclick=getmtype('RH',"+angelcost.toFixed(2)+","+indivangelhour+");SingleSelect('1');><input name=angelmin1 id=angelmin1 type=hidden value="+angelmin+" /><input name=noofangel1 id=noofangel1 type=hidden  value="+noofangel+" /><input name=nightcost1 id=nightcost1 type=hidden  value="+nightcost*tsize+" /><input name=transport1 id=transport1 type=hidden  value="+transport*tsize+" /><input name=booking1 id=booking1 type=hidden  value="+booking+" /></center>";	 
	 
	 
	 ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type=NA&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
	 
	 	 	 	 
	 }//----------end location logic
	 
	 }else{
	 	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
		falert = true;
	 }
	 
	 //alert(falertmessage);
}


	

function calculate2(){
	
	var angelno, time, flag, peopleno, peopleno0;
	
	var FirstName, LastName, Email, AC, WP, Mobile;
	
	flag=true;
	
	//if(getSelectedRadio(document.quote.mtype)==-1){
	//flag=false;
	//}
	if(document.quote.location.options[document.quote.location.selectedIndex].value=="0"){
	flag=false;
	}
	if(document.quote.time.options[document.quote.time.selectedIndex].value=="0"){
	flag=false;
	}
	
		if(document.quote.FirstName.value==""){
		//alert("Please enter the First Name");
		//document.quote.FirstName.focus();
		flag=false;
		}
	
		if(document.quote.LastName.value==""){
		//alert("Please enter the Last Name");
		//document.quote.LastName.focus();
		flag=false;
		}
		/*
		if(document.quote.WP.value==""){
		//alert("Please enter the Work Phone");
		//document.quote.WP.focus();
		flag=false;
		}
		
		if(document.quote.AC.value==""){
		//alert("Please enter the Area Code");
		//document.quote.AC.focus();
		flag=false;
		}
		*/
		if(document.quote.Mobile.value==""){
		//alert("Please enter Mobile");
		//document.quote.Mobile.focus();
		flag=false;
		}
		
		if(document.quote.Email.value==""){
		//alert("Please enter the Email");
		//document.quote.Email.focus();
		flag=false;
		}
	
	peopleno = document.quote.peopleno.value;
	peopleno0 = document.quote.peopleno.value;
	
	time = document.quote.time.value;
	
	FirstName = document.quote.FirstName.value;
	LastName = document.quote.LastName.value;
	Email = document.quote.Email.value;
	AC = document.quote.AC.value;
	WP = document.quote.WP.value;
	Mobile = document.quote.Mobile.value;
	
	var location = document.quote.location.options[document.quote.location.selectedIndex].value;	
	/*	
	for (var i=0; i < document.quote.mtype.length; i++)
	   {
	   if (document.quote.mtype[i].checked)
		  {
		  var mtype = document.quote.mtype[i].value;
		  }
	 }
	 */
	 var mtype = "HH";
   
	 //alert(peopleno+time+minute+ampm+mtype+location);		 
	 //alert('OK');
	 var angelmin, angelhour, angelcost, noofangel, nightcost, transport, totalcost;
	 
	 //peopleno1 = Math.round(peoplenoinitial/10)*10;
	 
	 var startpeople, noofpeoplepertime, adjustmessage, adjustmessage1, mtypedisp;
	 adjustmessage1="";
	
	if(!isNaN(peopleno) && flag==true && date1!=null && date1!=''){
	falert=false;
	/*		 
	 if(mtype=='RH'){
	 	mtypedisp = 'Regular Halo';
	 }
	 if(mtype=='HH'){
	 	mtypedisp = 'Hand Halo';
	 }
	 if(mtype=='DH'){
	 	mtypedisp = 'Double Halo';
	 }
	 if(mtype=='SB'){
	 	mtypedisp = 'Stress Buster';
	 }
	 */
	 if(mtype=='HH'){
	 	//angelmin = peopleno * 5;
		startpeople = 20;
		noofpeoplepertime = 10;	
		if(startpeople>peopleno){	
		peopleno = startpeople;
		}
		if(peopleno%10>0){
			//adjustmessage1 = " The no of people is rounded off to blocks of 10 as this is the no of people that can be messaged in an time. So "+peopleno+" has been rounded off to "+Math.round(peopleno/10)*10;
			
			if(peopleno%10<=5){
			var pne = 5;
			}
			if(peopleno%10>5 && peopleno%10<=9){
			var pne = 10;
			}
			peopleno = Math.floor(peopleno/10)*10+pne;
			
			adjustmessage1 = " The no of people is rounded off to multiples of 10 and 5 as the no of people that can be massaged in an time is 10 and half an time is 5. So "+peopleno0+" has been rounded off to "+peopleno;
		
		}
		
		adjustmessage = "Minimum no of people for Regular Halo or Hand Halo is 20."+adjustmessage1;
		//angelmin = Math.round(peopleno/10)*60;
		angelmin = peopleno/10*60;
	 }	 	 	 
	  
	 document.getElementById('peopleno1').value = peopleno;
	 
	 angelhour = 1/60 * angelmin;
	 angelcost = angelhour * angelrateperhour;
	 
	 //document.getElementById('angelmin').value = angelmin;
	 
	 if(angelhour>=4.5){
		 noofangel = angelhour / 4.5;	 
		 noofangel = Math.ceil(noofangel);		 
	 }else{
	 	noofangel = 1;
	 }
	 
	 var adj = 0;
	 var indivangelhour = angelhour/noofangel;
	 var indivdivider = Math.floor(indivangelhour);
	 		//alert(indivangelhour%indivdivider);			
	 		if(indivangelhour%indivdivider>0 && indivangelhour%indivdivider<=0.5){
			adj = 0.5;
			}
			if(indivangelhour%indivdivider>0.5 && indivangelhour%indivdivider<=0.99){
			adj = 1;
			}			
			//alert(adj);
		indivangelhour = Math.floor(indivangelhour)+adj;
		//alert(indivangelhour);
	
	angelcost = indivangelhour * angelrateperhour * noofangel;
	 
	 //document.getElementById('noofangel').value = noofangel;	 

	 nightcost = 0;
	 
	 var timeportion_array, hourmin_array, hour, ampm;
	 timeportion_array = time.split(" ");
	 ampm = timeportion_array[1];
	 
	 hourmin_array = timeportion_array[0].split(":");
	 hour = hourmin_array[0];
	 minutes = hourmin_array[1];
	 
	 minutesdec = Number(minutes) / 60
	 if((hour==12 || hour==1 || hour==2 || hour==3 || hour==4 || hour==5 || hour==6 || hour==7) && ampm=='AM'){	 	
		nightcost = noofangel * 33;				
	 }
	 if ( (hour==7) && (ampm=='AM') && (minutes==30) ) {
		 nightcost = 0;
	 }
	 endhour = Number(indivangelhour)+Number(hour)+Number(minutesdec);
	 if ((endhour>=12) && (ampm=='PM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((endhour>=1) && (endhour<=7) && (ampm=='AM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((hour==12) && (ampm=='PM')) {
		 nightcost = 0;
	 }	 

/*
	 if(ampm=='PM'){
	 	var hourend = angelmin/60;	
		var thishour = hour;	
		if(hour==12){
		thishour = 0;
		}
		//alert(angelmin);
		//alert(hourend);
		//alert(thishour/10*10+minutes/60+hourend);
		//if(thishour/10*10+minutes/60+hourend > 11.99){
		if(thishour>=10){
		nightcost = noofangel * 30;	
		}
	 }
*/	 
	 transport=0;
	 if(location==1 || location==2 || location==3  || location==4){
	 	transport = 33 * location * noofangel;
	 }
	 
	 //-----dates thing---------------
	 
	 //alert(date1);
	 	 
	 var where_is_mytool=date1.toString();
	 var mytool_array=where_is_mytool.split(",");
	 var tsize = mytool_array.length;
	 
	 var darray = new Array();
	 	 
	 for (var i=0; i < tsize; i++){
	 	var tmonth;
	 	var tdate = mytool_array[i];		
		var tday = tdate.substring(8,10);	
			
		if(navigator.appName=="Microsoft Internet Explorer"){			
			var tyear = tdate.substring(29,33);
			if(tday>=1 && tday<=9){
			var tyear = "2"+tyear;
			}
		}else{	
		var tyear = tdate.substring(11,15);
		}
		
		var tmon = tdate.substring(4,7);		
		//alert(tday+"."+tmon+"."+tyear);
			if(tmon=="Jan"){
			tmonth = "01";
			}
			if(tmon=="Feb"){
			tmonth = "02";
			}
			if(tmon=="Mar"){
			tmonth = "03";
			}
			if(tmon=="Apr"){
			tmonth = "04";
			}
			if(tmon=="May"){
			tmonth = "05";
			}
			if(tmon=="Jun"){
			tmonth = "06";
			}
			if(tmon=="Jul"){
			tmonth = "07";
			}
			if(tmon=="Aug"){
			tmonth = "08";
			}
			if(tmon=="Sep"){
			tmonth = "09";
			}
			if(tmon=="Oct"){
			tmonth = "10";
			}
			if(tmon=="Nov"){
			tmonth = "11";
			}
			if(tmon=="Dec"){
			tmonth = "12";
			}
			var tdate1 = tday+"/"+tmonth+"/"+tyear;
			darray[i]=tdate1;
	 }
	 
	 darray.sort( dmyOrdA );
	 
	 var dbdate='';
	 for(var i=0; i < tsize; i++){
	 	dbdate = dbdate+darray[i]+',';
	 }
	 
	 document.getElementById('dbdate').value = dbdate;
	 	 
	 //alert(darray[0]);
	 
	 var darrayy=darray[0].substring(6,10);
	 var darrayd=darray[0].substring(0,2);	 
	 var darraym=darray[0].substring(3,5);
	 
	 if(darraym.substring(0,1)=='0'){
	 darraym = darraym.substring(1,2);
	 }
	 darraym=darraym-1;
	 
	 if(darrayd.substring(0,1)=='0'){
	 darrayd = darrayd.substring(1,2);
	 }
	 
	 //alert(darrayy+"/"+darrayd+"/"+darraym);
	 
	 
	 var days = 0;
	 var difference = 0;	
	 startdate = new Date(darrayy,darraym,darrayd);	
	 today = new Date();	
	 difference = startdate - today;	
	 days = Math.round(difference/(1000*60*60*24));
	 days = days+1;
	 
	 //alert(days+1);	 
	 	 
	 //-------------------------------
	 
	 totalcost = angelcost+nightcost+transport;
	 
	 var booking=0;
	 if(days<=7){
	 booking = 20/100*totalcost;
	 //totalcost = totalcost+booking;
	 }
	 /*
	 var totalcostbeforegst=totalcost;
	 var gst = 1/10*totalcost;
	 totalcost = totalcost+gst;
	 
	 totalcostdays = totalcost * tsize;
	 totalcostdays = totalcostdays.toFixed(2);
	 /*
	 if(nightcost>0){
	 document.getElementById('nightcost').value = nightcost * tsize;
	 }
	 if(transport>0){
	 document.getElementById('transport').value = transport * tsize;
	 }
	 if(booking>0){
	 document.getElementById('booking').value = booking;
	 }
	 */
	   
	 //alert("Your Total Quote is AU$ "+totalcost+". \nThis is an estimated cost and subject to review from 3MA Management");
	 //document.getElementById('cost').innerHTML = adjustmessage+"<br>&nbsp;<br><table width=100% border=0 cellpadding=10 cellspacing=2><tr><td><table width=60% border=1 align=left cellpadding=10 cellspacing=2><tr><td>Angel Charge</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td>Total Cost Before GST</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td>Total per day</td><td align=right>"+totalcost.toFixed(2)+"</td></tr><tr><td>No of Days</td><td align=right>"+tsize+"</td></tr><tr><td>Grand Total</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</b></td></tr></table><br>"; 
	 
	 //-----------------changes----------------------------
	 
	 var b1,t1,n1;
	 
	 if(booking>0){
	 b1 = "<tr><td>Within 7 Days Booking Fee</td><td align=right valign=bottom>$"+booking.toFixed(2)+"</td></tr>" + 
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 b1 = "";
	 }
	 
	 if(nightcost>0){
	 n1 = "<tr><td>Late Night Fee</td><td align=right valign=bottom>$"+nightcost*tsize.toFixed(2)+"</td></tr>" +
 	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 n1 = "";
	 }
	 
	 if(transport>0){
	 t1 = "<tr><td><nobr>Travel Allowance</nobr></td><td align=right valign=bottom>$"+transport*tsize.toFixed(2)+"</td></tr>" +
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 t1 = "";
	 }
	 
	 angelcost = angelcost * tsize;
	 totalcostbeforegst = angelcost+booking+nightcost*tsize+transport*tsize;
	 gst = 1/10*totalcostbeforegst;
	 totalcostdays = totalcostbeforegst+gst;
	 
	 if(location=='m'){
	 
	 	document.getElementById('FormButton1').style.visibility="hidden";
		loc3plus = true;
	
		document.getElementById('FormSection1').innerHTML = "<table width=80% border=0 align=center><tr><th scope=col>&nbsp;&nbsp;</th><th scope=col><font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br>Thankyou very much for your enquiry. Due to the distance our Angel(s) will need to travel to your location we will need to discuss this with you. Our team will be in touch.<br></font></th></tr></table>"; 
	 	
		//ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
		
		//var threepl = document.quote.bookingid.value;		
		
		//ajaxpage('threepluslocation.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'&bookingid='+threepl+'','bookingdiv','loadgif');
	 
	}else{
	 
	 //document.getElementById('cost').innerHTML = adjustmessage+"<font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td><table width=80% border=0 align=left cellpadding=10 cellspacing=2><tr><td>"+noofangel+" Angel(s) @ $80 p/hr "+mtypedisp+"</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=right>Subtotal</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td align=right>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td align=right>TOTAL</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b><font face='Arial, Helvetica, sans-serif' color=#888 size=2>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</font></b></td></tr></table><br></font>";
	 
	 loc3plus = false;
	 	 
	 //document.getElementById('cost2').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#3366cc style=font-size:12px><br>&nbsp;<table width=100% border=0 align=left cellpadding=0 cellspacing=0><tr><td width=10>&nbsp;</td><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr <hr color=#FFFFFF size=1></td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr>"+n1+""+t1+""+b1+"<tr><td width=10>&nbsp;</td><td align=left>Subtotal<hr color=#FFFFFF size=1></td><td align=right>$"+totalcostbeforegst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td width=10>&nbsp;</td><td align=left>GST<hr color=#FFFFFF size=1></td><td align=right>$"+gst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td align=left bgcolor=#A3B9E8><b><font color=#000000 size=3>TOTAL</b></font></td><td align=right bgcolor=#A3B9E8><b><font color=#000000 size=3>$"+totalcostdays+"</b></font></td></tr><tr><td width=10>&nbsp;</td><td colspan=2 align=right bgcolor=#A3B9E8><input name=mtype2 id=mtype2 type=checkbox value=HH onclick=getmtype('HH',"+angelcost.toFixed(2)+");SingleSelect('2');><input name=angelmin2 id=angelmin2 type=hidden value="+angelmin+" /><input name=noofangel2 id=noofangel2 type=hidden  value="+noofangel+" /><input name=nightcost2 id=nightcost2 type=hidden  value="+nightcost*tsize+" /><input name=transport2 id=transport2 type=hidden  value="+transport*tsize+" /><input name=booking2 id=booking2 type=hidden  value="+booking+" /></td></tr></font></table>"; 	 	 
	 
	 document.getElementById('cost2').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#333333 style='font-size:11px'><table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=left style='height: 25px;'>Subtotal</td><td align=right style='height: 25px;'>$"+totalcostbeforegst.toFixed(2)+"</td></tr><tr style='height: 10px;'><td colspan=2 style='height: 10px; color:#aaaaaa' valign='top' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr><tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr><tr><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 
	 
	 document.getElementById('cost2').innerHTML = "<font face='lucida sans unicode' color=#333333 style='font-size:11px'>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
      n1 + "" + t1 + "" + b1 +
     "<tr><td align=left style='height: 25px;' >Subtotal</td><td align=right>$"+totalcostbeforegst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
	 "<tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr></table>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0 style='clear:both'><tr style='height:30px;' ><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 
	 
	 
	 document.getElementById('selectype2').innerHTML = "<center>Select Hand Halo <input name=mtype2 id=mtype2 type=checkbox value=HH onclick=getmtype('HH',"+angelcost.toFixed(2)+","+indivangelhour+");SingleSelect('2');><input name=angelmin2 id=angelmin2 type=hidden value="+angelmin+" /><input name=noofangel2 id=noofangel2 type=hidden  value="+noofangel+" /><input name=nightcost2 id=nightcost2 type=hidden  value="+nightcost*tsize+" /><input name=transport2 id=transport2 type=hidden  value="+transport*tsize+" /><input name=booking2 id=booking2 type=hidden  value="+booking+" /></center>";	 
	 
	 
	 
	 //ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');	 
	 
	 
	 }//----------end location logic
	 
	 }else{
	 	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
		falert = true;
	 }
	 
}

function calculate3(){
	
	var angelno, time, flag, peopleno, peopleno0;
	
	var FirstName, LastName, Email, AC, WP, Mobile;
	
	flag=true;
	
	//if(getSelectedRadio(document.quote.mtype)==-1){
	//flag=false;
	//}
	if(document.quote.location.options[document.quote.location.selectedIndex].value=="0"){
	flag=false;
	}
	if(document.quote.time.options[document.quote.time.selectedIndex].value=="0"){
	flag=false;
	}
	
		if(document.quote.FirstName.value==""){
		//alert("Please enter the First Name");
		//document.quote.FirstName.focus();
		flag=false;
		}
	
		if(document.quote.LastName.value==""){
		//alert("Please enter the Last Name");
		//document.quote.LastName.focus();
		flag=false;
		}
		/*
		if(document.quote.WP.value==""){
		//alert("Please enter the Work Phone");
		//document.quote.WP.focus();
		flag=false;
		}
		
		if(document.quote.AC.value==""){
		//alert("Please enter the Area Code");
		//document.quote.AC.focus();
		flag=false;
		}
		*/
		if(document.quote.Mobile.value==""){
		//alert("Please enter Mobile");
		//document.quote.Mobile.focus();
		flag=false;
		}
		
		if(document.quote.Email.value==""){
		//alert("Please enter the Email");
		//document.quote.Email.focus();
		flag=false;
		}
	
	peopleno = document.quote.peopleno.value;
	peopleno0 = document.quote.peopleno.value;
	
	time = document.quote.time.value;
	
	FirstName = document.quote.FirstName.value;
	LastName = document.quote.LastName.value;
	Email = document.quote.Email.value;
	AC = document.quote.AC.value;
	WP = document.quote.WP.value;
	Mobile = document.quote.Mobile.value;
	
	var location = document.quote.location.options[document.quote.location.selectedIndex].value;	
	/*	
	for (var i=0; i < document.quote.mtype.length; i++)
	   {
	   if (document.quote.mtype[i].checked)
		  {
		  var mtype = document.quote.mtype[i].value;
		  }
	 }
	 */
	 var mtype = "DH";
   
	 //alert(peopleno+hour+minute+ampm+mtype+location);		 
	 //alert('OK');
	 var angelmin, angelhour, angelcost, noofangel, nightcost, transport, totalcost;
	 
	 //peopleno1 = Math.round(peoplenoinitial/10)*10;
	 
	 var startpeople, noofpeopleperhour, adjustmessage, adjustmessage1, mtypedisp;
	 adjustmessage1="";
	
	if(!isNaN(peopleno) && flag==true && date1!=null && date1!=''){
	falert=false;
	/*		 
	 if(mtype=='RH'){
	 	mtypedisp = 'Regular Halo';
	 }
	 if(mtype=='HH'){
	 	mtypedisp = 'Hand Halo';
	 }
	 if(mtype=='DH'){
	 	mtypedisp = 'Double Halo';
	 }
	 if(mtype=='SB'){
	 	mtypedisp = 'Stress Buster';
	 }
	 */
	 	 
	 if(mtype=='DH'){
	 	//angelmin = peopleno * 10;	
		startpeople = 10;
		noofpeopleperhour = 5;	
		if(startpeople>peopleno){	
		peopleno = startpeople;
		}
		if(peopleno%5>0){
		
		//adjustmessage1 = " The no of people is rounded off to blocks of 5 as this is the no of people that can be messaged in an hour. So "+peopleno+" has been rounded off to "+Math.round(peopleno/5)*5;
		
			if(peopleno%10<=5){
			var pne = 5;
			}
			if(peopleno%10>5 && peopleno%10<=9){
			var pne = 10;
			}
			peopleno = Math.floor(peopleno/10)*10+pne;
			
			adjustmessage1 = " The no of people is rounded off to multiples of 5 as the no of people that can be massaged in an hour is 5. So "+peopleno0+" has been rounded off to "+peopleno;
		
		}
		adjustmessage = "Minimum no of people for Double Halo is 10."+adjustmessage1;
		//angelmin = Math.round(peopleno/5)*60;
		angelmin = peopleno/5*60;
	 }	 
	 	 
	 document.getElementById('peopleno1').value = peopleno;
	 
	 angelhour = 1/60 * angelmin;
	 angelcost = angelhour * angelrateperhour;
	 
	 //document.getElementById('angelmin').value = angelmin;
	 
	 if(angelhour>=4.5){
		 noofangel = angelhour / 4.5;	 
		 noofangel = Math.ceil(noofangel);		 
	 }else{
	 	noofangel = 1;
	 }
	 
	 var adj = 0;
	 var indivangelhour = angelhour/noofangel;
	 var indivdivider = Math.floor(indivangelhour);
	 		//alert(indivangelhour%indivdivider);			
	 		if(indivangelhour%indivdivider>0 && indivangelhour%indivdivider<=0.5){
			adj = 0.5;
			}
			if(indivangelhour%indivdivider>0.5 && indivangelhour%indivdivider<=0.99){
			adj = 1;
			}			
			//alert(adj);
		indivangelhour = Math.floor(indivangelhour)+adj;
		//alert(indivangelhour);
	
	angelcost = indivangelhour * angelrateperhour * noofangel;
	 
	 //document.getElementById('noofangel').value = noofangel;	 

	 nightcost = 0;
	 
	 var timeportion_array, hourmin_array, hour, ampm;
	 timeportion_array = time.split(" ");
	 ampm = timeportion_array[1];
	 
	 hourmin_array = timeportion_array[0].split(":");
	 hour = hourmin_array[0];
	 minutes = hourmin_array[1];
	 
	 //alert(hour);
	 
	 minutesdec = Number(minutes) / 60
	 if((hour==12 || hour==1 || hour==2 || hour==3 || hour==4 || hour==5 || hour==6 || hour==7) && ampm=='AM'){	 	
		nightcost = noofangel * 33;				
	 }
	 if ( (hour==7) && (ampm=='AM') && (minutes==30) ) {
		 nightcost = 0;
	 }
	 endhour = Number(indivangelhour)+Number(hour)+Number(minutesdec);
	 if ((endhour>=12) && (ampm=='PM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((endhour>=1) && (endhour<=7) && (ampm=='AM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((hour==12) && (ampm=='PM')) {
		 nightcost = 0;
	 }	 
	 /*
	 if(ampm=='PM'){
	 	var hourend = angelmin/60;	
		var thishour = hour;	
		if(hour==12){
		thishour = 0;
		}
		//alert(angelmin);
		//alert(hourend);
		//alert(thishour/10*10+minutes/60+hourend);
		//if(thishour/10*10+minutes/60+hourend > 11.99){
		if(thishour>=10){	
		nightcost = noofangel * 30;	
		}
	 }
	 */
	 
	 transport=0;
	 if(location==1 || location==2 || location==3  || location==4){
	 	transport = 33 * location * noofangel;
	 }
	 
	 //-----dates thing---------------
	 
	 //alert(date1);
	 	 
	 var where_is_mytool=date1.toString();
	 var mytool_array=where_is_mytool.split(",");
	 var tsize = mytool_array.length;
	 
	 var darray = new Array();
	 	 
	 for (var i=0; i < tsize; i++){
	 	var tmonth;
	 	var tdate = mytool_array[i];		
		var tday = tdate.substring(8,10);	
			
		if(navigator.appName=="Microsoft Internet Explorer"){			
			var tyear = tdate.substring(29,33);
			if(tday>=1 && tday<=9){
			var tyear = "2"+tyear;
			}
		}else{	
		var tyear = tdate.substring(11,15);
		}
		
		var tmon = tdate.substring(4,7);		
		//alert(tday+"."+tmon+"."+tyear);
			if(tmon=="Jan"){
			tmonth = "01";
			}
			if(tmon=="Feb"){
			tmonth = "02";
			}
			if(tmon=="Mar"){
			tmonth = "03";
			}
			if(tmon=="Apr"){
			tmonth = "04";
			}
			if(tmon=="May"){
			tmonth = "05";
			}
			if(tmon=="Jun"){
			tmonth = "06";
			}
			if(tmon=="Jul"){
			tmonth = "07";
			}
			if(tmon=="Aug"){
			tmonth = "08";
			}
			if(tmon=="Sep"){
			tmonth = "09";
			}
			if(tmon=="Oct"){
			tmonth = "10";
			}
			if(tmon=="Nov"){
			tmonth = "11";
			}
			if(tmon=="Dec"){
			tmonth = "12";
			}
			var tdate1 = tday+"/"+tmonth+"/"+tyear;
			darray[i]=tdate1;
	 }
	 
	 darray.sort( dmyOrdA );
	 
	 var dbdate='';
	 for(var i=0; i < tsize; i++){
	 	dbdate = dbdate+darray[i]+',';
	 }
	 
	 document.getElementById('dbdate').value = dbdate;
	 	 
	 //alert(darray[0]);
	 
	 var darrayy=darray[0].substring(6,10);
	 var darrayd=darray[0].substring(0,2);	 
	 var darraym=darray[0].substring(3,5);
	 
	 if(darraym.substring(0,1)=='0'){
	 darraym = darraym.substring(1,2);
	 }
	 darraym=darraym-1;
	 
	 if(darrayd.substring(0,1)=='0'){
	 darrayd = darrayd.substring(1,2);
	 }
	 
	 //alert(darrayy+"/"+darrayd+"/"+darraym);
	 
	 
	 var days = 0;
	 var difference = 0;	
	 startdate = new Date(darrayy,darraym,darrayd);	
	 today = new Date();	
	 difference = startdate - today;	
	 days = Math.round(difference/(1000*60*60*24));
	 days = days+1;
	 
	 //alert(days+1);	 
	 	 
	 //-------------------------------
	 
	 totalcost = angelcost+nightcost+transport;
	 
	 var booking=0;
	 if(days<=7){
	 booking = 20/100*totalcost;
	 //totalcost = totalcost+booking;
	 }
	 /*
	 var totalcostbeforegst=totalcost;
	 var gst = 1/10*totalcost;
	 totalcost = totalcost+gst;
	 
	 totalcostdays = totalcost * tsize;
	 totalcostdays = totalcostdays.toFixed(2);
	 /*
	 if(nightcost>0){
	 document.getElementById('nightcost').value = nightcost * tsize;
	 }
	 if(transport>0){
	 document.getElementById('transport').value = transport * tsize;
	 }
	 if(booking>0){
	 document.getElementById('booking').value = booking;
	 }
	 */
	   
	 //alert("Your Total Quote is AU$ "+totalcost+". \nThis is an estimated cost and subject to review from 3MA Management");
	 //document.getElementById('cost').innerHTML = adjustmessage+"<br>&nbsp;<br><table width=100% border=0 cellpadding=10 cellspacing=2><tr><td><table width=60% border=1 align=left cellpadding=10 cellspacing=2><tr><td>Angel Charge</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td>Total Cost Before GST</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td>Total per day</td><td align=right>"+totalcost.toFixed(2)+"</td></tr><tr><td>No of Days</td><td align=right>"+tsize+"</td></tr><tr><td>Grand Total</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</b></td></tr></table><br>"; 
	 
	 //-----------------changes----------------------------
	 
	 var b1,t1,n1;
	 
	 if(booking>0){
	 b1 = "<tr><td>Within 7 Days Booking Fee</td><td align=right valign=bottom>$"+booking.toFixed(2)+"</td></tr>" + 
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 b1 = "";
	 }
	 
	 if(nightcost>0){
	 n1 = "<tr><td>Late Night Fee</td><td align=right valign=bottom>$"+nightcost*tsize.toFixed(2)+"</td></tr>" +
 	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 n1 = "";
	 }
	 
	 if(transport>0){
	 t1 = "<tr><td><nobr>Travel Allowance</nobr></td><td align=right valign=bottom>$"+transport*tsize.toFixed(2)+"</td></tr>" +
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 t1 = "";
	 }
	 
	 angelcost = angelcost * tsize;
	 totalcostbeforegst = angelcost+booking+nightcost*tsize+transport*tsize;
	 gst = 1/10*totalcostbeforegst;
	 totalcostdays = totalcostbeforegst+gst;
	 
	 if(location=='m'){
	 
	 	document.getElementById('FormButton1').style.visibility="hidden";
		loc3plus = true;
	
		document.getElementById('FormSection1').innerHTML = "<table width=80% border=0 align=center><tr><th scope=col>&nbsp;&nbsp;</th><th scope=col><font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br>Thankyou very much for your enquiry. Due to the distance our Angel(s) will need to travel to your location we will need to discuss this with you. Our team will be in touch.<br></font></th></tr></table>"; 
	 	
		//ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
		
		//var threepl = document.quote.bookingid.value;		
		
		//ajaxpage('threepluslocation.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'&bookingid='+threepl+'','bookingdiv','loadgif');
	 
	}else{
	 
	 //document.getElementById('cost').innerHTML = adjustmessage+"<font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td><table width=80% border=0 align=left cellpadding=10 cellspacing=2><tr><td>"+noofangel+" Angel(s) @ $80 p/hr "+mtypedisp+"</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=right>Subtotal</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td align=right>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td align=right>TOTAL</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b><font face='Arial, Helvetica, sans-serif' color=#888 size=2>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</font></b></td></tr></table><br></font>";
	 
	 loc3plus = false;
	 	 
	 //document.getElementById('cost3').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#3366cc style=font-size:12px><br>&nbsp;<table width=100% border=0 align=left cellpadding=0 cellspacing=0><tr><td width=10>&nbsp;</td><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr <hr color=#FFFFFF size=1></td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr>"+n1+""+t1+""+b1+"<tr><td width=10>&nbsp;</td><td align=left>Subtotal<hr color=#FFFFFF size=1></td><td align=right>$"+totalcostbeforegst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td width=10>&nbsp;</td><td align=left>GST<hr color=#FFFFFF size=1></td><td align=right>$"+gst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td align=left bgcolor=#A3B9E8><b><font color=#000000 size=3>TOTAL</b></font></td><td align=right bgcolor=#A3B9E8><b><font color=#000000 size=3>$"+totalcostdays+"</b></font></td></tr><tr><td width=10>&nbsp;</td><td colspan=2 align=right bgcolor=#A3B9E8><input name=mtype3 id=mtype3 type=checkbox value=DH onclick=getmtype('DH',"+angelcost.toFixed(2)+");SingleSelect('3');><input name=angelmin3 id=angelmin3 type=hidden value="+angelmin+" /><input name=noofangel3 id=noofangel3 type=hidden  value="+noofangel+" /><input name=nightcost3 id=nightcost3 type=hidden  value="+nightcost*tsize+" /><input name=transport3 id=transport3 type=hidden  value="+transport*tsize+" /><input name=booking3 id=booking3 type=hidden  value="+booking+" /></td></tr></font></table>"; 	 
	  
	  
	 document.getElementById('cost3').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#333333 style='font-size:11px'><table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=left style='height: 25px;'>Subtotal</td><td align=right style='height: 25px;'>$"+totalcostbeforegst.toFixed(2)+"</td></tr><tr style='height: 10px;'><td colspan=2 style='height: 10px; color:#aaaaaa' valign='top' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr><tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr><tr><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 

	 document.getElementById('cost3').innerHTML = "<font face='lucida sans unicode' color=#333333 style='font-size:11px'>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
      n1 + "" + t1 + "" + b1 +
     "<tr><td align=left style='height: 25px;' >Subtotal</td><td align=right>$"+totalcostbeforegst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
	 "<tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr></table>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0 style='clear:both'><tr style='height:30px;' ><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 

	 document.getElementById('selectype3').innerHTML = "<center>Select Double Halo <input name=mtype3 id=mtype3 type=checkbox value=DH onclick=getmtype('DH',"+angelcost.toFixed(2)+","+indivangelhour+");SingleSelect('3');><input name=angelmin3 id=angelmin3 type=hidden value="+angelmin+" /><input name=noofangel3 id=noofangel3 type=hidden  value="+noofangel+" /><input name=nightcost3 id=nightcost3 type=hidden  value="+nightcost*tsize+" /><input name=transport3 id=transport3 type=hidden  value="+transport*tsize+" /><input name=booking3 id=booking3 type=hidden  value="+booking+" /></center>";	 
	  
	 
	 //ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
	 
	 
	 }//----------end location logic
	 
	 }else{
	 	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
		falert = true;
	 }
	 
}

function calculate4(){
	
	var angelno, time, flag, peopleno, peopleno0;
	
	var FirstName, LastName, Email, AC, WP, Mobile;
	
	flag=true;
	
	//if(getSelectedRadio(document.quote.mtype)==-1){
	//flag=false;
	//}
	if(document.quote.location.options[document.quote.location.selectedIndex].value=="0"){
	flag=false;
	}
	if(document.quote.time.options[document.quote.time.selectedIndex].value=="0"){
	flag=false;
	}
		if(document.quote.FirstName.value==""){
		//alert("Please enter the First Name");
		//document.quote.FirstName.focus();
		flag=false;
		}
	
		if(document.quote.LastName.value==""){
		//alert("Please enter the Last Name");
		//document.quote.LastName.focus();
		flag=false;
		}
		/*
		if(document.quote.WP.value==""){
		//alert("Please enter the Work Phone");
		//document.quote.WP.focus();
		flag=false;
		}
		
		if(document.quote.AC.value==""){
		//alert("Please enter the Area Code");
		//document.quote.AC.focus();
		flag=false;
		}
		*/
		if(document.quote.Mobile.value==""){
		//alert("Please enter Mobile");
		//document.quote.Mobile.focus();
		flag=false;
		}
		
		if(document.quote.Email.value==""){
		//alert("Please enter the Email");
		//document.quote.Email.focus();
		flag=false;
		}
	
	peopleno = document.quote.peopleno.value;
	peopleno0 = document.quote.peopleno.value;
	
	time = document.quote.time.value;
	
	FirstName = document.quote.FirstName.value;
	LastName = document.quote.LastName.value;
	Email = document.quote.Email.value;
	AC = document.quote.AC.value;
	WP = document.quote.WP.value;
	Mobile = document.quote.Mobile.value;
	
	var location = document.quote.location.options[document.quote.location.selectedIndex].value;	
	/*	
	for (var i=0; i < document.quote.mtype.length; i++)
	   {
	   if (document.quote.mtype[i].checked)
		  {
		  var mtype = document.quote.mtype[i].value;
		  }
	 }
	 */
	 var mtype = "SB";
   
	 //alert(peopleno+hour+minute+ampm+mtype+location);		 
	 //alert('OK');
	 var angelmin, angelhour, angelcost, noofangel, nightcost, transport, totalcost;
	 
	 //peopleno1 = Math.round(peoplenoinitial/10)*10;
	 
	 var startpeople, noofpeopleperhour, adjustmessage, adjustmessage1, mtypedisp;
	 adjustmessage1="";
	
	if(!isNaN(peopleno) && flag==true && date1!=null && date1!=''){
	falert=false;
	/*		 
	 if(mtype=='RH'){
	 	mtypedisp = 'Regular Halo';
	 }
	 if(mtype=='HH'){
	 	mtypedisp = 'Hand Halo';
	 }
	 if(mtype=='DH'){
	 	mtypedisp = 'Double Halo';
	 }
	 if(mtype=='SB'){
	 	mtypedisp = 'Stress Buster';
	 }
	 */
	 	 
	 if(mtype=='SB'){
	 	//angelmin = peopleno * 15;
		startpeople = 8;
		noofpeopleperhour = 4;		
		if(startpeople>peopleno){	
		peopleno = startpeople;
		}
		if(peopleno%4>0){
		//adjustmessage1 = " The no of people is rounded off to blocks of 4 as this is the no of people that can be messaged in an hour. So "+peopleno+" has been rounded off to "+Math.round(peopleno/4)*4;
		
			if(peopleno%4<=2){
			var pne = 2;
			}
			if(peopleno%4>2){
			var pne = 4;
			}
			peopleno = Math.floor(peopleno/4)*4+pne;
			
			adjustmessage1 = " The no of people is rounded off to multiples of 4 and 2 as the no of people that can be massaged in an hour is 4 and half an hour is 2. So "+peopleno0+" has been rounded off to "+peopleno;
		
		}
		adjustmessage = "Minimum no of people for Stress Buster is 8."+adjustmessage1;
		//angelmin = Math.round(peopleno/4)*60;
		angelmin = peopleno/4*60;
	 }
	 
	 document.getElementById('peopleno1').value = peopleno;
	 
	 angelhour = 1/60 * angelmin;
	 angelcost = angelhour * angelrateperhour;
	 
	 //document.getElementById('angelmin').value = angelmin;
	 
	 if(angelhour>=4.5){
		 noofangel = angelhour / 4.5;	 
		 noofangel = Math.ceil(noofangel);		 
	 }else{
	 	noofangel = 1;
	 }
	 
	 var adj = 0;
	 var indivangelhour = angelhour/noofangel;
	 var indivdivider = Math.floor(indivangelhour);
	 		//alert(indivangelhour%indivdivider);			
	 		if(indivangelhour%indivdivider>0 && indivangelhour%indivdivider<=0.5){
			adj = 0.5;
			}
			if(indivangelhour%indivdivider>0.5 && indivangelhour%indivdivider<=0.99){
			adj = 1;
			}			
			//alert(adj);
		indivangelhour = Math.floor(indivangelhour)+adj;
		//alert(indivangelhour);
	
	angelcost = indivangelhour * angelrateperhour * noofangel;
	 
	 //document.getElementById('noofangel').value = noofangel;	 

	 nightcost = 0;
	 
	 var timeportion_array, hourmin_array, hour, ampm;
	 timeportion_array = time.split(" ");
	 ampm = timeportion_array[1];
	 
	 hourmin_array = timeportion_array[0].split(":");
	 hour = hourmin_array[0];
	 minutes = hourmin_array[1];
	 
	 //alert(hour);
	 
	 minutesdec = Number(minutes) / 60
	 if((hour==12 || hour==1 || hour==2 || hour==3 || hour==4 || hour==5 || hour==6 || hour==7) && ampm=='AM'){	 	
		nightcost = noofangel * 33;				
	 }
	 if ( (hour==7) && (ampm=='AM') && (minutes==30) ) {
		 nightcost = 0;
	 }
	 endhour = Number(indivangelhour)+Number(hour)+Number(minutesdec);
	 if ((endhour>=12) && (ampm=='PM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((endhour>=1) && (endhour<=7) && (ampm=='AM')) {
		 nightcost = noofangel * 33;
	 }	
	 if ((hour==12) && (ampm=='PM')) {
		 nightcost = 0;
	 }	
	 
	 /*
	 if(ampm=='PM'){
	 	var hourend = angelmin/60;	
		var thishour = hour;	
		if(hour==12){
		thishour = 0;
		}
		//alert(angelmin);
		//alert(hourend);
		//alert(thishour/10*10+minutes/60+hourend);
		//if(thishour/10*10+minutes/60+hourend > 11.99){
		if(thishour>=10){	
		nightcost = noofangel * 30;	
		}
	 }
	 */
	 
	 transport=0;
	 if(location==1 || location==2 || location==3 || location==4){
	 	transport = 33 * location * noofangel;
	 }
	 
	 //-----dates thing---------------
	 
	 //alert(date1);
	 	 
	 var where_is_mytool=date1.toString();
	 var mytool_array=where_is_mytool.split(",");
	 var tsize = mytool_array.length;
	 
	 var darray = new Array();
	 	 
	 for (var i=0; i < tsize; i++){
	 	var tmonth;
	 	var tdate = mytool_array[i];		
		var tday = tdate.substring(8,10);	
			
		if(navigator.appName=="Microsoft Internet Explorer"){			
			var tyear = tdate.substring(29,33);
			if(tday>=1 && tday<=9){
			var tyear = "2"+tyear;
			}
		}else{	
		var tyear = tdate.substring(11,15);
		}
		
		var tmon = tdate.substring(4,7);		
		//alert(tday+"."+tmon+"."+tyear);
			if(tmon=="Jan"){
			tmonth = "01";
			}
			if(tmon=="Feb"){
			tmonth = "02";
			}
			if(tmon=="Mar"){
			tmonth = "03";
			}
			if(tmon=="Apr"){
			tmonth = "04";
			}
			if(tmon=="May"){
			tmonth = "05";
			}
			if(tmon=="Jun"){
			tmonth = "06";
			}
			if(tmon=="Jul"){
			tmonth = "07";
			}
			if(tmon=="Aug"){
			tmonth = "08";
			}
			if(tmon=="Sep"){
			tmonth = "09";
			}
			if(tmon=="Oct"){
			tmonth = "10";
			}
			if(tmon=="Nov"){
			tmonth = "11";
			}
			if(tmon=="Dec"){
			tmonth = "12";
			}
			var tdate1 = tday+"/"+tmonth+"/"+tyear;
			darray[i]=tdate1;
	 }
	 
	 darray.sort( dmyOrdA );
	 
	 var dbdate='';
	 for(var i=0; i < tsize; i++){
	 	dbdate = dbdate+darray[i]+',';
	 }
	 
	 document.getElementById('dbdate').value = dbdate;
	 	 
	 //alert(darray[0]);
	 
	 var darrayy=darray[0].substring(6,10);
	 var darrayd=darray[0].substring(0,2);	 
	 var darraym=darray[0].substring(3,5);
	 
	 if(darraym.substring(0,1)=='0'){
	 darraym = darraym.substring(1,2);
	 }
	 darraym=darraym-1;
	 
	 if(darrayd.substring(0,1)=='0'){
	 darrayd = darrayd.substring(1,2);
	 }
	 
	 //alert(darrayy+"/"+darrayd+"/"+darraym);
	 
	 
	 var days = 0;
	 var difference = 0;	
	 startdate = new Date(darrayy,darraym,darrayd);	
	 today = new Date();	
	 difference = startdate - today;	
	 days = Math.round(difference/(1000*60*60*24));
	 days = days+1;
	 
	 //alert(days+1);	 
	 	 
	 //-------------------------------
	 
	 totalcost = angelcost+nightcost+transport;
	 
	 var booking=0;
	 if(days<=7){
	 booking = 20/100*totalcost;
	 //totalcost = totalcost+booking;
	 }
	 /*
	 var totalcostbeforegst=totalcost;
	 var gst = 1/10*totalcost;
	 totalcost = totalcost+gst;
	 
	 totalcostdays = totalcost * tsize;
	 totalcostdays = totalcostdays.toFixed(2);
	 /*
	 if(nightcost>0){
	 document.getElementById('nightcost').value = nightcost * tsize;
	 }
	 if(transport>0){
	 document.getElementById('transport').value = transport * tsize;
	 }
	 if(booking>0){
	 document.getElementById('booking').value = booking;
	 }
	 */
	   
	 //alert("Your Total Quote is AU$ "+totalcost+". \nThis is an estimated cost and subject to review from 3MA Management");
	 //document.getElementById('cost').innerHTML = adjustmessage+"<br>&nbsp;<br><table width=100% border=0 cellpadding=10 cellspacing=2><tr><td><table width=60% border=1 align=left cellpadding=10 cellspacing=2><tr><td>Angel Charge</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td>Total Cost Before GST</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td>Total per day</td><td align=right>"+totalcost.toFixed(2)+"</td></tr><tr><td>No of Days</td><td align=right>"+tsize+"</td></tr><tr><td>Grand Total</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</b></td></tr></table><br>"; 
	 
	 //-----------------changes----------------------------
	 
	 var b1,t1,n1;
	 
	 if(booking>0){
	 b1 = "<tr><td>Within 7 Days Booking Fee</td><td align=right valign=bottom>$"+booking.toFixed(2)+"</td></tr>" + 
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 b1 = "";
	 }
	 
	 if(nightcost>0){
	 n1 = "<tr><td>Late Night Fee</td><td align=right valign=bottom>$"+nightcost*tsize.toFixed(2)+"</td></tr>" +
 	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 n1 = "";
	 }
	 
	 if(transport>0){
	 t1 = "<tr><td><nobr>Travel Allowance</nobr></td><td align=right valign=bottom>$"+transport*tsize.toFixed(2)+"</td></tr>" +
	 	  "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>";
	 }else{
	 t1 = "";
	 }
	 
	 angelcost = angelcost * tsize;
	 totalcostbeforegst = angelcost+booking+nightcost*tsize+transport*tsize;
	 gst = 1/10*totalcostbeforegst;
	 totalcostdays = totalcostbeforegst+gst;
	 
	 if(location=='m'){
	 
	 	document.getElementById('FormButton1').style.visibility="hidden";
		loc3plus = true;
	
		document.getElementById('FormSection1').innerHTML = "<table width=80% border=0 align=center><tr><th scope=col>&nbsp;&nbsp;</th><th scope=col><font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br>Thankyou very much for your enquiry. Due to the distance our Angel(s) will need to travel to your location we will need to discuss this with you. Our team will be in touch.<br></font></th></tr></table>"; 
	 	
		//ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');
		
		//var threepl = document.quote.bookingid.value;		
		
		//ajaxpage('threepluslocation.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'&bookingid='+threepl+'','bookingdiv','loadgif');
	 
	}else{
	 
	 //document.getElementById('cost').innerHTML = adjustmessage+"<font face='Arial, Helvetica, sans-serif' color=#000000 size=4><br>&nbsp;<br><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td><table width=80% border=0 align=left cellpadding=10 cellspacing=2><tr><td>"+noofangel+" Angel(s) @ $80 p/hr "+mtypedisp+"</td><td align=right>"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=right>Subtotal</td><td align=right>"+totalcostbeforegst.toFixed(2)+"</td></tr><tr><td align=right>GST</td><td align=right>"+gst.toFixed(2)+"</td></tr><tr><td align=right>TOTAL</td><td align=right>"+totalcostdays+"</td></tr></table></td></tr><tr><td><br>&nbsp;<br><b><font face='Arial, Helvetica, sans-serif' color=#888 size=2>Your Total Quote is AU$ "+totalcostdays+". \nThis is an estimated cost and subject to review from 3MA Management</font></b></td></tr></table><br></font>";
	 	 
		 loc3plus = false;
	 
	 //document.getElementById('cost4').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#3366cc style=font-size:12px><br>&nbsp;<table width=100% border=0 align=left cellpadding=0 cellspacing=0><tr><td width=10>&nbsp;</td><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr <hr color=#FFFFFF size=1></td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr>"+n1+""+t1+""+b1+"<tr><td width=10>&nbsp;</td><td align=left>Subtotal<hr color=#FFFFFF size=1></td><td align=right>$"+totalcostbeforegst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td width=10>&nbsp;</td><td align=left>GST<hr color=#FFFFFF size=1></td><td align=right>$"+gst.toFixed(2)+"<hr color=#FFFFFF size=1></td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td align=left bgcolor=#A3B9E8><b><font color=#000000 size=3>TOTAL</b></font></td><td align=right bgcolor=#A3B9E8><b><font color=#000000 size=3>$"+totalcostdays+"</b></font></td></tr><tr><td width=10>&nbsp;</td><td colspan=2 align=right bgcolor=#A3B9E8><input name=mtype4 id=mtype4 type=checkbox value=SB onclick=getmtype('SB',"+angelcost.toFixed(2)+");SingleSelect('4');><input name=angelmin4 id=angelmin4 type=hidden value="+angelmin+" /><input name=noofangel4 id=noofangel4 type=hidden  value="+noofangel+" /><input name=nightcost4 id=nightcost4 type=hidden  value="+nightcost*tsize+" /><input name=transport4 id=transport4 type=hidden  value="+transport*tsize+" /><input name=booking4 id=booking4 type=hidden  value="+booking+" /></td></tr></font></table>"; 	
	 
	 //ajaxpage('recordbookingattempt.php?Booking_People='+peopleno+'&Booking_Date='+dbdate+'&Booking_Time='+time+'&Booking_Location='+location+'&Booking_Type='+mtype+'&FirstName='+FirstName+'&LastName='+LastName+'&Email='+Email+'&AC='+AC+'&WP='+WP+'&Mobile='+Mobile+'','bookingdiv','loadgif');	 
	 
	 document.getElementById('cost4').innerHTML = "<font face='Arial, Helvetica, sans-serif' color=#333333 style='font-size:11px'><table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>"+n1+""+t1+""+b1+"<tr><td align=left style='height: 25px;'>Subtotal</td><td align=right style='height: 25px;'>$"+totalcostbeforegst.toFixed(2)+"</td></tr><tr style='height: 10px;'><td colspan=2 style='height: 10px; color:#aaaaaa' valign='top' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr><tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr><tr><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 
	 
	 document.getElementById('cost4').innerHTML = "<font face='lucida sans unicode' color=#333333 style='font-size:11px'>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0><tr><td><nobr>"+noofangel+" Angel(s) for "+indivangelhour+" hrs</nobr><br>@ $"+angelrateperhour+" p/hr </td><td align=right valign=bottom>$"+angelcost.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
      n1 + "" + t1 + "" + b1 +
     "<tr><td align=left style='height: 25px;' >Subtotal</td><td align=right>$"+totalcostbeforegst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr>" +
	 "<tr><td align=left>GST</td><td align=right>$"+gst.toFixed(2)+"</td></tr>" +
	 "<tr><td colspan=2 style='padding-top:10px; color:#aaaaaa; font-family:arial' align='center'>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;</td></tr></table>" +
	 "<table width=100% border=0 align=left cellpadding=1 cellspacing=0 style='clear:both'><tr style='height:30px;' ><td align=left><b><font size=2>TOTAL</b></font></td><td align=right><b><font size=2>$"+totalcostdays.toFixed(2)+"</b></font></td></tr></font></table>"; 	 
	 	 
	 document.getElementById('selectype4').innerHTML = "<center>Select Stress Buster <input name=mtype4 id=mtype4 type=checkbox value=SB onclick=getmtype('SB',"+angelcost.toFixed(2)+","+indivangelhour+");SingleSelect('4');><input name=angelmin4 id=angelmin4 type=hidden value="+angelmin+" /><input name=noofangel4 id=noofangel4 type=hidden  value="+noofangel+" /><input name=nightcost4 id=nightcost4 type=hidden  value="+nightcost*tsize+" /><input name=transport4 id=transport4 type=hidden  value="+transport*tsize+" /><input name=booking4 id=booking4 type=hidden  value="+booking+" /></center>";	 
	  	 
	 
	 //window.location.href = "#C4";
	 
	 
	 }//----------end location logic
	 
	 }else{
	 	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
		falert = true;
	 }
	 
}

//--------------------------------------------------------------------end calculate---------------------

function validate(){
	var angelno, time, flag, peopleno;
	
	flag=true;
	
	falertmessage='';
	
	//if(getSelectedRadio(document.quote.mtype)==-1){
	//flag=false;
	//}
	/*
	for (var i=0; i < document.quote.mtype.length; i++)
	   {
	   if (document.quote.mtype[i].checked)
		  {
		  var rad_val = document.quote.mtype[i].value;
		  }
	   }
	   */
	   
	var rad_val = document.getElementById("messagetype").value;   
	
	//alert(rad_val);
	
	if(rad_val==""){
	falertmessage=falertmessage+'Please Select Type of Angel Massage\n';
	flag=false;
	}
	
	if(document.quote.location.options[document.quote.location.selectedIndex].value=="0"){
	falertmessage=falertmessage+'Please Select Location\n';
	flag=false;
	}
	if(document.quote.time.options[document.quote.time.selectedIndex].value=="0"){
	falertmessage=falertmessage+'Please Select Time\n';
	flag=false;
	}
	if(document.quote.FirstName.value==""){
		//alert("Please enter the First Name");
		//document.quote.FirstName.focus();
		falertmessage=falertmessage+'Please enter First Name\n';
		flag=false;
		}
	
		if(document.quote.LastName.value==""){
		//alert("Please enter the Last Name");
		//document.quote.LastName.focus();
		falertmessage=falertmessage+'Please enter Last Name\n';
		flag=false;
		}
		/*
		if(document.quote.WP.value==""){
		//alert("Please enter the Work Phone");
		//document.quote.WP.focus();
		flag=false;
		}
		
		if(document.quote.AC.value==""){
		//alert("Please enter the Area Code");
		//document.quote.AC.focus();
		flag=false;
		}
		*/
		if(document.quote.Mobile.value==""){
		//alert("Please enter Mobile");
		//document.quote.Mobile.focus();
		falertmessage=falertmessage+'Please enter mobile\n';
		flag=false;
		}
		
		if(document.quote.Email.value==""){
		//alert("Please enter the Email");
		//document.quote.Email.focus();
		falertmessage=falertmessage+'Please enter Email\n';
		flag=false;
		}
		
		if(date1==null || date1==''){
		falertmessage=falertmessage+'Please select the date(s) would you like to have your Angel(s)\n';
		}
	
	peopleno = document.quote.peopleno.value;
	
	if(peopleno==''){
		falertmessage=falertmessage+'Please enter the number of people you will like to have massaged. It must be numeric\n';
	}
	
	time = document.quote.time.value;
	
	if(!isNaN(peopleno) && flag==true && date1!=null && date1!=''){
		return true;
	}else{
	 	//alert('Please ensure that you have entered your Personal Details, a tentative Date, the Number of People you would like to have massaged, Angel Arrival Time, Booking Location, and Type of Angel Massage.');
		alert(falertmessage);
		return false;
	 }

}

function mypopup()
 {
   mywindow = window.open ("http://3minuteangels.com/OurHaloMassage/550/1171/3/0/0/","mywindow","location=0,status=0,toolbar=0,menubar=0,scrollbars=1,width=950,height=590");
  mywindow.moveTo(30,40);
 }
 
function SingleSelect(chkno){

	if(chkno=='1'){
		document.getElementById('mtype1').checked = true;
		document.getElementById('mtype2').checked = false;
		document.getElementById('mtype3').checked = false;
		document.getElementById('mtype4').checked = false;
	}
	if(chkno=='2'){
		document.getElementById('mtype1').checked = false;
		document.getElementById('mtype2').checked = true;
		document.getElementById('mtype3').checked = false;
		document.getElementById('mtype4').checked = false;
	}
	if(chkno=='3'){
		document.getElementById('mtype1').checked = false;
		document.getElementById('mtype2').checked = false;
		document.getElementById('mtype3').checked = true;
		document.getElementById('mtype4').checked = false;
	}
	if(chkno=='4'){
		document.getElementById('mtype1').checked = false;
		document.getElementById('mtype2').checked = false;
		document.getElementById('mtype3').checked = false;
		document.getElementById('mtype4').checked = true;
	}

}

function mypopup()
 {
   mywindow = window.open ("http://3minuteangels.com/OurHaloMassage/550/1171/3/0/0/","mywindow","location=0,status=0,toolbar=0,menubar=0,scrollbars=1,width=950,height=590");
  mywindow.moveTo(30,40);
 }

