											
											///////////////////////////////////////////////////////////////////////////////////////
											///////////////////////////////////////////////////////////////////////////////////////
											//////////
											//////////   文 件 名：HtmCtlScript.js
											//////////
											//////////   文件说明：客户端页面控制
											//////////
											///////////////////////////////////////////////////////////////////////////////////////
											///////////////////////////////////////////////////////////////////////////////////////


//----------------------------------------------------------------------------------
//方 法 名：LeftMenuChangHeadBGColor()
//方法说明：窗体中左边栏目加载时如果有选中的项,修改此项的背景颜色
//----------------------------------------------------------------------------------
function LeftMenuChangHeadBGColor(strLMHeadItemNo)
{
	/*
		参  数：strLMHeadItemNo -- 当前选中项的号码
		返回值：
	*/
	
	window.document.all("tdLMHead_" + strLMHeadItemNo).bgColor = "#eeeeee";
}

//----------------------------------------------------------------------------------
//方 法 名：SetLinkStyle()
//方法说明：设置选中的超链接的样式
//----------------------------------------------------------------------------------
function SetLinkStyle(strPCID)
{
	/*
		参  数：strPCID -- 当前超链接的ID，使用此ID修改字体及背景
		返回值：
	*/

	//window.document.all("tdPCID_" + strPCID,"0").bgColor = "#cccccc";
	window.document.all("tdPCID_" + strPCID).style.color      = "#e77919";
	window.document.all("tdPCID_" + strPCID).style.fontWeight = "bold";
}

//----------------------------------------------------------------------------------
//方 法 名：LeftMenuLoad()
//方法说明：产品部分窗体中左边栏目加载
//----------------------------------------------------------------------------------
function LeftMenuLoad(strTdID,strPCID)
{
	/*
		参  数：strTdID -- 当前展开的Td的ID
			  ：strPCID -- 当前超链接的ID，使用此ID修改字体及背景
		返回值：
	*/

	var strTmp = "";
	
	strProductLeftMenuPCID = strPCID;
	
	//window.document.all(strTdID,"0").style.display = "";
	window.document.all(strTdID).style.display = "";

	strTmp = strTdID.substr(strTdID.length - 1,strTdID.length);
	//设置选中的二级菜单的字体颜色
	//window.document.all(strTdID,"0").style.color = "da4d00";
	//window.document.all(strTdID,"0").style.color = "red";

	LeftMenuChangHeadBGColor(strTmp);
	
	//if(window.document.all("tdPCID_" + strPCID,"0") != null)
	if(window.document.all("tdPCID_" + strPCID) != null)
	{
		SetLinkStyle(strPCID);
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickControlLeftMenu()
//方法说明：控制页面中左边栏目的显示和隐藏效果，并且设置选中项的背景色
//----------------------------------------------------------------------------------
function OnClickControlLeftMenu(strTdID,strNum,strLMHeadID)
{
	/*
		参  数：strTdID -- 当前选中的ID
		      ：strNum  -- 当前选中为某个td的号码
		      ：strLMHeadID -- 每个菜单头的ID（例如：DVB系列产品,安防系列产品）,此ID控制每个选中菜单的背景颜色
		返回值：
	*/

	var intCount = strNum;
	
	for(var i = 0; i < intCount; i++)
	{
		if(("tdLeftMenu_" + i) != strTdID)
		{
			//window.document.all("tdLeftMenu_" + i,"0").style.display = "none";
			window.document.all("tdLeftMenu_" + i).style.display = "none";
		}
		//设置非选中项的每个背景为空
		if(("tdLMHead_" + i) != strLMHeadID)
		{
			//window.document.all("tdLMHead_" + i,"0").bgColor = "#ffffff";
			window.document.all("tdLMHead_" + i).bgColor = "#ffffff";
		}
	}
	
	//此处控制菜单可以全部隐藏
	//if(window.document.all(strTdID,"0").style.display == "")
	if(window.document.all(strTdID).style.display == "")
	{
		//window.document.all(strTdID,"0").style.display = "none";
		//window.document.all(strLMHeadID,"0").bgColor   = "#ffffff";
		window.document.all(strTdID).style.display = "none";
		window.document.all(strLMHeadID).bgColor   = "#ffffff";
	}
	else
	{
		//window.document.all(strTdID,"0").style.display = "";
		//window.document.all(strLMHeadID,"0").bgColor   = "#f6f6f6";
		window.document.all(strTdID).style.display = "";
		window.document.all(strLMHeadID).bgColor   = "#eeeeee";
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnLoadChangeChooseItemColor()
//方法说明：控制招聘部分左边栏目中选中项的背景颜色
//----------------------------------------------------------------------------------
function OnLoadChangeChooseItemColor(strLMHeadID,strlinkJobID)
{
	/*
		参  数：strLMHeadID  -- 选中项的ID
		      ：strlinkJobID -- 超链接的ID
		返回值：
	*/

	window.document.all(strlinkJobID).style.color      = "#e77919";
	window.document.all(strlinkJobID).style.fontWeight = "bold";	
	window.document.all(strLMHeadID).bgColor   = "#fafafa";
}

//----------------------------------------------------------------------------------
//方 法 名：OnKeyDownSumbit()
//方法说明：提交站点查询
//----------------------------------------------------------------------------------
function OnKeyDownSumbit()
{
	/*
		参  数：
		返回值：
	*/
	
	if(event.keyCode == "13")
	{
		OnClickSearchSite('txtSearch');
		return;
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickClear()
//方法说明：清除文本框中的评论内容
//----------------------------------------------------------------------------------
function OnClickClear(strTxtID)
{
	/*
		参  数：strTxtID -- 评论内容文本框的ID
		返回值：
	*/

	window.document.all(strTxtID).value = "";
	OnKeyupCharCount(strTxtID);
}

//----------------------------------------------------------------------------------
//方 法 名：OnChangeCharCount()
//方法说明：当文本框中的内容改变的时候修改剩余的字数
//----------------------------------------------------------------------------------
function OnKeyupCharCount(strTxtID)
{
	/*
		参  数：strTxtID -- 评论内容文本框的ID
		返回值：
	*/
	
	var intCharCount  = 0;
	var strCommentTxt = window.document.all(strTxtID).value;
	
	intCharCount = 1000 - strCommentTxt.length;
	if(intCharCount >= 0)
	{
		window.document.all("spanCharCount").innerHTML = intCharCount;
	}
	//如果多余1000个字符只在文本框中显示1000个字符
	if(intCharCount < 1)
	{
		window.document.all(strTxtID).value = strCommentTxt.substr(0,1000);
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnChangeCharCount()
//方法说明：提交评论内容
//----------------------------------------------------------------------------------
function OnClickCommentSubmit(strArticleID)
{
	/*
		参  数：strArticleID -- 当前要评论的新闻的ID
		返回值：
	*/
	
	var blnSubmit   = true;
	var strUserName = window.document.all("txtUserName").value;
	var strCommnet  = window.document.all("txtCommentText").value;
	var arrReg      = new Array("nnd","md","tmd","妈","操","死","滚");        //正则表达式要查找的不文明用语
	
	if(strCommnet != "")
	{
		strCommnet = strCommnet.toLowerCase();
		//验证是否有不文明用语
		for(var i = 0; i < arrReg.length; i++)
		{
			if(strCommnet.indexOf(arrReg[i]) != -1)
			{
				blnSubmit = false;
				alert("对不起！你有不文明用语，不能提交！");
				return;
			}
		}
		
		strUserName = window.document.all("txtUserName").value;          //重新获取文本框中的数据
		
		if(blnSubmit)
		{
			var oXmlHttp,strResponseText,DataToSend;
			
			oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP"); 
			oXmlHttp.open("POST","/UserControl/News/CommentSave.aspx",false);
			DataToSend  = "UserName=" + escape(strUserName);
			DataToSend += "&Commnet="+ escape(strCommnet) +"";
			DataToSend += "&ArticleID="+ escape(strArticleID) +"";
			oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			oXmlHttp.send(DataToSend);
			strResponseText = oXmlHttp.ResponseText.replace(/^(<!--)([^(-->)]*)|^(-->)|^\s+|\s+$/gim,"");
			delete oXmlHttp;
			
			alert("评论内容已经保存！");
		}
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickCommentView()
//方法说明：显示/隐藏评论内容
//----------------------------------------------------------------------------------
function OnClickCommentView()
{
	/*
		参  数：
		返回值：
	*/
	
	if(window.document.all("trCommentContent").style.display == "none")
	{
		window.document.all("trCommentContent").style.display = "";
		window.document.all("tdViewComment").innerHTML        = "<b>隐藏评论</b>";
	}
	else
	{
		window.document.all("trCommentContent").style.display = "none";
		window.document.all("tdViewComment").innerHTML        = "<b>查看评论</b>";
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickShowNewWinMoudle()
//方法说明：显示一个模式窗口
//----------------------------------------------------------------------------------
function OnClickShowNewWinMoudle(strURL,strWidth,strHeight)
{
	/*
		参  数：strURL    -- 要打开窗口的路径及参数
			  ：strWidth  -- 窗口的宽度
			  ：strHeight -- 窗口的高度
		返回值：
	*/

	var blnResult;
	
	blnResult = window.showModalDialog(strURL,"","dialogHeight:"+ strHeight +"px;dialogWidth:"+ strWidth +"px");
	//window.open(strURL);

	if(blnResult)
	{
		//alert("操作成功！");
		window.location.href = window.location.href;
	}
	else
	{
		//alert("操作中出现问题！");
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickCloseWin()
//方法说明：关闭窗口
//----------------------------------------------------------------------------------
function OnClickCloseWin()
{
	/*
		参  数：
		返回值：
	*/
	
	window.close();
}

//----------------------------------------------------------------------------------
//方 法 名：GetYears()
//方法说明：返回下拉菜单中使用的年份
//----------------------------------------------------------------------------------
function GetYears(strCur)
{
	/*
		参  数：strCur -- 返回年份的中间值
		返回值：
	*/
	
	var strYear;
	var oDate;
	var oOpt;
	
	//如果有小于1900的年份则下拉菜单不能使用
	if(strCur != "" && strCur < 1900)
	{
		window.document.all("optYear").disabled = true;
	}
	
	//删除原有的记录
	if(window.document.all("optYear").length > 0)
	{
		for(var i = 0; i < window.document.all("optYear").length; i++)
		{
			window.document.all("optYear").remove(i);
			i--;
		}
	}
	
	oDate = new Date();
	
	if(strCur.toString() == "")
	{
		strYear = oDate.getYear();
	}
	else
	{
		strYear = strCur;
	}
	
	//-----------------------------------------------------------------------------
	//当前年份之前
	strYear = strYear - 6;
	for(var i = 0; i < 5; i++)
	{
		strYear = parseInt(strYear) + 1;
		oOpt = new Option();
		oOpt.text  = strYear;
		oOpt.value = strYear;
		
		window.document.all("optYear").add(oOpt);
	}
	//-----------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------
	//当前年份
	//strYear = oDate.getYear();
	if(strCur.toString() == "")
	{
		strYear = oDate.getYear();
	}
	else
	{
		strYear = strCur;
	}
	oOpt = new Option();
	oOpt.text  = strYear;
	oOpt.value = strYear;

	window.document.all("optYear").add(oOpt);
	//-----------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------
	//当前年份之后
	for(var j = 1; j < 11; j++)
	{
		strYear = parseInt(strYear) + 1;
		oOpt = new Option();
		oOpt.text  = strYear;
		oOpt.value = strYear;
		
		window.document.all("optYear").add(oOpt);
	}
	//-----------------------------------------------------------------------------
	
	if(strCur.toString() == "")
	{
		strYear = oDate.getYear();
	}
	else
	{
		strYear = strCur;
	}
	for(var i = 0; i < window.document.all("optYear").length; i++)
	{
		if(window.document.all("optYear").options[i].value.toString() == strYear.toString())
		{
			window.document.all("optYear").options[i].selected = true;
		}
	}
}









//=================================================================================================================================================================
//-----------------------------------------------------------------
//树型菜单的全局变量
var g_strLevelID = "";
var g_strSpanID  = "";
//-----------------------------------------------------------------

//前台页面中多级别树型菜单控制
//----------------------------------------------------------------------------------
//方 法 名：OnClickMoreLeftMenu()
//方法说明：超过3级的菜单显示和隐藏控制（暂时没有使用）
//----------------------------------------------------------------------------------
function OnClickMoreLeftMenu(strTDID,strCount,strLevelCount,strCurMenu)
{
	/*
		参  数：strTDID  -- 当前选中的ID
		      ：strCount -- 此栏目下共有多少个子项
		      ：strLevelCount
		      ：strCurMenu
		返回值：
	*/

	for(var i = 0; i < strCount; i++)
	{
		var strTmp = "tabMoreLeftMenuID_" + strLevelCount + "_" + strCurMenu + "_" + i;
		alert(strTmp);
		window.document.all(strTmp,"0").style.display = "";
	}
	
	return;
	//此处控制菜单可以全部隐藏
	if(window.document.all(strTDID,"0").style.display == "")
	{
		window.document.all(strTDID,"0").style.display = "none";
	}
	else
	{
		window.document.all(strTDID,"0").style.display = "";
	}
}

//产品大类页面标题点击后颜色不变
//----------------------------------------------------------------------------------

 function   changebg(obj)   
  {   
  var   utable   =   document.getElementById("utable");   
  var   cells   =   utable.getElementsByTagName('TD');   
  for   (var   i=0;   i<cells.length;   i++)   
  {   
  cells[i].style.color     =   '#535353';   
  }   
  obj.style.color     =   '#e77919';
  obj.style.fontWeight     =   'bold';
  }   

//----------------------------------------------------------------------------------
//方 法 名：OnClickIMGFocusChange()
//方法说明：修改图片没有当前的焦点（在Top.ascx文件中调用此方法），并且更改当前选中项的图片
//----------------------------------------------------------------------------------
function OnClickIMGFocusChange(strIMGID)
{
	/*
		参  数：strIMGID -- 当前选中的图片的ID
		返回值：
	*/

	var oImg      = "";
	var strTmp    = "";
	var strImgUrl = "";
	var strImgTmp = "";
	var strImgType = "";
	
	if(strIMGID != "")
	{
		oImg = window.document.all(strIMGID);             //获取当前选中的图片
		oImg.hideFocus = true;                                //隐藏当前图片的焦点
		
		for(i = 0; i < 7; i++)
		{
			strTmp = "imgMenu_" + i;

			if(strTmp == strIMGID)
			{
				//修改选中菜单的当前图片(显示为红色字体)
				strImgUrl = oImg.src;
				strImgUrl = strImgUrl.substr(0,strImgUrl.length - 4);
				strImgUrl += "_B.gif";
				oImg.src = strImgUrl;
			}
		}
	}
}

//----------------------------------------------------------------------------------
//方 法 名：OnClickOtherIMGFocusChange()
//方法说明：修改图片没有当前的焦点（在Top.ascx文件中调用此方法），并且更改当前选中项的图片。此方法在页面没有刷新时使用
//----------------------------------------------------------------------------------
function OnClickOtherIMGFocusChange(strIMGID)
{
	/*
		参  数：strIMGID -- 当前选中的图片的ID
		返回值：
	*/

	var oImg      = "";
	var strTmp    = "";
	var strImgUrl = "";
	var strImgTmp = "";
	var strImgType = "";

	if(strIMGID != "")
	{
		window.document.all(strIMGID).hideFocus = true;       //隐藏当前图片的焦点
		
		for(i = 0; i < 7; i++)
		{
			strTmp = "imgMenu_" + i;
			oImg = window.document.all(strTmp);             //获取当前选中的图片
			
			if(strTmp == strIMGID)
			{
				//修改选中菜单的当前图片(显示为红色字体)
				strImgUrl = oImg.src;
				strImgUrl = strImgUrl.substr(0,strImgUrl.length - 4);
				if(strImgUrl.substr(0,strImgUrl.length - 6) != "_B.gif")
				{
					strImgUrl += "_B.gif";
					oImg.src = strImgUrl;
				}
			}
			else
			{
				//修改当前没有选中的图片（显示为黑色字体）
				strImgUrl  = oImg.src;
				strImgType = strImgUrl.substr(strImgUrl.length - 6,strImgUrl.length);
				if(strImgType == "_B.gif")
				{
					strImgUrl = strImgUrl.substr(0,strImgUrl.length - 6) + ".gif";
					oImg.src  = strImgUrl;
				}
			}
		}
	}
}