
function checkValidateApply() 
{	
	var checkform = 0;
	//var reg_mail = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$");
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if($("In_Company").value =="")
	{
		checkform = 1;
		alert("Please Insert Installer Detail => Company Name") ;
		$("In_Company").focus() ;
	}
	else if($("In_Address1").value =="")
	{
		checkform = 1;
		alert("Please Insert Installer Detail =>  Address1") ;
		$("In_Address1").focus() ;
	}
	else if($("In_Town").value =="")
	{
		checkform = 1;
		alert("Please Insert Installer Detail =>  Town") ;
		$("In_Town").focus() ;
	}
	
	else if($("In_County").value =="")
	{
		checkform = 1;
		alert("Please Insert Installer Detail =>  County") ;
		$("In_County").focus() ;
	}
	else if($("In_Country").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Installer Detail =>  Country") ;
		$("In_Country").focus() ;
	}

	else if($("In_PostCode").value =="")
	{
		checkform = 1;
		alert("Please Insert Installer Detail =>  Post Code") ;
		$("In_PostCode").focus() ;
	}
	else if($("In_Phone").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Installer Detail =>  Phone") ;
		$("In_Phone").focus() ;
	}
	else if($("In_Email").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Installer Detail =>  E-mail") ;
		$("In_Email").focus() ;
	}
	else if(!filter.test($("In_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("In_Email").focus() ;
	}
	
	
	
	else if($("In_Title").selectedIndex == 0)
	{
		checkform = 1 ;
		alert("Please Insert Contact Person => Title") ;
		$("In_Title").focus() ;
	}
	else if($("In_FirstName").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Contact Person => First Name") ;
		$("In_FirstName").focus() ;
	}
	else if($("In_LastName").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Contact Person => Last Name") ;
		$("In_LastName").focus() ;
	}
	else if($("In_Position").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Contact Person => Position") ;
		$("In_Position").focus() ;
	}
	
	
	
	else if($("Ass_InstYear").selectedIndex == 0)
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Installation Year") ;
		$("Ass_InstYear").focus() ;
	}
	else if($("Ass_Serial").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Lift Serial Number") ;
		$("Ass_Serial").focus() ;
	}
	else if($("Ass_Model").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Lift Model") ;
		$("Ass_Model").focus() ;
	}
	else if($("Ass_Type").selectedIndex == 0)
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Lift Type") ;
		$("Ass_Type").focus() ;
	}
	else if($("Ass_Speed").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Lift Speed") ;
		$("Ass_Speed").focus() ;
	}
	else if($("Ass_Floors").selectedIndex == 0)
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Number of Floors") ;
		$("Ass_Floors").focus() ;
	}
	else if($("Ass_Weight").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Maximum Load") ;
		$("Ass_Weight").focus() ;
	}
	else if($("Ass_Address1").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Address 1") ;
		$("Ass_Address1").focus() ;
	}
	else if($("Ass_Town").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Town/City") ;
		$("Ass_Town").focus() ;
	}
	else if($("Ass_County").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => County") ;
		$("Ass_County").focus() ;
	}
	else if($("Ass_Country").selectedIndex == 0)
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Country") ;
		$("Ass_Country").focus() ;
	}
	else if($("Ass_PostCode").value =="")
	{
		checkform = 1 ;
		alert("Please Insert Assignment Details => Post Code") ;
		$("Ass_PostCode").focus() ;
	}
	
	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}

function numbersOnly(e) {
      var evt = (e) ? e : window.event;
      var key = (evt.keyCode) ? evt.keyCode : evt.which;

      if(key != null) {
        key = parseInt(key, 10);

        if((key < 48 || key > 57) && (key < 96 || key > 105)) {
          if(!isUserFriendlyChar(key))
            return false;
        }
        else {
          if(evt.shiftKey)
            return false;
        }
      }

      return true;
    }

function isUserFriendlyChar(val) {
  // Backspace, Tab, Enter, Insert, and Delete
  if(val == 8 || val == 9 || val == 13 || val == 45 || val == 46)
	return true;

  // Ctrl, Alt, CapsLock, Home, End, and Arrows
  if((val > 16 && val < 21) || (val > 34 && val < 41))
	return true;

  // The rest
  return false;
}



function checkValidateAppeal() 
{	
	var checkform = 0;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if($("Tr_Title").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Contact Title") ;
		$("Tr_Title").focus() ;
	}
	else if($("Tr_FirstName").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact First Name") ;
		$("Tr_FirstName").focus() ;
	}
	else if($("Tr_LastName").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Family Name") ;
		$("Tr_LastName").focus() ;
	}
	else if($("Tr_Phone").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Phone Number") ;
		$("Tr_Phone").focus() ;
	}
	else if($("Tr_Email").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Email Address") ;
		$("Tr_Email").focus() ;
	}
	else if(!filter.test($("Tr_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("Tr_Email").focus() ;
	}
	else if($("Tr_Com_Name").value =="")
	{
		checkform = 1;
		alert("Please Insert Company Name") ;
		$("Tr_Com_Name").focus() ;
	}
	else if($("Tr_County").value =="")
	{
		checkform = 1;
		alert("Please Insert County") ;
		$("Tr_County").focus() ;
	}
	else if($("Tr_Date").value =="")
	{
		checkform = 1;
		alert("Please Insert Date of Visit") ;
		$("Tr_Date").focus() ;
	}
	else if($("Tr_Lead").value =="")
	{
		checkform = 1;
		alert("Please Insert Lead Auditor Name") ;
		$("Tr_Lead").focus() ;
	}
	else if($("Tr_des").value =="")
	{
		checkform = 1;
		alert("Please Insert Description of Appeal") ;
		$("Tr_des").focus() ;
	}
	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}

function checkValidateComplaint() 
{	
	var checkform = 0;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if($("Tr_Title").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Contact Title") ;
		$("Tr_Title").focus() ;
	}
	else if($("Tr_FirstName").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact First Name") ;
		$("Tr_FirstName").focus() ;
	}
	else if($("Tr_LastName").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Family Name") ;
		$("Tr_LastName").focus() ;
	}
	else if($("Tr_Phone").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Phone Number") ;
		$("Tr_Phone").focus() ;
	}
	else if($("Tr_Email").value =="")
	{
		checkform = 1;
		alert("Please Insert Contact Email Address") ;
		$("Tr_Email").focus() ;
	}
	else if(!filter.test($("Tr_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("Tr_Email").focus() ;
	}
	else if($("Tr_Com_Name").value =="")
	{
		checkform = 1;
		alert("Please Insert Company Name") ;
		$("Tr_Com_Name").focus() ;
	}
	else if($("Tr_com-against").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Complaint Against") ;
		$("Tr_com-against").focus() ;
	}
	else if($("Tr_des").value =="")
	{
		checkform = 1;
		alert("Please Insert Complaint Description") ;
		$("Tr_des").focus() ;
	}

	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}

function checkValidateRule() 
{	
	var checkform = 0;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	
	if($("Ru_Title").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Title") ;
		$("Ru_Title").focus() ;
	}
	else if($("Ru_FirstName").value =="")
	{
		checkform = 1;
		alert("Please Insert First Name") ;
		$("Ru_FirstName").focus() ;
	}
	else if($("Ru_LastName").value =="")
	{
		checkform = 1;
		alert("Please Insert Family Name") ;
		$("Ru_LastName").focus() ;
	}
	else if($("Ru_Email").value =="")
	{
		checkform = 1;
		alert("Please Insert Email Address") ;
		$("Ru_Email").focus() ;
	}
	else if(!filter.test($("Ru_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("Ru_Email").focus() ;
	}
	else if($("Ru_Company").value =="")
	{
		checkform = 1;
		alert("Please Insert Company Name") ;
		$("Ru_Company").focus() ;
	}
	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}

function checkValidateQuotation() 
{	
	var checkform = 0;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	//Check standard
	var hasChecked = false;
	for(var i=1;i<16;i++)
	{
		if($("checkbox" + i).checked === true)
		{
			hasChecked = true;
		}
	}
	
	if($("In_Title").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Title") ;
		$("In_Title").focus() ;
	}
	else if($("In_FirstName").value =="")
	{
		checkform = 1;
		alert("Please Insert First Name") ;
		$("In_FirstName").focus() ;
	}
	
	else if($("In_LastName").value =="")
	{
		checkform = 1;
		alert("Please Insert Family Name") ;
		$("In_LastName").focus() ;
	}
	else if($("In_Phone").value =="")
	{
		checkform = 1;
		alert("Please Insert Phone") ;
		$("In_Phone").focus() ;
	}
	else if($("In_Email").value =="")
	{
		checkform = 1;
		alert("Please Insert Email Address") ;
		$("In_Email").focus() ;
	}
	else if(!filter.test($("In_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("In_Email").focus() ;
	}
	else if($("In_Company").value =="")
	{
		checkform = 1;
		alert("Please Insert Company Name") ;
		$("In_Company").focus() ;
	}
	else if($("In_Address1").value =="")
	{
		checkform = 1;
		alert("Please Insert Address 1") ;
		$("In_Address1").focus() ;
	}
	else if($("In_Town").value =="")
	{
		checkform = 1;
		alert("Please Insert Town") ;
		$("In_Town").focus() ;
	}
	else if($("In_City").value =="")
	{
		checkform = 1;
		alert("Please Insert City") ;
		$("In_City").focus() ;
	}
	else if($("In_Country").value =="")
	{
		checkform = 1;
		alert("Please Insert Country") ;
		$("In_Country").focus() ;
	}
	else if($("In_PostCode").value =="")
	{
		checkform = 1;
		alert("Please Insert Post Code") ;
		$("In_PostCode").focus() ;
	}
	else if(hasChecked == false)
	{
		checkform = 1;
		alert("Please Choose Standard(s)") ;
	}
	else if($("scope").value =="")
	{
		checkform = 1;
		alert("Please Insert Scope") ;
		$("scope").focus() ;
	}
	else if($("noofemployee").value =="")
	{
		checkform = 1;
		alert("Please Insert No of Employee") ;
		$("noofemployee").focus() ;
	}
	else if($("nooflocation").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert No of Location") ;
		$("nooflocation").focus() ;
	}
	
	
	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}

function checkValidateTranferCer() 
{	
	var checkform = 0;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	
	
	if($("Tr_Title").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Title") ;
		$("Tr_Title").focus() ;
	}
	else if($("Tr_FirstName").value =="")
	{
		checkform = 1;
		alert("Please Insert First Name") ;
		$("Tr_FirstName").focus() ;
	}
	
	else if($("Tr_LastName").value =="")
	{
		checkform = 1;
		alert("Please Insert Family Name") ;
		$("Tr_LastName").focus() ;
	}
	else if($("Tr_Phone").value =="")
	{
		checkform = 1;
		alert("Please Insert Phone") ;
		$("Tr_Phone").focus() ;
	}
	else if($("Tr_Email").value =="")
	{
		checkform = 1;
		alert("Please Insert Email Address") ;
		$("Tr_Email").focus() ;
	}
	else if(!filter.test($("Tr_Email").value))
	{
		checkform = 1 ;
		alert("Invalid E-mail !!") ;
		$("Tr_Email").focus() ;
	}
	else if($("Tr_Company").value =="")
	{
		checkform = 1;
		alert("Please Insert Company Name") ;
		$("Tr_Company").focus() ;
	}
	else if($("Tr_Address1").value =="")
	{
		checkform = 1;
		alert("Please Insert Address 1") ;
		$("Tr_Address1").focus() ;
	}
	else if($("Tr_Town").value =="")
	{
		checkform = 1;
		alert("Please Insert Town") ;
		$("Tr_Town").focus() ;
	}
	else if($("Tr_County").value =="")
	{
		checkform = 1;
		alert("Please Insert County") ;
		$("Tr_County").focus() ;
	}
	else if($("Tr_Country").value =="")
	{
		checkform = 1;
		alert("Please Insert Country") ;
		$("Tr_Country").focus() ;
	}
	else if($("Tr_PostCode").value =="")
	{
		checkform = 1;
		alert("Please Insert Post Code") ;
		$("Tr_PostCode").focus() ;
	}
	else if($("Tr_CurrentBody").value =="")
	{
		checkform = 1;
		alert("Please Insert Your current certification body") ;
		$("Tr_CurrentBody").focus() ;
	}
	else if($("Tr_AssessDate").value =="")
	{
		checkform = 1;
		alert("Please Insert Date of initial assessment") ;
		$("Tr_AssessDate").focus() ;
	}
	else if($("Tr_ExpiryDate").value =="")
	{
		checkform = 1;
		alert("Please Insert Date of certificate expiry") ;
		$("Tr_ExpiryDate").focus() ;
	}
	else if($("Tr_SurvDate").value =="")
	{
		checkform = 1;
		alert("Please Insert Last surveillance visit date") ;
		$("Tr_SurvDate").focus() ;
	}
	else if($("Tr_Standard").value =="")
	{
		checkform = 1;
		alert("Please Insert Standard (from your current certificate)") ;
		$("Tr_Standard").focus() ;
	}
	else if($("Tr_Scope").value =="")
	{
		checkform = 1;
		alert("Please Insert Scope (from your current certificate)") ;
		$("Tr_Scope").focus() ;
	}
	else if($("Tr_Locations").value =="")
	{
		checkform = 1;
		alert("Please Insert How many locations") ;
		$("Tr_Locations").focus() ;
	}
	else if($("Tr_Employees").value =="")
	{
		checkform = 1;
		alert("Please Insert How many employees") ;
		$("Tr_Employees").focus() ;
	}
	else if($("Tr_Reason").selectedIndex == 0)
	{
		checkform = 1;
		alert("Please Insert Reason for transfer") ;
		$("Tr_Reason").focus() ;
	}

	
	
	
	if (checkform == 1)
	{	
		return false;	
	} else {
		return confirm_alert();
	}	
}


