
var is = new Is();

function Is(){
        this.agent=navigator.userAgent.toLowerCase();
        this.opera = (this.agent.indexOf('opera')!=-1) ? true:false;
        this.ie4 = ((this.agent.indexOf('msie')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
        this.ns6 = ((this.agent.indexOf('gecko')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
        this.ns4 = ((this.agent.indexOf('mozilla')!=-1) && (this.agent.indexOf('opera')==-1) && (this.agent.indexOf('msie')==-1) && (this.agent.indexOf('gecko')==-1)) ? true:false;
}

/* menu */
var t=null;
var oni="";
var onj="";
var path="";
var hiding=false;
var pad_v=5;
var pad_h=10;

function GetWindowWidth(){
        return((is.ie4)? document.body.clientWidth: window.innerWidth);
}

function SetTimer(){
        StopTimer();
        t = setTimeout('HideMenu()', 500);
}

function StopTimer(){
        if(t!=null){
                clearTimeout(t);
                t=null;
        }
        return (true);
}

function HideMenu(){
        if(t!=null)
                StopTimer();
        if(oni!=""){
                if(onj!="")
                        DeSelect(oni,onj);
                if (path!=""){
                        arr1=path.split("_");
                        var tohide=arr1[0];
                        for (k=1;k<arr1.length;k++){
                                tohide=tohide+"_"+arr1[k];
                                HideNext(tohide);
                        }
                        document.getElementById("s"+arr1[0]).style.visibility='hidden';
                        path="";
                }
                else{
                        document.getElementById("s"+oni).style.visibility='hidden';
                }
                oni="";
        }
}

function ShowNext(elid){

}

function HideNext(id){
        if ((obj=document.getElementById("s"+id)) && !hiding){
                hiding=true;
                obj.style.visibility='hidden';
                if (path.search("_")){
                        arr=path.split("_");
                        arr.length=arr.length-1;
                        path=arr.join("_")
                }
                hiding=false;
        }
}

function ShowMenu(id){
        StopTimer();
        if(oni!=id) {
                HideMenu();
                var winwid=GetWindowWidth();
                var subwid=document.getElementById("t"+id).offsetWidth;
                var height2menu=document.getElementById("menu2").offsetTop+1;

                with (document.getElementById("m"+id)){
                        try{ style.cursor="pointer"; } catch (a){}
                        try{ style.cursor="hand"; } catch (a){}
                        var l = offsetLeft+offsetWidth-9;
                        var t = height2menu+offsetTop+5;
                        var w=offsetWidth;
                }
                with(document.getElementById("s"+id).style){
                        top=t-1;
                        left= l;
                        visibility="visible";
                        display="inline";
                }
                oni=id;
                onj="";
        }
}

function DeSelect(i,j){
        with(document.getElementById("t"+i+"_"+j).style){
                backgroundColor="#00448D";
        }
}

function HideSequence(first,last){
        rest=last.substr(first.length+1);
        var ar=rest.split("_");
        for(var k=0;k<ar.length;k++){
                first=first+"_"+ar[k];
                HideNext(first);
        }
}

function Select(i,j){
        if ((oni!="") && (onj!=""))
                DeSelect(oni,onj);
        with(document.getElementById("t"+i+"_"+j).style){
                try{ cursor="pointer"; } catch (a){}
                try{ cursor="hand"; } catch (a){}
                backgroundColor='#007CC3';
        }
        if (i==oni && j==onj)
                return "";
        oni=oni.toString();
        ar1=oni.split("_");
        ar2=i.split("_");
        if (ar1.length-ar2.length>0){
                HideSequence(i,path);
        }
        else if (oni==i && path!=oni && i+"_"+j!=path){
                HideNext(path);
        }
        onj=j;
        oni=i;
}

function Select_v(i){
        //alert("v"+i);
        with(document.getElementById("v"+i).style){
                try{ cursor="pointer"; } catch (a){}
                try{ cursor="hand"; } catch (a){}
                backgroundColor='#007CC3';
        }


        /*if ((oni!="") && (onj!=""))
                DeSelect_v(oni,onj);
        with(document.getElementById("v"+i+"_"+j).style){
                try{ cursor="pointer"; } catch (a){}
                try{ cursor="hand"; } catch (a){}
                backgroundColor='#007CC3';
        }
        if (i==oni && j==onj)
                return "";
        oni=oni.toString();
        ar1=oni.split("_");
        ar2=i.split("_");
        if (ar1.length-ar2.length>0){
                HideSequence(i,path);
        }
        else if (oni==i && path!=oni && i+"_"+j!=path){
                HideNext(path);
        }
        onj=j;
        oni=i;*/
}

function DeSelect_v(i){
        with(document.getElementById("v"+i).style){
                backgroundColor="#00448D";
        }
}

function GoTo(url){
        if (url!=''){
                window.location=url;
        }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

