﻿// JScript 文件
   
function getHTML(hSerialNo,country,regiion,city)
{
    ServerAjax=new Ajax.Request(
    'ashx/bottomTrack.ashx',//需要请求的url
    {
     method:'get',//get 方式提交
     parameters:'t=t'+'&sno='+hSerialNo+'&country=&'+country+'&region='+regiion+'&city='+city,//要传递的参数
     onSuccess:UpdateFromInfo_callback,
     onError:function(ServerAjax){alert("error,HttpStatus:"+ServerAjax.status);}//调用发生错误执行
    } 
    );
} 

function getSerialNo()
{
    ServerAjax=new Ajax.Request(
    'ashx/IndexHTML.ashx',//需要请求的url
    {
     method:'get',//get 方式提交
     parameters:'type=2',
     onSuccess:UpdataFromInfo,
     onError:function(ServerAjax){alert("error,HttpStatus:"+ServerAjax.status);}//调用发生错误执行
    } 
    );
}    
function UpdataFromInfo()
{
      if(ServerAjax.transport.readyState == 4)
      {
         if(ServerAjax.transport.status == 200)
         {
            var hSerialNo=ServerAjax.transport.responseText;
             var city = "No Info";
        var regiion = "No Info";
        var country = "No Info";
        if(geoip_city() != "" && geoip_city() != null)
	        city = geoip_city();
        if(geoip_region_name() != "" && geoip_region_name() != null)
	        regiion = geoip_region_name();
			
        if(geoip_country_name() != "" && geoip_country_name() != null)
	        country = geoip_country_name();
		getHTML(hSerialNo,country,regiion,city);
         }
      } 
      //  var hSerialNo = document.getElementById("hidhSerialNo").value;
       
    
}	
function UpdateFromInfo_callback(res)
{
    var j = res.value;
    if(j != null){}
}
function loadScript(src, callback) {  
    var script = document.createElement("script");  
    if(script.addEventListener)  
    script.addEventListener("load", callback, false);  
    else if(script.attachEvent)  
        script.attachEvent("onreadystatechange",function() { loadScript.callbackIE(callback); });  
    script.src = src;  
    document.getElementsByTagName("head")[0].appendChild(script);  
}  
loadScript.callbackIE = function(callback) {  
    var target = window.event.srcElement;  
    if(target.readyState == "loaded")  
    callback.call(target);  
};  
callback = function() {  
    var self = this;  
    alert("Loaded: " + this.src + "\nListener.cleanUp (nested):" + Listener.cleanUp);  
};      

window.onload = function(){
    
	loadScript("http://j.maxmind.com/app/geoip.js",getSerialNo);
	if('undefined' != typeof Focus) 
	    new Focus(imgs,'focus_m');
    headTrack();//用户跟踪 
    correctPNG();		
	//focus.start();
}

function addBookmark(url, title) {  
    if (window.sidebar) {   
        window.sidebar.addPanel(title, url,"");   
    } else if (document.all) {  
        var external = window.external;  
        external.AddFavorite(url, title);  
    } else if (window.opera && window.print) {  
        return true;  
    }  
}  