/*
	itemstatlite 1.0
	http://code.google.com/p/itemstatlite
	
	merge ajax and overlib for WoW
	by T.G. (farmer1992@gmail.com)
	
	itemstatpath 为 itemstatlite 路径
	推荐绝对路径
*/
var itemstatpath="/itemstatlite/";

function oajax_makexmlHttp()
{
	var xmlHttp = false;
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e2) {
	    xmlHttp = false;
	  }
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
	  xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

function oajax_get(url){
	try	
	{
		xmlHttp=oajax_makexmlHttp();
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = function() {
		 if (xmlHttp.readyState == 4) {
    		var response = xmlHttp.responseText;
    		d=document.getElementById("overlib_ajax_div");
    		if(d)
    			d.innerHTML= response;
  		}	
		};
  	xmlHttp.send(null);
	}
	catch(e){}
}

function overlib_ajax_wow(item,therealm,thechar)
{
	
	var div="<div class=\"wowitem wowitemlive\" id=\"overlib_ajax_div\">Loading...</div>";
	overlib(div,VAUTO,HAUTO,FULLHTML);
	if((thechar=="undefined"&&therealm=="undefined"))
		oajax_get(encodeURI(itemstatpath+"getitem.php?item="+item));
	else
		oajax_get(encodeURI(itemstatpath+"getitem.php?item="+item+"&n="+thechar+"&r="+therealm));
}
