var xmlHttpReq 
function xmlhttpMain(strURL,queryStr,submitType,resultFunction,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4) { 
	var xmlHttpReq = false; 
	var self = this; 
	var asyncFlag = (resultFunction != null); 
	// Mozilla/Safari 
	if (window.XMLHttpRequest) { 
		xmlHttpReq = new XMLHttpRequest(); 
	} 
	// IE 
	else if (window.ActiveXObject) { 
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 
	} 
	if (xmlHttpReq) { 
		if (submitType == 'POST') { 
			fullURL = strURL; 
		} 
		else { 
			fullURL = strURL+'?'+queryStr; 
		} 
		xmlHttpReq.open(submitType, fullURL, asyncFlag); 
		xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
		xmlHttpReq.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); 
		//This line prevents IE caching of requests 
		if (asyncFlag) { 
			xmlHttpReq.onreadystatechange = function() { 
				if (xmlHttpReq.readyState == 4) { 
					resultFunction(xmlHttpReq.responseText,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4); 
				} 
			} 
		} 
		if (submitType == 'POST') xmlHttpReq.send(queryStr); 
		else xmlHttpReq.send(); 
		if (asyncFlag) { 
			return true; 
		} 
		else { 
			return xmlHttpReq.responseText; 
		} 
	} 
	else { 
		alert("Ajax not supported!"); 
		return "AJAX_UNSUPPORTED"; 
	} 
} 
//
function xmlhttpPost(strURL,queryStr,resultFunction,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4) { 
	return xmlhttpMain(strURL,queryStr,'POST',resultFunction,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4); 
} 
//
function xmlhttpGet(strURL,queryStr,resultFunction,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4) { 
	return xmlhttpMain(strURL,queryStr,'GET',resultFunction,resultFunctionParam1,resultFunctionParam2,resultFunctionParam3,resultFunctionParam4); 
} 
//
function getFormQueryString(formObj) { 
	qs = ''; i = 0; while (i < formObj.elements.length) { 
		field = formObj.elements[i]; 
		if (field != null && field.name != '' && (field.type != 'radio' || field.checked == true)) { 
			if (qs) { 
				qs += '&'; 
			} 
			qs += field.name + '=' + escape(field.value) 
		} 
		i++; 
	} 
	return qs; 
} 
//
function simpleFormValidation(strURL,formObj) { 
	var queryStr = getFormQueryString(formObj) + "&ajax=1"; 
	var result = xmlhttpPost(strURL,queryStr); 
	if (result != 1) { 
		alert(result); 
		return false; 
	} 
	return true; 
}