﻿function GetAjaxStr(strurl)
{
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open("Get",strurl,false);
	xmlhttp.send();
	var strret=unescape(xmlhttp.ResponseText);
	return strret;
}
var ReAjax = function()
{}
ReAjax.prototype.GetHttpRequest = function()
{
	var reObj="";
	if ( window.XMLHttpRequest ){
		reObj= new XMLHttpRequest() ;
	}
	else if ( window.ActiveXObject ){	
		try{
			reObj=new ActiveXObject("MsXml2.XmlHttp") ;
		}
		catch(e){
			reObj=new 	ActiveXObject("microsoft.XmlHttp")
		}
	}
	return reObj;
}

ReAjax.prototype.LoadUrl = function( urlToCall,altDiv)
{	
	var oReAjax = this ;
	var oAjaxHttp = this.GetHttpRequest() ;
	oAjaxHttp.open( "GET", urlToCall, true) ;
	oAjaxHttp.onreadystatechange=function()
	{
		if(oAjaxHttp.readyState==4)
		{
			var str=oAjaxHttp.responseText;
			document.getElementById(altDiv).style.display="none";
			document.getElementById(altDiv).innerHTML=str;
		}
	}
	oAjaxHttp.send( null ) ;
}
ReAjax.prototype.LoadUrl3 = function( urlToCall,altDiv)
{	
	var oReAjax = this ;
	var oAjaxHttp = this.GetHttpRequest() ;
	oAjaxHttp.open( "GET", urlToCall, true) ;
	oAjaxHttp.onreadystatechange=function()
	{
		if(oAjaxHttp.readyState==4)
		{
			var str=oAjaxHttp.responseText;
			document.getElementById(altDiv).innerHTML=str;
		}
	}
	oAjaxHttp.send( null ) ;
}
ReAjax.prototype.LoadUrl2 = function( urlToCall)
{	
	var oReAjax = this ;
	var oAjaxHttp = this.GetHttpRequest() ;
	oAjaxHttp.open( "GET", urlToCall, false) ;
	oAjaxHttp.onreadystatechange=function()
	{
		if(oAjaxHttp.readyState==4)
		{
			return oAjaxHttp.responseText;
		}
	}
	oAjaxHttp.send( null );
}
//function delcart(cid)
//{
//	var result=ReAjax.prototype.LoadUrl2('#thispath#include/menu.cfm?delteam='+cid);
//	document.location.reload();
//}
function changeCss(thisa)
{
	thisa.Class="";
}

//add by 2008-5-13
//IE FireFox兼容 innerText 属性
function isIE(){ //ie? 
if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
    return true; 
else 
    return false; 
} 

if(!isIE()){ //firefox innerText define
    HTMLElement.prototype.__defineGetter__("innerText", 
    function(){
        var anyString = "";
        var childS = this.childNodes;
        for(var i=0; i<childS.length; i++) {
            if(childS[i].nodeType==1)
                //anyString += childS[i].tagName=="BR" ? "\n" : childS[i].innerText;
                anyString += childS[i].innerText;
            else if(childS[i].nodeType==3)
                anyString += childS[i].nodeValue;
        }
        return anyString;
    } 
    ); 
    HTMLElement.prototype.__defineSetter__("innerText", 
    function(sText){
        this.textContent=sText; 
    } 
    ); 
}



function send_Pricerequest(url,obj) 
  {
	http_Pricerequest = false;
	
	if(window.XMLHttpRequest) 
	{ 
		http_Pricerequest = new XMLHttpRequest();
		if (http_Pricerequest.overrideMimeType) 
		{
			http_Pricerequest.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) 
	{ 
		try 
		{
			http_Pricerequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				http_Pricerequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) 
			{}
		}
	}
	if (!http_Pricerequest) 
	{ 
		return false;
	}
		http_Pricerequest.onreadystatechange = obj;
		
		
		http_Pricerequest.open("GET", url, true);
		http_Pricerequest.send(null);
}
  
  
  
  function GetPrice(str)
  //str 选择的游戏ID
  {
	send_Pricerequest("../include/ComparePrice.cfm?GameID="+str,ShowResult);
  }
  
  function ShowResult()
  {
  	  
	var rText="";
	if (http_Pricerequest.readyState == 4) 
	{
		
		if (http_Pricerequest.status == 200) 
		{
			
			rText=http_Pricerequest.responseText.replace(/^\s*/,"");
			document.getElementById("ShowDiv").innerHTML=rText;
		}	
	}
  }
  
  
  function getSerPriceInfo(GameID,SerID)
  {
  	//GameID 游戏ID  SerID 服务器ID
	if (SerID!="" && SerID!=0)
	{
		if (SerID!="")
		{
			send_Pricerequest("../include/ComparePrice.cfm?GameID="+GameID+"&SerID="+SerID,ShowResult);	
		}
	}
  }
