var xmlhttp=false;
var element

function xmlGET(url, el) {
	if (window.XMLHttpRequest) { // Mozilla, etc.
		element=el
		xmlhttp=new XMLHttpRequest();
		xmlhttp.onreadystatechange = xmlhttpChange;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	} else if (window.ActiveXObject) { // IE
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp) {
			element=el
			xmlhttp.onreadystatechange = xmlhttpChange;
			xmlhttp.open("GET",url,true);
			xmlhttp.send();
		}
	}
}


function xmlPOST(url, data, el) {
	if (window.XMLHttpRequest) { // Mozilla etc.
		element=el
		xmlhttp=new XMLHttpRequest();
		xmlhttp.onreadystatechange=xmlhttpChange;
		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.send(data);
	} else if (window.ActiveXObject) { // IE
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp) {
			element=el
			xmlhttp.onreadystatechange=xmlhttpChange;
			xmlhttp.open("POST",url,true);
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlhttp.send(data);
		}
	}
}



function xmlhttpChange() {
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200 || xmlhttp.status == 304) {
			// 200 OK
//			handle_response();
			document.getElementById(element).innerHTML=xmlhttp.responseText ;


			var ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:</script>)';
           
			var match = new RegExp(ScriptFragment, 'img');
			var scripts  = xmlhttp.responseText.match(match);

			if(scripts) {
		        var js = '';
			        for(var s = 0; s < scripts.length; s++) {
			            var match = new RegExp(ScriptFragment, 'im');
			            js += scripts[s].match(match)[1];
		        	}
		        eval(js);
			    }
		}
	} else {
		// error
	}
}



