﻿/**
*导航条的构造,需要绑定到onload
*/
startList = function() 
{
    if (document.all&&document.getElementById) 
    {
        dropmenuRoot = document.getElementById("dropmenu");
        for (i=0; i<dropmenuRoot.childNodes.length; i++) 
        {
            node = dropmenuRoot.childNodes[i];
            if (node.nodeName=="LI") 
            {
                node.onmouseover=function() 
                {
                    this.className+=" over";
                    //开始
                    for(j=0;j<this.childNodes.length;j++)
                    {
                        if (this.childNodes[j].nodeName=="ul")
                        {
                            if (this.childNodes[j].childNodes[0].nodeName=="li")
                            {
                                if (this.offsetLeft+this.childNodes[j].childNodes.length*this.childNodes[j].childNodes[0].offsetWidth-dropmenuRoot.offsetLeft>dropmenuRoot.offsetWidth)
                                {
                                    var len=this.childNodes[j].childNodes.length*this.childNodes[j].childNodes[0].offsetWidth; //菜单的长度
                                    (len>dropmenuRoot.offsetWidth) ? this.childNodes[j].style.width=997+ 'px' : this.childNodes[j].style.width=len+ 'px'; //给ul设置宽度 如果子菜单比较多，大于容器的宽度，那么ul的宽度就是容器的宽度                        
                                    len =this.offsetLeft+len-dropmenuRoot.offsetLeft-dropmenuRoot.offsetWidth;
                                    (len>this.offsetLeft-dropmenuRoot.offsetLeft) ? this.childNodes[j].style.marginLeft=-(this.offsetLeft-dropmenuRoot.offsetLeft)+ 'px': this.childNodes[j].style.marginLeft=-len+ 'px';
                                } 
                            }
                        }
                    }
                }
                //完毕
                node.onmouseout=function() 
                {
                    this.className=this.className.replace(" over", "");
                }
            }
        }
    }
}

//网站页眉的提示
step=0
function flash_title()
{
    step++
    if (step==3) {step=1}
    if (step==1) {document.title="欢迎访问四川省遥感信息测绘院"}
    if (step==2) {step=1}
    //if (step==2) {document.title="打造行业优秀网站!"}
    setTimeout("flash_title()",3000);
}
flash_title()

window.onload = function ()
{
    startList();
    window.status="欢迎访问本站!";
}



