﻿//alert(getCookie("comeform"));
if(getCookie("comeform")==null){
    //第一次进入网站
    if(document.referrer==""){
     SetCookie ("comeform", "手动输入网站，首次访问页为");
    }else{SetCookie ("comeform", document.referrer)}
}
//alert(getCookie("comeform"));
//写cookies函数 作者：小柯
function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是值
{
    var Days = 30; //此 cookie 将被保存 30 天
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

// JScript 文件
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;
function initIt(){
    if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
       }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);
            if (whichEl.className == "child") whichEl.style.display = "none";
        }
    }
}

function initIt2(){
    if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("parent") != -1) whichEl.className = "parent";
       }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);  
            if (whichEl.className.indexOf("red") != -1) whichEl.className = 'parent'; 
            
        }
    }
}
function arrange() {
    nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}
function expandIt(el) { 
    //if (!ver4) return;
        initIt2(); 
    if (IE4) {
        whichEls = eval(el + "Child");
        
        if (whichEls.style.display == "none") {
            initIt();
            whichEls.style.display = "block";
        }
        else {
            whichEls.style.display = "none";
        }
        parent2=eval(el + "Parent");
        parent2.className='parent red';
 
    }
    else {
        whichEls = eval("document." + el + "Child");
        
        if (whichEls.visibility == "hide") {
            initIt();
            whichEls.visibility = "show";
        }
        else {
            whichEls.visibility = "hide";
        }
        arrange();
        parent2=eval("document." + el + "Parent");
        parent2.className='parent red';
    }

 
}
if (ver4) {
    with (document) {
        write("<STYLE TYPE='text/css'>");
        if (NS4) {
            write(".parent {position:absolute; visibility:visible; }");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        }
        else {
            write(".child {display:none}")
        }
        write("</STYLE>");
    }
}
