function killErr(){return true;} 
window.onerror=killErr;
function getCookie(sName){
	var sSearch=sName+"=";
	var acookie=window.document.cookie+";"
	acookie=acookie.replace(/\&/g,';');
	if(acookie.length>0){
		var iOffset=acookie.indexOf(sSearch);
		if(iOffset!=-1){
			iOffset+=sSearch.length;
			var iEnd=acookie.indexOf(";",iOffset);
			if(iEnd==-1){iEnd=acookie.length;}
			var s=acookie.substring(iOffset,iEnd);
			return s;			
		}
	}
	return null;
}
function getLoginName(){
	return getCookie("Md5Name");
}
//idname: 页面元素的ID
//v: 0隐藏，1显示
function show_hidden(idname, v)
{
	var obj = $(idname);
	if (!obj){ return false;}	
	if (v == 0) {
		if (obj.style.display != "none") { obj.style.display = "none";}
		return true;
	}
	else if (v == 1) {
		if (obj.style.display == "none") { obj.style.display = ""; }
		return true;
	}
	return false;
}
//更新记录后关闭子窗口并刷新父窗口的JS 
function RefreshParent(CloseSub) {
	//window.parent.location.reload();
	window.opener.location.href = window.opener.location.href;
	if (window.opener.progressWindow) window.opener.progressWindow.close();
	if (CloseSub) window.close();
}
function IsNumeric(s)
{
	var r,re;
	re = /\d*/i; //\d表示数字,*表示匹配多个数字
	r = s.match(re);
	return (r==s)?true:false;
}
function GetErr(msg, act, aurl){
	document.write("<center>"+msg+"</center>");
	if(act=="close"){
		window.parent.dialogBoxClose.click();
		if(msg.length>0)alert(msg);
        }else if(act=="back"){
		if(msg.length>0)alert(msg);
		history.back();
	}else if(act=="goto" && aurl.length>0){
		if(msg.length>0)alert(msg);
		//window.top.location=aurl;
                window.parent.location.reload();
	}else{
		if(msg.length>0)alert(msg);
	}
}
function check_replyform(aform){
	if(getLoginName() == ""||getLoginName() ==null)
		{alert("请登陆后回答问题！");OpenDiv(250,150);Loginput();return false;}
	else if(!aform.co.value)
		{alert("回答内容不能为空！"); return false; }
	else if(aform.co.value.length>5000)
		{alert("回答内容的长度不能超过5000字"); return false; }
	else if(aform.ck.value.length>60)
		{alert("参考文献内容长度不能大于30个汉字"); return false; }
	else
		return true;
}
function ShowSenderBtn(Sid){
	var guestname = getLoginName();
	if (guestname == sender && t == 0) {
		show_hidden(Sid,1);
	}else{
		show_hidden(Sid,0);  
	}
	return;
}
function ShowdealBtn(Sid,replyer){
	var guestname = getLoginName();
	if (guestname == sender && replyer!=sender) {
		show_hidden(Sid,1);
	}else{
		show_hidden(Sid,0);
	}
	return;
}
function ShowAnswerBtn(Sid){
	var guestname = getLoginName();
	if (guestname == sender || t == 1) {
		show_hidden(Sid,0);
	}else{
		show_hidden(Sid,1);
	}
	return;
}
function ShowModifyReBtn(Sid,replyer){
	var guestname = getLoginName();
	if (guestname == replyer && t != 1) {
		show_hidden(Sid,1);
	}else{
		show_hidden(Sid,0);
	}
	return;
}
function check_sendform(obj){
       if(getLoginName() == ""||getLoginName() ==null){
          //alert("请登陆后发表问题！"); return false;
          OpenDiv(250,150);Loginput();return false;
       }
       if(obj.title.value =="" || obj.title.value.length ==0){
          alert("请输入问题标题");obj.title.focus();return false;
       }
       var len = obj.title.value.length;
       if(len<8){
          ls_str = "问题标题不详细，请重新输入";
          alert(ls_str);obj.title.focus();return false;    
       }  
       if (len>100){
          ls_str = "问题标题字数限定在100个汉字以内，请缩短提问字数";
          alert(ls_str);obj.title.focus();return false; 
       }
       var content_length = obj.content.value.length;
       if(content_length<5){
          ls_str = "请填写问题说明，说明越详细，解答就越有针对性";
          alert(ls_str);obj.content.focus();return false;
       }
       if ( content_length >10000){
          ls_str = "问题说明字数限定在10000字节以内，请缩短字数";
          alert(ls_str);obj.content.focus();return false;
       }
       if(obj.classid.value=="" || obj.Nclassid.value==0){
          alert("请选择问题分类");return false;
       }
}
function changeselect(sel){     
       document.form2.Nclassid.length=0;   
       var selvalue=sel.value;   
       var i;   
       var newOption1=new Option("======= 请选择二级分类 =======","");   
       document.all.Nclassid.add(newOption1);   
       for(i=0;i<sall.length;i++){   
          if(sall[i][1]==selvalue){   
             var newOption1=new Option(sall[i][0],sall[i][2]);   
             document.all.Nclassid.add(newOption1);   
          }   
       }   
       document.all.seltmp.value=sel.text;   
}  
function postsel(sel){   
       document.all.yousel.value=document.all.seltmp.value+" → "+sel.text;   
}