﻿function switchmodTag(modtag,modcontent,modk){
    var id = rootID.split(',');
    for(i=0; i <id.length; i++) {
     		if(id[i] == 8)
     		{ 
     			break;
     		}
        if(id[i] != "")
        {
            if (id[i]==modk) {
                document.getElementById(modtag+id[i]).className="menuOn";
                if(modcontent != ""){
                   document.getElementById(modcontent+id[i]).className="slidingList";
                }
            }else if (id[i]==classID) {
                document.getElementById(modtag+id[i]).className="menuOn";
                if(modcontent != ""){
                   document.getElementById(modcontent+id[i]).className="slidingList";
                }
            }
			else {
                document.getElementById(modtag+id[i]).className="menuNo";
                if(modcontent != ""){
                   document.getElementById(modcontent+id[i]).className="slidingList_none";
                }
            }            
        }
    }
}
function ShowMenuOn()
{
    switchmodTag('root',"",classID);
}
function Search()
{
	var searchName = document.getElementById("searchName");
	if(searchName.value == "")
	{
		alert("请输入关键字");
		searchName.focus();
	}
	else
	{
    	window.location.href = "http://data.99pan.com/search?wd="+escape(searchName.value);
	}
}
function onEnter()
{
    if(event.keyCode == 13)
    {
        Search();
    }
}
function onEnterSubmitForm()
{
    if(event.keyCode == 13)
    {
        submitForm();
    }
}
function submitForm()
{
    var userName = document.getElementById("userName");
    var passWord = document.getElementById("passWord");        
    if(userName.value == "" && passWord.value != "")
	{
            alert("请输入99盘帐号!");
    }
    else if(userName.value != "" && passWord.value == "")
	{
		alert("请输入密码!");	
	}
	else if(userName.value == "" && passWord.value == "")	
	{
		window.location.href = "http://www.99pan.com/login.html";
	}
    else
	{           
        document.form1.action = "http://www.99pan.com/LoginManager/loginManager.aspx";
        document.form1.submit();
    }
}
function getCookie(name)
{
	var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	if(arr=document.cookie.match(reg)) return decodeURI(arr[2]);
	else return null;
}
function LoadSetHead()
{
	if(getCookie("loginName")!=null && getCookie("loginPass")!=null)
	{
		var content = "<div style=\"float:left; width:300px;\"><a href=\"index.html\"><img src=\"http://data.99pan.com/images/logo_1.png\" /></a></div><div style=\"float:right; padding-top:2px;\"><a href=\"http://www.99pan.com/Main\">"+getCookie("loginName")+"的网络硬盘</a> | <a href=\"http://www.99pan.com/forgetPassword.html\" target=\"_blank\">忘记密码</a> | <a href=\"http://www.99pan.com/help/help.html\" target=\"_blank\">帮助中心</a> | <a href=\"http://bbs.99pan.com\" target=\"_blank\">论坛</a> | <a href=\"javascript:\" onclick=\"if(confirm('您确定要安全退出吗？')==true)window.location.href='http://www.99pan.com/GlobalManager/Manager_99pan.aspx?action=exit';return false;\">退出</a></div><div style=\"float:right; height:40px; width:550px; padding-top:25px;\"><div class=\"searchDiv\"><input class=\"searchText\" id=\"searchName\" type=\"text\" onkeydown=\"onEnter()\" />&nbsp;<input type=\"button\"  class=\"search_1\" onclick=\"Search()\"/></div></div>";
		document.getElementById("head").innerHTML = content;
	}	
}
