/////////////////////////////////////////////////////////////////////////////////
//
//		ajaxin käytön helpottaja - jotta ajax sivut olis siistimmän näkösiä
//		21.11.2008  by  Veikko Salminen
//
/////////////////////////////////////////////////////////////////////////////////

var aw_xmlHttp;

function aw_get_content_from(url, callback) {
	aw_xmlHttp=aw_GetXmlHttpObject();
	if (aw_xmlHttp==null) {alert ("Browser does not support HTTP Request");return;}
	
	url=url+"&sid="+Math.random();
	aw_xmlHttp.onreadystatechange= function() {
		if (aw_xmlHttp.readyState==4 || aw_xmlHttp.readyState=="complete") { 
   		callback(aw_xmlHttp.responseText);
  	}
	};
	
	aw_xmlHttp.open("GET",url,true);
	aw_xmlHttp.send(null);	
}

function aw_send_http_request(url) {
	aw_xmlHttp=aw_GetXmlHttpObject();
	if (aw_xmlHttp==null) {alert ("Browser does not support HTTP Request");return;}
	url=url+"&sid="+Math.random();
	aw_xmlHttp.open("GET",url,true);
	aw_xmlHttp.send(null);	
}

function aw_GetXmlHttpObject() {
var aw_xmlHttp=null;
try {aw_xmlHttp=new XMLHttpRequest();}
catch (e){
 try {aw_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
 catch (e){
  aw_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
 }
return aw_xmlHttp;
}