var Request = new Object();
var IsOldItem = new Object();
Request.send = function(url, method, callback, data) {
	var req;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.status < 400) {
				(method=="POST") ? callback(req) : callback(req,data);
			}
		}
	}

	if (method=="POST") {
		req.open("POST", url, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.send(data);
	} else {		
		req.open("GET", url, true);
		req.send(null);
	}
	return req;
}

Request.sendPOST = function(url, data, callback) {
	Request.send(url, "POST", callback, data);
}
Request.sendGET = function(url, callback, args) {	
	return Request.send(url, "GET", callback, args);
}
IsOldItem.itemlist='';
function webinitcallcack(response,data){
	IsOldItem.itemlist = ','+data;
	document.getElementById('avator_b2').innerHTML = response.responseText;
}
function itemlistcallcack(response,data){
	document.getElementById('dv_itemlist').innerHTML = response.responseText;
}
function pk1calback(response,data){
	if(response.responseText.length>0)
	{	try{
			eval(response.responseText);
		}
		catch(e){}
	}
}
function overbar(id){
	if(IsOldItem.itemlist.indexOf(id)!=-1){
		return;	
	}
	document.getElementById('avator_b2').innerHTML = 'loading...';
	Request.sendGET("avator_1.php?nocache="+Math.random()+"&id="+id, webinitcallcack,id);
}
function itemlist(id){
	document.getElementById('dv_itemlist').innerHTML = 'loading...';
	Request.sendGET("avator_2.php?nocache="+Math.random()+"&id="+id, itemlistcallcack,id);
}
function getpagelist(url){
	document.getElementById('dv_itemlist').innerHTML = 'loading...';
	Request.sendGET(url+"cache="+Math.random(), itemlistcallcack,"");
}
function setimgrib(src,id,layer){
	var obj=document.getElementById('manpane'+layer);
	while(src.indexOf("\\")!=-1) src = src.replace("\\","/");
	var bimg = 'Show/0/blank.gif';
	if(obj.attrib==id){
		if(obj.src.indexOf(src)!=-1){
			obj.src = bimg;
			obj.attrib=id;
		}else{
			obj.attrib=id;
			obj.src =src;
		}
	}else 
	{	obj.src=src;
		obj.attrib=id;
	}
	
}
