// JavaScript Document
var xmlHttp

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
function loadForm(page,event)
{
	if(page != "")
	{
		hidediv('quoteform');
	}
	showdiv('busy');
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
		 alert ("Could not process request")
		 return
 	}
	
	var url="quoteform.php"
	
	url=url+"?form="+page+"&e="+event
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function()
	{
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			hidediv('busy');
			showdiv('quoteform');
			document.getElementById("quoteform").innerHTML=xmlHttp.responseText		
		} 
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function doQuotation(quotestring,guest,contact,email,passengers,events,survey)
{ 
	if(quotestring != "")
	{
		hidediv('quoteform');
	}
	showdiv('busy');
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
		 alert ("Could not process request")
		 return
 	}
	
	var url="request-quotation.php"
	
	url=url+"?quote="+quotestring+"&guest="+guest+"&contact="+contact+"&email="+email+"&passengers="+passengers+"&event="+events+"&survey="+survey;
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function()
	{
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			hidediv('busy');
			showdiv('quoteform');
			document.getElementById("quoteform").innerHTML=xmlHttp.responseText		
		} 
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

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;
}

