function __createAjax(){
	var xhr_object = null; 

	if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); //FF
	else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); //IE
	else return false;
	return xhr_object;
}

function ajaxMe(method,data,async,loadscript,badscript,callback){
	var xhr=__createAjax();
	if(typeof(loadscript)!="undefined" && loadscript!="")eval(loadscript);
	
	if(typeof(method)=="undefined")method='GET';else method.toUpperCase();
	if(method!='GET' && method!='POST')method="GET";
	
	var url='ajaxplug.php';

	if(typeof(async)=="undefined")async=false;
	if(async)async=true; else async=false;
	
	if(typeof(data)=="undefined")data="";
	if(data=="")data=null;
	
	if(method=="GET" && data){url+="?"+data;data=null;}
	xhr.abort();
	xhr.open(method, url, async); 
	xhr.onreadystatechange=function(){ 
		if(xhr.readyState==4){
			if(xhr.responseText=="//"){
				if(typeof(badscript)!="undefined" && badscript!="")eval(badscript);
			}else if(xhr.responseText=="[RELOAD]"){
					xhr.abort();
					window.location.reload();
			}else{
				if(typeof(callback)=="undefined" || callback=="")eval(xhr.responseText);else eval(callback+"('"+xhr.responseText+"');");
			}
		}
	}
	if(method=="POST")xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	xhr.send(data);
}

function __loadingAjax(height){
	return "<div style=\"width:100%; height:"+height+"px;\"><table border=0 width=100% height=100%><tr><td align=center valign=middle><img src=\"images/loading.gif\" /></td></tr></table></div>";
}

function changeMe(href,list){ajaxMe('GET',href+'&page=1&star='+list.value,true,ajaxPAGE(1),ajaxPAGE(0));}
