
// JScript 文件     通用功能
function readCookie(name) 
{
    var cookieValue = "";
    var search = name + "=";
    if(document.cookie.length > 0) { 
        offset = document.cookie.indexOf(search);
        if (offset != -1) { 
        offset += search.length;
        end = document.cookie.indexOf(";", offset);
        if (end == -1) end = document.cookie.length;
            cookieValue = unescape(document.cookie.substring(offset, end));
         }
    }
    return cookieValue;
}
function writeCookie(name, value, hours) 
{
    var expire = "";
    if(hours != null) 
    {
        expire = new Date((new Date()).getTime() + hours * 3600000);
        expire = "; expires=" + expire.toGMTString();
    }
    document.cookie = name + "=" + escape(value) + expire + ";domain=xkb123.com";
}
            
function writeColor(colorType){
	writeCookie(colorCookie ,colorType,24*365);
	document.getElementById("link").href="/styles/" + colorType + "/channel.css";
}

function readColor(){
	return readCookie(colorCookie);
}
function flash(nsrc,nwi,nhei) {
	var fhtml = ''
	fhtml = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+nwi+'" height="'+nhei+'">';
	fhtml = fhtml + '<param name="movie" value="'+nsrc+'">';
	fhtml = fhtml + '<param name="quality" value="high">';
	fhtml = fhtml + '<embed src="'+nsrc+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+nwi+'" height="'+nhei+'"></embed>';
	fhtml = fhtml + '</object>';
	document.write(fhtml)
}
function autoHidden(name)
{
    try
    {
    obj=document.getElementById(name);
    var text=obj.innerHTML;
    obj.innerHTML=text.replace("{%"+name+"%}","");

    if(text.length<1)
    obj.style.display="none";
    }
    catch(ex)
    {}
}
function getUrl(url)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequest = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequest)
    {
        httpRequest.open('POST', url, false);//true为异步
        httpRequest.send("");
        return httpRequest.responseText;
    }
    return "";
 }
function getUrl2(url,funcName)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequest2 = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequest2 = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequest2)
    {
        httpRequest2.open('POST', url, true);//true为异步
        httpRequest2.onreadystatechange=funcName;
        httpRequest2.send("");
    }
 }
var httpRequest3=null;
function getUrl3(url,funcName)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequest3 = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequest3 = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequest3)
    {
        httpRequest3.open('POST', url, true);//true为异步
        httpRequest3.onreadystatechange=funcName;
        httpRequest3.send('');
    }
}
var httpRequest4=null;
function getUrl4(url,funcName)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequest4 = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequest4 = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequest4)
    {
        httpRequest4.open('POST', url, true);//true为异步
        httpRequest4.onreadystatechange=funcName;
        httpRequest4.send('');
    }
}
    
var httpRequestLogin=null;
function getUrlLogin(url,funcName)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequestLogin = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequestLogin = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequestLogin)
    {
        httpRequestLogin.open('POST', url, true);//true为异步
        httpRequestLogin.onreadystatechange=funcName;
        httpRequestLogin.send('');
    }
}
var httpRequestPost=null;
function getUrl8(url,sPara,funcName)
{
    if (typeof XMLHttpRequest != 'undefined')
    {
        httpRequestPost = new XMLHttpRequest();
    }
    else if (typeof ActiveXObject != 'undefined')
    {
        httpRequestPost = new ActiveXObject('Microsoft.XMLHTTP');
    }
    if (httpRequestPost)
    {
        httpRequestPost.open('POST', url, true);//true为异步
        httpRequestPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        httpRequestPost.onreadystatechange=funcName;
        httpRequestPost.send(sPara);
    }
}
String.prototype.trim  =  function()
{
    //  用正则表达式将前后空格
    //  用空字符串替代。
    return  this.replace(/(^\s*)|(\s*$)/g,  "");
}

function strlen(str)    
{    
    var i;    
    var len;    
        
    len = 0;    
    for (i=0;i<str.length;i++)    
    {    
        if (str.charCodeAt(i)>255) len+=2; else len++;    
    }    
    return len;    
}    

function showspdiv(n)
{
    var o1=document.getElementById("spop"+n);
    var o2=document.getElementById("splst"+n);
    if(o1.innerHTML.toLowerCase().indexOf("up.gif")>0)
    {
        o1.innerHTML="<img src='/images/down.gif' alt='' />";        
        o2.style.display="none";
    }
    else    
    {
        o1.innerHTML="<img src='/images/up.gif' alt='' />";
        o2.style.display="";
    }

}

function processQuickNavi()
{
    try
    {
        var obj=document.getElementById("srctypediv");
        obj.innerHTML=obj.innerHTML.replace(/技术/g,"");
    }
    catch(ex)
    {}
    try
    {
        var obj=document.getElementById("gradelistdiv");
        obj.innerHTML=obj.innerHTML.replace(/技术/g,"");
    }
    catch(ex)
    {}
    try
    {
        var obj=document.getElementById("navi_version");
        obj.innerHTML=obj.innerHTML.replace(/版/g,"");
    }
    catch(ex)
    {}
    try
    {
        var obj=document.getElementById("navi_module");
        var otext=obj.innerHTML;
        otext=otext.replace(/　/g," ");
        otext=otext.replace(/—/g,"-");
        otext=otext.replace(/－/g,"-");
        otext=otext.replace(/模块/g,"");
        otext=otext.replace(/系列/g,"");
        otext=otext.replace(/版/g,"");
        otext=otext.replace(/（/g,"(");
        otext=otext.replace(/）/g,")");

        otext=otext.replace(/\(高中\)/g,"");
        otext=otext.replace(/\(初中\)/g,"");
        otext=otext.replace(/语文/g,"");
        otext=otext.replace(/数学/g,"");
        otext=otext.replace(/外语/g,"");
        otext=otext.replace(/英语/g,"");
        otext=otext.replace(/物理/g,"");
        //otext=otext.replace(/化学/g,"");
        otext=otext.replace(/生物/g,"");
        otext=otext.replace(/政治/g,"");
        otext=otext.replace(/历史/g,"");
        otext=otext.replace(/地理/g,"");
        otext=otext.replace(/音乐/g,"");
        otext=otext.replace(/美术/g,"");
        otext=otext.replace(/体育/g,"");
        otext=otext.replace(/信息/g,"");
        otext=otext.replace(/信息技术/g,"");
        otext=otext.replace(/通用/g,"");
        otext=otext.replace(/通用技术/g,"");
        otext=otext.replace(/综合/g,"");
        otext=otext.replace(/文科综合/g,"");
        otext=otext.replace(/文综/g,"");
        otext=otext.replace(/理科综合/g,"");
        otext=otext.replace(/理综/g,"");
        otext=otext.replace(/心理/g,"");
        obj.innerHTML=otext.replace(/心理健康/g,"");
    }
    catch(ex)
    {}
}