// JavaScript Document
<!--
var lastScript;
var clickposturl = 'http://jump.cnnic.cn/stat/stat?';//jump.cnnic.cn
var xmlurl = 'http://client.jogo.cn/portal/corpid/';

function ScriptPost(url){
    var localhead = document.getElementsByTagName("head")[0];
    if (!lastScript) 
        lastScript = document.getElementById('cnnicpost');
    
    if (lastScript) {
        lastScript.parentNode.removeChild(lastScript);
    }
    lastScript = document.createElement("script");
    lastScript.id = 'cnnicpost';
    lastScript.type = "text/javascript";
    lastScript.src = url;
    localhead.appendChild(lastScript);
}


function isempty(str){
    return ((trim(str).length == 0) || (str == null));
}

function getparastr(strname){
    var hrefstr, pos, parastr, para, tempstr;
    hrefstr = window.location.href;
    pos = hrefstr.indexOf("?")
    parastr = hrefstr.substring(pos + 1);
    para = parastr.split("&");
    tempstr = "";
    for (i = 0; i < para.length; i++) {
        tempstr = para[i];
        pos = tempstr.indexOf("=");
        if (tempstr.substring(0, pos) == strname) {
            return tempstr.substring(pos + 1);
        }
    }
    return null;
}


function AddMaxthonSearch(pid, posturl){
    var searchurl;
    ScriptPost(posturl);
    try {
        searchurl = 'http://name.cnnic.cn/cn.dll?name=%s&pid=' + pid;
        window.external.m2_addSearchEngine('通用网址 网站直达', searchurl);
    } 
    catch (e) {
    }
}

function AddIESearch(pid, posturl){
    var searchurl;
    searchurl = xmlurl + pid + '.xml';
    ScriptPost(posturl);
    window.external.AddSearchProvider(searchurl);
}

function AddFirefoxSearch(pid, posturl){
    var searchurl;
    ScriptPost(posturl);
    
    
    if (window.external && window.external.AddSearchProvider) {
        searchurl = xmlurl + pid + '.xml';
        window.external.AddSearchProvider(searchurl);
    }
    
    else 
        if (window.sidebar && window.sidebar.addSearchEngine) {
            searchurl = xmlurl + pid + '.src';
            var imageurl = xmlurl + pid + '.gif';
            window.sidebar.addSearchEngine(searchurl, imageurl, /* icon URL */ "Internet Keyword", /* engine name */ "Internet Keyword"); /* category name */
        }
        
        else {
            searchurl = xmlurl + pid + '.xml';
            window.external.AddSearchProvider(searchurl);
        }
    
    //favicon.ico
}



//****************************************************


function WriteProvider(type){
    var szpid = getparastr('pid');
    if (szpid == null) 
        szpid = 'tJ4BYX70531PsmPb';
    SetProvider('mainbule', szpid, type);
}

//****************************************************
function SetLinkProvider(css, pid, type){

    var posturl = clickposturl + 'sid=1203&pid=' + pid;
    
    if (type == 1) {
        document.write("<a href=\"javascript:AddIESearch('");
        document.write(pid);
        document.write("','");
        document.write(posturl);
        document.write("');\">");
    }
    
    else 
        if (type == 2) {
            document.write("<a href=\"javascript:AddMaxthonSearch('");
            document.write(pid);
            document.write("','");
            document.write(posturl);
            document.write("');\">");
        }
        
        else 
            if (type == 3) {
                document.write("<a href=\"javascript:AddFirefoxSearch('");
                document.write(pid);
                document.write("','");
                document.write(posturl);
                document.write("');\">");
                
            }
}


function WriteLinkProvider(type){
    var szpid = getparastr('pid');
    if (szpid == null) 
        szpid = 'tJ4BYX70531PsmPb';
    SetLinkProvider('mainbule', szpid, type);
}


//**********************************************************************


function SetCnnicSearchProvider2(css, pid, imagepath, hint){
    var browserName = navigator.appName;
    var b_version = navigator.appVersion;
    var version = b_version.split(";");
    var trim_version = version[1].replace(/[ ]/g, "");
    
    //   var searchurl; 
    var posturl = clickposturl + 'sid=1201&pid=' + pid;
    
    
    if (browserName == "Microsoft Internet Explorer") {
        if ((trim_version == "MSIE7.0")) {
            document.write("<p align='center'>");
            SetLinkProvider(css, pid, 1);
            if (imagepath != null) {
                document.write("<img src='");
                document.write(imagepath);
                document.write("ie7.gif");
                document.write("' border='0'><br>");
            }
            document.write("<span class='");
            document.write(css);
            document.write("'>在IE7中");
            document.write(hint);
            document.write("</span></p>");
        }
        else if((trim_version == "MSIE8.0"))
        {
        	document.write("<p align='center'>");
            SetLinkProvider(css, pid, 1);
            if (imagepath != null) {
                document.write("<img src='");
                document.write(imagepath);
                document.write("ie8.gif");
                document.write("' border='0'><br>");
            }
            document.write("<span class='");
            document.write(css);
            document.write("'>在IE8中");
            document.write(hint);
            document.write("</span></p>");
        }
        
        try {
        
            if (window.external && window.external.max_version) {
            
                document.write("<p align='center'>");
                SetLinkProvider(css, pid, 2);
                
                if (imagepath != null) {
                    document.write("<img src='");
                    document.write(imagepath);
                    document.write("ma.gif");
                    document.write("' border='0'><br>");
                }
                
                document.write("<span class='");
                document.write(css);
                document.write("'>在遨游中");
                document.write(hint);
                document.write("</span></p>");
            }
            
        } 
        
        catch (e) {
        }
        
        
    }
    
    else 
        if (navigator.userAgent.indexOf("Firefox") > 0) {
            document.write("<p align='center'>");
            SetLinkProvider(css, pid, 3);
            if (imagepath != null) {
                document.write("<img src='");
                document.write(imagepath);
                document.write("ff.gif");
                document.write("' border='0'>");
            }
            document.write("<span class='");
            document.write(css);
            document.write("'>在firefox中");
            document.write(hint);
            document.write("</span></p>");
        }
    
}

function SetSearchProvider2(pid, imagepath, hint){
    if (hint == null) 
        hint = "添加通用网址";
    SetCnnicSearchProvider2('cnnic', pid, imagepath, hint);
}


function SetCnnicSearchProvider(css, pid){
    SetCnnicSearchProvider2(css, pid, null, "<strong>抗震救灾</strong>直击现场");
}

function SetSearchProvider(pid){
    SetCnnicSearchProvider('cnnic', pid);
}




function OnloadPost(){
    var szpid = getparastr('pid');
    var posturl = clickposturl + 'sid=1202&pid=' + szpid;
    
    ScriptPost(posturl);
}


//-->

