// JavaScript Document

var xmlHttp

var params

var check = true;

function showQuoteCorporate() { 
		
		// Validation Checks
		if (( document.plannerandquote.typeof_eventbreak[0].checked == false ) && ( document.plannerandquote.typeof_eventbreak[1].checked == false )) {
        	alert ("Please select the type of event/break");
			check = false;
		} else {
			check = true;
		}
		
		if (check) {
		
			if(document.getElementById("noofpeople").value == ""){
				alert("Please enter the no. of people attending your event/break");
				check = false;
			} else {
				check = true;
			}
			
			if (check) {
				
				if(document.getElementById("noofnights").value == ""){
					alert("Please enter the no. of night you will be staying");
					check = false;
				} else {
					check = true;
				}
				
				if (check) {
					
					if(document.getElementById("noofdays").value == ""){
						alert("Please enter the no. of days of your event/break");
						check = false;
					} else {
						check = true;
					}
					
					if (check) {
						
						if(document.getElementById("noofdayslunch").value == ""){
							alert("Please enter the no. of days when lunch is required");
							check = false;
						} else {
							check = true;
						}
						
						if (check) {
							
							if(document.getElementById("noofdaysevemeal").value == ""){
								alert("Please enter the no. of days when an evening meal is required");
								check = false;
							} else {
								check = true;
							}
							
							
							if (check) {
								
								var multiCheckbox = false;
								var temp;
								for (i = 0; i < document.plannerandquote.activities.length; i++) {
									if (document.plannerandquote.activities[i].checked) {
										
										temp = temp + "&activities[]=" + document.plannerandquote.activities[i].value;
										check = true; 
										multiCheckbox = true;
									}
								}
								
								 if (!multiCheckbox) {
									alert("Please select one or more activities");
									check = false;
								} else {
									// Start Quote Code
										xmlHttp=GetXmlHttpObject();
										if (xmlHttp==null) {
  											alert ("Your browser does not support AJAX!");
  										return;
  										} 								
				
										params = "noofpeople=" + document.getElementById("noofpeople").value+
										"&noofnights=" + document.getElementById("noofnights").value+
										"&noofdays=" + document.getElementById("noofdays").value+
										"&noofdayslunch=" + document.getElementById("noofdayslunch").value+
										"&noofdaysevemeal=" + document.getElementById("noofdaysevemeal").value+
										temp;
										var url="getbreakquote_corporate.php";
										xmlHttp.onreadystatechange=stateChanged5;
										xmlHttp.open("POST",url,true);
										//Send the proper header information along with the request
										xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  										xmlHttp.setRequestHeader("Content-length", params.length);
  										xmlHttp.setRequestHeader("Connection", "close");
										xmlHttp.send(params);
								}
								
							} // End of sixth check
							
						} // End of fifth check
						
					} // End of fouth check
					
				} // End of third check
				
			} // End of Second Check
			
		} // End of First check

	
    	// End of validation Checks

	
} // End of function



function stateChanged5() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtQuote").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}