// AJAX CODE
function formData2QueryString(docForm) {

	var strSubmitContent = '';
	var formElem;
	var strLastElemName = '';
	
	for (i = 0; i < docForm.elements.length; i++) {
		
		formElem = docForm.elements[i];
		switch (formElem.type) {
			case 'text':
			case 'hidden':
			case 'password':
			case 'textarea':
			case 'select-one':
				strSubmitContent += formElem.name + '=' + formElem.value + '&'
				break;
				
			case 'radio':
				if (formElem.checked) {
					strSubmitContent += formElem.name + '=' + escape(formElem.value) + '&'
				}
				break;
				
			case 'checkbox':
				if (formElem.checked) {
					if (formElem.name == strLastElemName) {
						if (strSubmitContent.lastIndexOf('&') == strSubmitContent.length-1) {
							strSubmitContent = strSubmitContent.substr(0, strSubmitContent.length - 1);
						}
						strSubmitContent += ',' + escape(formElem.value);
					}
					else {
						strSubmitContent += formElem.name + '=' + escape(formElem.value);
					}
					strSubmitContent += '&';
					strLastElemName = formElem.name;
				}
				break;
				
		}
	}
	
	// Remove trailing separator
	strSubmitContent = strSubmitContent.substr(0, strSubmitContent.length - 1);
	return strSubmitContent;
}

function xmlhttpPost(strURL, strSubmit, strResultFunc) {
        var xmlHttpReq = false;
        
			if (window.ActiveXObject) {
				try {
					xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e) {
					try {
						xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
					} catch(e1) { return null; }
				}
			} else if (window.XMLHttpRequest) {
				xmlHttpReq = new XMLHttpRequest();
			} else {
			return null;
			}		
	
		xmlHttpReq.open('POST', strURL, true);
        xmlHttpReq.setRequestHeader('Content-Type', 
                'application/x-www-form-urlencoded');
        xmlHttpReq.onreadystatechange = function() {
                if (xmlHttpReq.readyState == 4) {
                        eval(strResultFunc + '(xmlHttpReq.responseText);');
                }
        }
        xmlHttpReq.send(strSubmit);	
}