// 除去字符串两侧空格
String.prototype.strip = function() {
	return this.replace(/^\s+/, '').replace(/\s+$/, '');
}
function checkDownload(){
  var oInputs=document.getElementById('download_form').getElementsByTagName("input");
  var flag=false;
  for(var i=0;i<oInputs.length;i++){
    if(oInputs[i].type=="checkbox"&&oInputs[i].checked){
	  flag=true;
	  break;
	}
  }
  if(!flag){
    alert('请选择要下载的文件');
  }
  return flag;
}
function checkUserMessage(){
  var companyName=document.getElementById('companyName').value.strip();
  var industry=document.getElementById('industry').value.strip();
  var username=document.getElementById('username').value.strip();
  var contactInformation=document.getElementById('contactInformation').value.strip();
  var mobile=document.getElementById('mobile').value.strip();
  var officePhoneNumber=document.getElementById('officePhoneNumber').value.strip();
  var userEmail=document.getElementById('userEmail').value.strip();
  if(companyName==''){
    alert('Please Input Your Company Name!');
	return false;
  }
  if(username==''){
    alert('Please Input Your Name!');
	return false;
  }
  if(contactInformation==''){
    alert('Please Input Your Contact Information!');
	return false;
  }
  var reg1=/^([0-9]{8}|[0-9]{11})$/;
  var reg2=/^([0-9]{8,30})$/;
  if(mobile==''&&officePhoneNumber==''){
    alert('Please Input Your Mobile Number or Office Phone Number!');
	return false;
  }
  if(mobile!=''&&!reg1.test(mobile)){
    alert('Mobile phone number must contain 8 or 11 digits.');
	return false;
  }
  if(officePhoneNumber!=''&&!reg2.test(officePhoneNumber)){
    alert('Company telephone number must contain at least 8 digits.');
	return false;
  }
  var reg3=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
  if(!reg3.test(userEmail)){
	alert('Invalid email address.');
	return false;
  }
  alert('Thanks for your interest in our business. Our service team will contact you as soon as possible.');
  return true;
}

function confirmEnquiry(){
  var enquiry_contact=document.getElementById('enquiry_contact').value;
  var enquiry_content=document.getElementById('enquiry_content').value;
  if(enquiry_contact==''){
    alert('Please input contact information!');
	return false;
  }
  if(enquiry_content==''){
   alert('Please input Your queries!');
   return false;
  }
  alert('Thanks for your interest in our business. Our service team will contact you as soon as possible.');
  return true;
}