﻿var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var client_browse = "";
if(document.getElementById)
{client_browse="ie5";}	// IE5+,NN6+	document.getElementById("id")
else if(document.all)
{client_browse="ie4";}	// IE4	document.all("id");
else if(document.layers)
{client_browse="ns4";}	// NN4	document.layers["id"];
var imgs = new Array();
imgs[0] = "<img alt=\"\" src=\"images/wj.gif\" />";
imgs[1] = "<img alt=\"\" src=\"images/wj_1.gif\" />";
function get(strname)
{
	switch(client_browse){
		case "ie5":
			return document.getElementById(strname);
			break;
		case "ns4":
			return document.layers[strname];
			break;
		default:	//"ie4"
			return document.all(strname);
			break;
	}
}

function selectid(id)
{
	if(get(id).checked==true)
	{
		get("list_"+id).style.backgroundColor='#fdfdea';
		get("list_"+id).onmouseover='';
		get("list_"+id).onmouseout='';
	}else{
		get("list_"+id).style.backgroundColor='';
		get("list_"+id).onmouseover=new Function(" listover("+id+")");
		get("list_"+id).onmouseout=new Function(" listout("+id+")");
	}
}

function listover(id)
{
	get("list_"+id).style.backgroundColor='#fdfdea';
}
function listout(id)
{
	get("list_"+id).style.backgroundColor='#fff';
}

function  SelectAll()
{
	var checkBoxs=document.getElementsByName("form1s");

	if(document.getElementById("selectall").checked==true)
	{
		for(var  i=0;i<checkBoxs.length;i++)
		{                   
			checkBoxs[i].checked=true;   
			selectid(checkBoxs[i].id);   
		} 
	}else{
		for(var  i=0;i<checkBoxs.length;i++)
		{                   
			checkBoxs[i].checked=false;   
			selectid(checkBoxs[i].id);
		} 
	}
} 


function SelectAll_tp2()
{
	for(i=0;i<document.all.theForm.elements.length;i++)
	{
		if(document.all("selectall").checked == true)
		{
			document.all.theForm.elements[i].checked = true;					
		}else{
			document.all.theForm.elements[i].checked = false;
		}
	}
}
function sltAll()
{
	var checkBoxs=document.getElementsByName("form1s");
	for(var  i=0;i<checkBoxs.length;i++)
		{                   
			checkBoxs[i].checked=true;   
			selectid(checkBoxs[i].id);   
		} 
}
function sltNull()
{
	var checkBoxs=document.getElementsByName("form1s");
	for(var  i=0;i<checkBoxs.length;i++)
		{                   
			checkBoxs[i].checked=false;   
			selectid(checkBoxs[i].id);
		} 

}

function yz_login()
{
	if(document.Login.AdminName.value=="")
	{
		get("error").innerHTML = "帐号为必填项，请输入完整！";
		get("error").style.display = "block";
		get("error_1").style.display = "none";
		document.Login.AdminName.focus();
		return false;
	}
	if(document.Login.AdminWord.value == "")
	{
		get("error").innerHTML = "密码为必填项，请输入完整！";
		get("error_1").style.display = "none";
		get("error").style.display = "block";
		document.Login.AdminWord.focus();
		return false;
	}
	if (document.Login.GetCode.value==""){
      get("error").innerHTML = "验证码为必填，请输入完整！";
	  get("error_1").style.display = "none";
	  get("error").style.display = "block";
       document.Login.GetCode.focus();
       return(false);
    }
	else{
		get("error").style.display = "none";
		get("error_1").style.display = "none";
		/*if (typeof(opener)!="object") {
	window.open('about:blank', 'song', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no');
	opener=null;
	window.close();
	}*/
	return true;
		//document.Login.submit();}
}
function yz_add()
{
	if(document.getElementById('topic').value.length<1)
	{
		salert(2,'提示信息','标题不能为空!','确定');
		return false;
	}
	theForm.submit();
}

function yz_admin()
{
 	if(document.getElementById('username').value.length<1)
	{
		salert(2,'提示信息','帐号不能为空!','确定');
		return false;
	}
   if(document.getElementById('name_xm').value.length<1)
	{
		salert(2,'提示信息','姓名不能为空!','确定');
		return false;
	}
	 if(document.getElementById("pwd1").value==""||document.getElementById("pwd2").value=="")
    {
        salert(2,'提示信息','密码不能为空!','确定');
		return false;
    }
	 if(document.getElementById("pwd1").value.length<5)
    {
        salert(2,'提示信息','姓名不能少于5位!','确定');
       document.getElementById("pwd1").value="";
        document.getElementById("pwd2").value="";
        return false; 
    }
	
    if(document.getElementById("pwd1").value!=document.getElementById("pwd2").value)
    {	
		salert(2,'提示信息','两次密码不一致,请重新输入!','确定');
        document.getElementById("pwd1").value="";
        document.getElementById("pwd2").value="";
        return false;
    }
	else{
		theForm.submit();}
}


function yz_update()
{
	
	if(document.theForm_1.topic.value.length<1)
	{
		salert(2,'提示信息','标题不能为空!','确定');
		return false;
	}
	theForm_1.submit();
}
function yz_cate_add()
{
	
	if(document.theForm_2.topic.value.length<1)
	{
		salert(2,'提示信息','标题不能为空!','确定');
		return false;
	}
	theForm_2.submit();
}


function doRest()
{
	document.theForm.action="?act=rest";
	document.theForm.submit();
}

function dotop()
{
	document.theForm.action="?act=top";
	document.theForm.submit();
}
function dodynamic()
{
	document.theForm.action="?act=dynamic";
	document.theForm.submit();
}
function dostatic()
{
	document.theForm.action="?act=static";
	document.theForm.submit();
}
function domove(value)
{
	document.theForm.action="?act=move";
	document.theForm.submit();
}
//main 
var ua		= window.navigator.userAgent;
var opera	= /opera [56789]|opera\/[56789]/i.test(ua);
var ie		= !opera && /msie [56789]/i.test(ua);
var moz		= !opera && /mozilla\/[56789]/i.test(ua);
function changeWin(o){
	//alert(o);
	
	if(!ie) return false;
	if(parent.GuanFrame.cols != "0,*"){
		parent.GuanFrame.cols = "0,*";
		o.innerHTML = "<img alt=\"展开导航菜单\" src=\"templates/images/main/left_no.gif\" class=\"point\" />";
	}else{
		parent.GuanFrame.cols = "167,*";
		o.innerHTML = "<img alt=\"关闭导航菜单\" src=\"templates/images/main/left_yes.gif\" class=\"point\" />";
	}/**/
}


function menuDisplay(obj, n){
	for(i=1; i<=n; i++){
		get("li_" + i).style.display = "none";
	}
	get("li_" + obj).style.display = "block";

}

function putvalue(vart)
	{
		var value = vart;
		 value=value.split('∝');
		get('name').value=value[1];
		get('sort').value=value[2];
		
	}

