/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);

//Menu
	var isIE = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
	var GO = function(elemId){
		if(document.getElementById){
			return document.getElementById(elemId);
		}else if(document.layers){
			document.layers[elemId];
		}else{
			return eval('document.all.' + elemId);
		}
	}

	function Menu(mid,idx){
		GO("m_"+mid+"_"+idx).className = "activeq";
		GO("c_"+mid+"_"+idx).style.display = "block";
		
		for(var i=0;i<5;i++)
		{
			if(!GO("m_"+mid+"_"+i)) break;
			if(i != idx)
			{
				GO("m_"+mid+"_"+i).className = "activeq1";
				GO("c_"+mid+"_"+i).style.display = "none";
			}
		}
	}
	
//---------检查字符长度及合法性------------
function checkLength(strFieldName,strLabel,strMinLen,strMaxLen,strExcludedStr)
{	
	var thisField = document.getElementsByName(strFieldName);
	var fieldValue;
	for(var i=0;i<thisField.length;i++)
	{
		fieldValue = trim(thisField[i].value);
		if(strMinLen==1 && fieldValue.length<strMinLen)	
		{
			alert("<"+strLabel+">必须填写！")
			if( isElementVisible( thisField[i] ) )	
				thisField[i].focus();
			return false;
		}	
		if(fieldValue.length<strMinLen)
		{
			alert("<"+strLabel+">至少输入 "+strMinLen+" 个字符。");
			if( isElementVisible( thisField[i] ) )	
				thisField[i].focus();
			return (false);
		}
		if(fieldValue.length>strMaxLen)	
		{
			alert("<"+strLabel+">至多输入 "+strMaxLen+" 个字符。");
			if( isElementVisible( thisField[i] ) )
				thisField[i].focus();
			return (false);
		}
		if(typeof(strExcludedStr)!="undefined")	
		{
			if( !isAvailString(fieldValue,strExcludedStr))
			{
				if(strExcludedStr.charAt(0)!="^")
					alert("<"+strLabel+">不能含有如下任一字符：\n\n\t" + strExcludedStr);
				else
					alert("<"+strLabel+">只能含有如下任一字符：\n\n\t" + strExcludedStr.substring(1,strExcludedStr.length));
				if( isElementVisible( thisField[i] ) )
					thisField[i].focus();
				return (false);				
			}	
		}
		else
		{
			if(!isAvailString(fieldValue))
			{
				alert("<"+strLabel+">不能含有如下任一字符：\n\n\t" + constExcluedStr);
				if( isElementVisible( thisField[i] ) )
					thisField[i].focus();
				return (false);				
			}	
		}			
	}
	return (true);
}