// JavaScript Document

function getAjax() {
	try {
		//alert('msxml2');
		return new ActiveXObject('Msxml2.XMLHTTP');
	} catch (e) {
		try {
			//alert('microsoft');
			return new ActiveXObject('Microsoft.XMLHTTP');
		} catch (e) {
			//alert('xmlhttpreq');
			return new XMLHttpRequest();
			
		}
	}
}

/**
	 * Perform AJAX call.
	 *
	 * @param {string} url URL of AJAX service.
	 * @param {function} func Function to call when response arrives.
	 * @param {string} method Request method post or get.
	 * @param {Array} array Array with arguments to send.
	 */
	function sendAjax(url, func, method, array, funcarray) {
		//alert('iiii');
		var x = getAjax();
		//alert(x);
		//alert('kjkljkljkl');
		//alert('sendAjax url : '+url);
		//alert('sendAjax args : '+array);

		x.open(method, url, true);

		x.onreadystatechange = function() {
			if (x.readyState == 4) {
				//alert('responseXML : '+x.responseXML);
				//alert('responseTest : '+x.responseText);
				func(x.responseText, x.responseXML, funcarray);
				
				/*if (mode == "xml") {
					func(x.responseXML, funcarray);
				}
				else {
					func(x.responseText, funcarray);
				}*/
			}
		};

		if (method == 'post')
			x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

		x.send(array);
	}