function send()
{
   var user_name=DWRUtil.getValue("user_name");
   var user_email=DWRUtil.getValue("user_email");
   var user_location=DWRUtil.getValue("user_location");
   var user_request=DWRUtil.getValue("user_request");
   var user_comments=DWRUtil.getValue("user_comments");
   if(user_name==null||user_name=='')
   {
      alert("姓名不能為空!");
      return ;
   }
   if(user_email==null||user_email=='')
   {
       alert("email不能为空!");
       return ;
   }
   if(!checkEmail(user_email))
   {
      alert("請您輸入正確的Email!");
      return ;
   }
   if(user_comments==null||user_comments=='')
   {
       alert("請你輸入您的意見和建議!");
       return ;
   }
   var form1=document.getElementById("contactForm"); 
   form1.action=base+"/jasons/contactus.do";  
   form1.submit();   
}
function sendSuccess()
{
  alert("已送出您的意見!");
  doReset();
}
function sendFailed()
{
   alert("發送失敗!");
}
function doReset()
{
    DWRUtil.setValue("user_name","");
    DWRUtil.setValue("user_email","");
    DWRUtil.setValue("user_location","");
}
function checkEmail(value){
	if(value.length!=0) {
		if (value.charAt(0)=="." || 
				value.charAt(0)=="@"|| 
				value.indexOf('@', 0) == -1 || 
				value.indexOf('.', 0) == -1 || 
				value.lastIndexOf("@")== value.length-1 || 
				value.lastIndexOf(".")== value.length-1){
			return false;
		}
		if(!checkEmail2(value)){
			return false;
		}
	}
	return true;
}
function checkEmail2(value){
	var reVal = new RegExp("^[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+@[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+(\.[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+)+$","i");
	return reVal.test(value);
}

function clearValue(el){
	el.value = "";
}