//String Buffer Object, to allow faster HTML creation.
var EMPTY_STRING='';
function StringBuffer() 
{
  this.value = new Array();
}
 StringBuffer.prototype.getValue = function()
 {
  return this.value.join(EMPTY_STRING);
 }
 StringBuffer.prototype.add = function(str)
 {
   this.value[this.value.length]=str;
   return this; //Return the string before
 }
 StringBuffer.prototype.delLast = function()
 {
  if (this.value.length)
  {
   delete this.value[this.value.length-1]
  }
 }

function handleHttpResponse() {    
	if (http.readyState == 4) { 
	      if(http.status==200) { 
			var results=http.responseText; 			   
			document.getElementById('dialogue').style.display="block";
	      }else{
			  closeDialogue();
		  }
        }
} 
function closeDialogue(){
	var getElm = document.getElementById;
		getElm('gc-overlay').style.display="none";
		getElm('dialogue').style.display="none";
		getElm('sLanActivity').disabled=false;
		getElm('sTypeAct').disabled=false;	
}
function requestSendInquryForm() {      
	     if( !reqiredFields()){
	   	   	return false;
	   }
	   if(!checkValidity()){
	   	return false;
	   }
		var getElm = document.getElementById;
		getElm('gc-overlay').style.display="block";
		getElm('sTypeAct').disabled=true;
		getElm('sLanActivity').disabled=true;
	    var and ='&';
	    var url = "../lib/clientRequest.php?"
	    var sParams = new StringBuffer();
	    sParams.add("sName=").add(getElm('sName').value);
	    sParams.add("&sCompany=").add(getElm('sCompany').value);
	    sParams.add("&sPhone=").add(getElm('sPhone').value);
	    sParams.add("&sCellPhone=").add(getElm('sCellPhone').value);
	    sParams.add("&sNumAdults=").add(getElm('sNumAdults').value);
	    sParams.add("&sNumChilds=").add(getElm('sNumChilds').value);
	    sParams.add("&sEmail=").add(getElm('sEmail').value);
	    sParams.add("&sAddress=").add(getElm('sAddress').value);
	    sParams.add("&sPrefConWay=").add(getElm('rPrefConWay').value);
	    sParams.add("&sMsg=").add(getElm('sMsg').value);
	    sParams.add("&sDate=").add(getElm('sDate').value);
	    var oTypeAct =getElm('sTypeAct');
	    sParams.add("&sTypeAct=").add(oTypeAct.options[oTypeAct.selectedIndex].innerText);
	    var oLanActivity =getElm('sLanActivity');
	    sParams.add("&sLanActivity=").add(oLanActivity.options[oLanActivity.selectedIndex].innerText);
	    http.open("POST", url + sParams.getValue() , true); 
	    http.setRequestHeader("Content-Type", "text/html; charset=UTF-8");
        http.onreadystatechange = handleHttpResponse; 
        http.send(null);
} 




function getHTTPObject() { 
  var xmlhttp; 

  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    
} 
  return xmlhttp; 

  
} 
var http = getHTTPObject(); // We create the HTTP Object 
var cal1 = new CalendarPopup();
