function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
function checkemail(thefield,s)		//检查Email合法函数
{
	if(!isemail(thefield.value))
		return warninvalid(thefield,s);
	else return true;
}
function AlertDel() {		//删除警告
   	temp=window.confirm('你真的要删去吗？');
	if (temp == true) return true;
	else return false;
}
/*
function CheckBox(form)		//检查警告
{
  var strchoice="";
  for (var i=0;i<form.elements.length;i++)
  {
     var e = form.elements(i);
     if ((e.name != 'delete')&&(e.name!='chkall')&&(e.checked))
     {
         strchoice=strchoice + e.value+",";
     }
  }
  if (strchoice=="")
  {
     alert("请选择您想要删除的内容！");
     return false;
  }else
  {
      var truthBe=confirm("您确定要删除吗？");
      if (truthBe)
	  {
	     return true;
	  }
      else
         return false;
  }
}//*/

function CheckAll(form)		//全选
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }

function CheckPic()		//检查图片输入
  {
  	if(document.Form1.Pic1.value ==""){
  		alert("请选择图片，进行输入！");
  		return false;
  	}
  }
  
function CheckFile()		//检查文件输入
  {
  	if(document.Form1.Pic1.value ==""){
  		alert("请选择文件，进行输入！");
  		return false;
  	}
  }

function win_open(url,width,height){		//打开窗口
		window.open(url, 'popupnav', 'width='+width+',height='+height+',top=0,left=50, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no');
}

function isAvailable()		//检查发布信息
  {
  	if(document.Form1.Title.value ==""){
  		alert("请填写标题内容！");
  		return false;
  	}
  }
  
function PrintDate(){		//打印当日日期
	var enabled = 0; today = new Date();
	var day; var date;
	if(today.getDay()==0) day = "星期天"
	if(today.getDay()==1) day = "星期一"
	if(today.getDay()==2) day = "星期二"
	if(today.getDay()==3) day = "星期三"
	if(today.getDay()==4) day = "星期四"
	if(today.getDay()==5) day = "星期五"
	if(today.getDay()==6) day = "星期六"
	date = (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 ";
	document.write("<b>" + date.fontsize(2) + "</b>");
}

function NavRollOverW(src,clrOver) { if (!src.contains(event.fromElement)) { src.style.cursor = 'hand'; src.bgColor = clrOver; }}	//表格背景色
function NavRollOutW(src,clrIn) { if (!src.contains(event.toElement)) { src.style.cursor = 'default'; src.bgColor = clrIn; }} 

function FieldSearchForm_onsubmit() {	//生成法律法规搜索字串
        var SQLDate,SQLAuthor,SQLTitle,SQLContent,SQLLocal,SQLType,SQL,sTitle,sContent,Relation;
        var Reg;
        var BeginYear=document.FieldSearchForm.BeginYear.value;
        
        var EndYear=document.FieldSearchForm.EndYear.value;
        

   //     Reg=/(\w+)(\s+)(\w+)/;

        SQLDate=SQLAuthor=SQLTitle=SQLContent=SQLLocal=SQLType=SQL="";
        Relation=" AND ";
        
        if(BeginYear!=""&&EndYear!="")
                SQLDate="颁布日期>=" + BeginYear + " AND 颁布日期<=" + EndYear + Relation;
        if(BeginYear==""&&EndYear!="")
                SQLDate="颁布日期<=" + EndYear + Relation;
        if(BeginYear!=""&&EndYear=="")
                SQLDate="颁布日期>=" + BeginYear + Relation;

 //       if(document.FieldSearchForm.Author.value!="")
 //               SQLAuthor="颁布单位=" + document.FieldSearchForm.Author.value + Relation;
        if(document.FieldSearchForm.Title.value!="")
              //  sTitle = document.FieldSearchForm.Title.value.
                SQLTitle="标题="+ document.FieldSearchForm.Title.value + Relation;
        if(document.FieldSearchForm.Content.value!="")
                SQLContent="正文=" + document.FieldSearchForm.Content.value + Relation;     
        if(document.FieldSearchForm.Type.value!="1")
                SQLType="时效性=" + document.FieldSearchForm.Type.value + Relation;
        if (document.FieldSearchForm.channelid.value=="30117"&&document.FieldSearchForm.Local.value!="1")
                SQLLocal="地区=" + document.FieldSearchForm.Local.value + Relation;         
        SQL=SQLDate + SQLAuthor + SQLTitle + SQLContent + SQLType + SQLLocal;

        var     Length=SQL.length;
        SQL=SQL.substring(0,Length-5);

        document.FieldSearchForm.searchword.value=SQL;
        if(SQL=="")
        {
                alert("检索表达式不能为空!");
                return false;
        }
        return true;
}

function ShowLay(divId){
	if(divID == 1){
		if (Menu1.style.display=="none"){
			Menu1.style.display="";
		}else{
			Menu1.style.display="none";
		}
	}
	else{
	}
	if(divID == 2){
		if (Menu2.style.display=="none"){
			Menu2.style.display="";
		}else{
			Menu2.style.display="none";
		}
	}

}

//-------律师律所查询动作-----//
function action1() {	//律师查询
		document.LawSearchForm.action='../program/lawyer_file.php';
		//document.LawSearchForm.target='Content';
		document.LawSearchForm.submit();
}
function action2() {	//律所查询
		document.LawSearchForm.action='../program/lawfirm_file.php';
		//document.LawSearchForm.target='Content';
		document.LawSearchForm.submit();
}
function action3() {	//律所查询
		if(document.LawSearchForm.LawyerName.value != ''){
			document.LawSearchForm.action='../program/lawyer_file.php';
		}else{
			document.LawSearchForm.action='../program/lawfirm_file.php';
		}
		//document.LawSearchForm.target='Content';
		document.LawSearchForm.submit();
}
//-------律师律所查询动作-----//

//------- 查询 --------//
//*
function SearchFormSubmit( formvar )
{
  try{
	  formvar.currentPage.value="";
    
  }catch(e){
  }
  
  return true;
}
//*/

function checkSearch(formvar){
	/*
	if(formvar.search.value==""){
	alert("请输入关键字!");
	return false;
	}
	//*/
	formvar.currentPage.value="";
	
	return true;
}

function SearchButtonClick( formvar ){
	try{
		formvar.currentPage.value='';
		formvar.operator.value='search';
	}catch( e ){
		//alert("E:<"+ e+">");
	}

	formvar.submit();
	return true;

}

