/*these function uses for ajax technology post method.*/
function callAjax(theform, where) {		
   // var oForm = document.forms[0];	
   document.getElementById("ajax_message").innerHTML = "Working...";		
	var oForm = theform;
	var sBody = getRequestBody(oForm);        
   var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("post", oForm.action, true);
	oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");            
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			if (oXmlHttp.status == 200){saveResult(oXmlHttp.responseText, where); }                        
			else{ saveResult("An error occurred: " + oXmlHttp.statusText); }      
		}            
	};
	oXmlHttp.send(sBody);       
}

function getRequestBody(oForm) {
	var aParams = new Array();		
	for (var i=0 ; i < oForm.elements.length; i++) {
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].value);
		aParams.push(sParam);
	} 	
	return aParams.join("&");        
}

function saveResult(sMessage, where) {
	var divStatus = document.getElementById(where);
	divStatus.innerHTML = sMessage;    
	document.getElementById("ajax_message").innerHTML = "";	        
}
