﻿function XmlRequest()
{
    var request=null;
　　try{ 
　　if( window.ActiveXObject ){ 
　　for( var i = 5; i; i-- ){ 
　　try{ 
　　if( i == 2 ){ 
　　request = new ActiveXObject( "Microsoft.XMLHTTP" ); }
　　else{ 
　　request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" ); 
　　request.setRequestHeader("Content-Type","text/xml"); 
　　request.setRequestHeader("Charset","gb2312"); }
　　break;} 
　　catch(e){ 
　　request = false; } } }
　　else if( window.XMLHttpRequest )
　　{ request= new XMLHttpRequest(); 
　　if (request.overrideMimeType) 
　　{ request.overrideMimeType('text/xml'); } } }
　　catch(e){ request = false; } 
　　return request;

 }

function getOs()   
{   
   var OsObject = "";   
   if(navigator.userAgent.indexOf("MSIE")>0) {   
        return "MSIE";       //IE浏览器
   }
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){   
        return "Firefox";     //Firefox浏览器
   }
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) {   
        return "Safari";      //Safan浏览器
   }
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){   
        return "Camino";   //Camino浏览器
   }
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){   
        return "Gecko";    //Gecko浏览器
   }   
}

function LoadTopPage(PassHtml)
{
    L_xml = XmlRequest();
    var btype=getOs();
    L_xml.onreadyStateChange = (btype!="Firefox")?(LoadTopPageCallBack):(LoadTopPageCallBack());
    L_xml.open("GET", PassHtml, false);
    L_xml.send(null);
    L_xml.onreadyStateChange = (btype!="Firefox")?(LoadTopPageCallBack):(LoadTopPageCallBack());
}
function LoadTopPageCallBack()
{
    if (L_xml.readyState == 4)
    {
        if (L_xml.status == 200)
        {
            document.getElementById("mpDiv_Top").innerHTML = L_xml.responseText;
            document.getElementById("mpDiv_Top").style.display = "";
        }
    }
}

function GetShopCartNum()
{
    xml=XmlRequest();
    var Url = "/ajax/Ajax_GetCookies.Aspx?Action=1&Rnd="+Math.random();
    var btype=getOs();
    xml.onreadyStateChange = (btype!="Firefox")?(PostCallBack):(PostCallBack());
    xml.open("GET", Url, false);
    xml.send(null);
    xml.onreadyStateChange = (btype!="Firefox")?(PostCallBack):(PostCallBack());
}
function PostCallBack()
{ 
    if(xml.readyState==4)
    { 
        if(xml.status==200)
        {
            var ReturnText = xml.responseText;
            document.getElementById("gowuche").innerHTML="<b>"+ReturnText+"</b>";
        }
    }
    else
    {
        document.getElementById("gowuche").innerHTML="<b>Loading...</b>";
    }
}