function checkform2(form){

  var websitereg = /^(http(s?):\/\/)?(www\.)?([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  var phonereg = /^([0-9_\-\(\)\.]{7,12})$/;
  var name = form["your-name"].value;
  var phone = form["your-telephone"].value;
  var email = form["your-email"].value;
  var message = form["your-message"].value;
  
  if(name == '' || phone == '' || email == '' || message == ''){
    return false;
  }else if(email != 'N/A' && emailreg.test(email) == false) {
    return false;
  }else{
    return true;
  }
}

function checkmedlegalform(form){
  var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  var attorney = getCheckedValue(form.contact_attorney);
  var company = form.contact_company.value;
  var title = form.contact_title.value;
  var firstname = form.contact_firstname.value;
  var email = form.contact_email.value;
  var state = form.contact_state.value;
  var date_injury = form.contact_date_injury.value;
  var bone_joint = form.contact_bone_joint.value;
  var comments = form.contact_comments.value;
  var phone = form.contact_phone.value;
  var fax = form.contact_fax.value;
  var lastname = form.contact_lastname.value;
  var address = form.contact_address.value;
  var city = form.contact_city.value;
  var zip = form.contact_zip.value;
  var service_request = form.contact_service_request.value;
  
  if( attorney == '' || company == '' || title == '' || firstname == '' || email == '' || state == '' 
  || date_injury == '' || bone_joint == '' || comments == '' || phone == '' || fax == '' || lastname == ''
  || address == '' || city == '' || zip == '' || service_request == ''){
    //alert(attorney + company + title + firstname + email + state + date_injury + bone_joint + comments + phone + fax + lastname + address + city + zip + physician + service_request);
    alert("All Fields are Required");
    return false;
  }else if(email != 'N/A' && emailreg.test(email) == false) {
    //alert(attorney + company + title + firstname + email + state + date_injury + bone_joint + comments + phone + fax + lastname + address + city + zip + physician + service_request);
    alert('Please check your email.');
    return false;
  }else{
    newwindow=window.open(siteurl+'/medical-legal-thankyou.php','name','height=145,width=450');
    if (window.focus) {newwindow.focus()}
    return true;
  }
}

function checkconsultform(form){
  var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  var firstname = form.contact_firstname.value;
  var middlename = form.contact_middlename.value;
  var lastname = form.contact_lastname.value;
  var city = form.contact_city.value;
  var zip = form.contact_zip.value;
  var state = form.contact_state.value;
  var country = form.contact_country.value;
  var email = form.contact_email.value;
  var phone = form.contact_phone.value;
  var comments = form.contact_comments.value;
  
  if( firstname == '' || middlename == '' || lastname == '' || city  == '' || zip == '' || state == '' || country == '' || email == '' || phone == '' || comments == ''){
    //alert(firstname + middlename + lastname + city + zip + state + country + email + phone + comments);
    alert("All Fields are Required");
    return false;
  }else if(email != 'N/A' && emailreg.test(email) == false) {
    //alert(firstname + middlename + lastname + city + zip + state + country + email + phone + comments);
    alert('Please check your email.');
    return false;
  }else{
    newwindow=window.open(siteurl+'/second-opinion-thankyou.php','name','height=145,width=450');
    if (window.focus) {newwindow.focus()}
    return true;
  }
}

function checkappointmentform(form){
  var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  var name = form.contact_name.value;
  var phone = form.contact_phone.value;
  var email = form.contact_email.value;
  var thankyou = form.thankyou.value;
  
  if(name == '' || phone == '' || email == ''){
    alert("All Fields are Required");
    return false;
  }else if(email != 'N/A' && emailreg.test(email) == false) {
    alert('Please check your email.');
    return false;
  }else{
    newwindow=window.open(siteurl+'/'+thankyou,'name','height=145,width=450');
    if (window.focus) {newwindow.focus()}
    return true;
  }
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}


function thankyou(){
  newwindow=window.open(siteurl+'/thankyou.php','name','height=145,width=450');
	if (window.focus) {newwindow.focus()}
}


