var xmlhttp = false;
var busy = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!= 'undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp = false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp = false;
	}
}

function postForm(formName, url) {
	if (xmlhttp && !busy) {
		var postData = '';
		var params = '';
		if(document.forms[formName]) {
			var formElements = document.forms[formName].elements;
			if (formElements) {
				for( var i=0; i < formElements.length; i++) {
					if (!formElements[i].name)
						continue;
					if (formElements[i].type && (formElements[i].type == 'radio' || formElements[i].type == 'checkbox') && formElements[i].checked == false)
						continue;
					if (formElements[i].disabled && formElements[i].disabled == true && submitDisabledElements == false)
						continue;
					var name = formElements[i].name;
					if (name) {
						if (formElements[i].type == 'select-multiple') {
							for (var j = 0; j < formElements[i].length; j++) {
								if (formElements[i].options[j].selected == true)
									postData += '&' + name + '=' + encodeURIComponent(formElements[i].options[j].value);
							}
						} else {
							postData += '&' + name + '=' + encodeURIComponent(formElements[i].value);
						}
					}
					if (formElements[i].type == 'submit') {
						formElements[i].disabled = true;	
					}
				}
				postData += '&rnd=' + Math.random();
				params = (url.indexOf('?') == -1) ? '?c_only=1' + postData : '&c_only=1' + postData;
			}
		}
		xmlhttp.open('GET', url + params, true);
		document.body.style.cursor = 'wait';
		busy = true;
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				/* Retrieve response */
				var response = xmlhttp.responseText;
				document.getElementById('content').innerHTML = response;
				busy = false;
				document.body.style.cursor = 'default';
				for( var i=0; i < formElements.length; i++) {
					if (formElements[i].type == 'submit') {
						formElements[i].disabled = false;	
					}
				}
			}
		}
		xmlhttp.send(null);
	} else {
		document.forms[formName].submit();	
	}
	return false;
}