function trim(str){ 
//删除左右两端的空格 
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function findObj(obj){
	return document.getElementById(obj);
}
function searchBar(){
   if(document.Form.keyword.value == ""||trim(findObj("keyword").value).length>30){
    alert("请输入搜索词!");
    document.Form.keyword.focus();
    return false;
   }
    if(trim(findObj("keyword").value).length>30){
     alert("您输入搜索词长度不能大于30!");
     document.Form.keyword.focus();
    return false;
   }
   document.Form.submit();
   return true;
  
  }
function gotoSubmit(page){
   findObj("page").value=page;
   findObj("form1").submit();
}
function mouseOut(obj,name){
	obj.className=name;
}
function mouseOvers(obj,name,obj2){
	obj.className=name;
	eval(obj.id+"_div").style.display="block";
	eval(findObj(obj2)).className="";
	eval(findObj(findObj(obj2).id+"_div")).style.display="none";
}

function mouseOver(obj,name,start,end){
	for(var i=start;i<=end;i++){
	  var s=obj.id;  s=s.substring(0,2);
	  eval(findObj(s+i)).className="";
	  eval(findObj(findObj(s+i).id+"_div")).style.display="none";
	}
	obj.className=name;
	eval(obj.id+"_div").style.display="block";
}
function add_ask(){
	if(trim(findObj("ask").value).length==0||trim(findObj("ask").value).length>30){
		alert("标题信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("name").value).length==0||trim(findObj("name").value).length>30){
		alert("姓名信息不正确，请謓写正确再提交!");
		return false;
	}
	findObj("form1").submit();
	alert("您的咨询已成功发送,我们会尽快对此进行处理，请您留意咨询问题列表，感谢您的关注!");
}

function add_application(){
	if(trim(findObj("name").value).length==0||trim(findObj("name").value).length>30){
		alert("姓名信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("email").value).length==0||trim(findObj("email").value).length>30){
		alert("邮箱信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("papername").value).length==0||trim(findObj("papername").value).length>30){
		alert("信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("papernum").value).length==0||trim(findObj("papernum").value).length>30){
		alert("信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("phone").value).length==0||trim(findObj("phone").value).length>30){
		alert("联系电话不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("postnum").value).length==0||trim(findObj("postnum").value).length>30){
		alert("邮政编码不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("work").value).length==0||trim(findObj("work").value).length>100){
		alert("地址信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("summary").value).length==0){
		alert("所需信息概述不完整，请謓写完整再提交!");
		return false;
	}
	 findObj("form1").submit();
	alert("您的依申请公开已成功发送,我们会尽快对此进行处理，感谢您的关注!");
}
function reset_apply(){
  findObj("name").value="";
  findObj("email").value="";
  findObj("papername").value="";
  findObj("papernum").value="";
  findObj("phone").value="";
  findObj("postnum").value="";
  if(findObj("address")!=null){
  findObj("address").value="";
  }
  findObj("work").value="";
  findObj("summary").value="";
  findObj("content").value="";
}
function sendEmail(){
  if(trim(findObj("name").value).length==0||trim(findObj("name").value).length>30){
		alert("姓名信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("email").value).length==0||trim(findObj("email").value).length>30){
		alert("邮箱信息不正确，请謓写正确再提交!");
		return false;
	}
	if(trim(findObj("content").value).length==0){
		alert("内容信息不完整，请謓写完整再提交!");
		return false;
	}
	findObj("form1").submit();
	alert("您发的邮件已成功发送,我们会尽快对此进行处理，感谢您的关注!");
}
function resetSend(){
  findObj("name").value="";
  findObj("email").value="";
  findObj("content").value="";
  findObj("address").value="";
  findObj("phone").value="";
  findObj("postcode").value="";  
}
function windowopen(target){
	newwindow=window.open("","","scrollbars")
	if (document.all){
	newwindow.moveTo(0,0)
	newwindow.resizeTo(screen.width,screen.height)
	}
	newwindow.location=target
}
