function BestDealsHighLight(E)
{
	switch (E)
	{
		case "TVL_A":
			document.getElementById("multi_trip1").className = 'selected';
			document.getElementById("multi_trip2").className = 'selected';
			document.getElementById("multi_trip3").className = 'selected';
			document.getElementById("multi_trip4").className = 'selected';
			break;
		case "TVL_S":
			document.getElementById("single_trip1").className = 'selected';
			document.getElementById("single_trip2").className = 'selected';
			document.getElementById("single_trip3").className = 'selected';
			document.getElementById("single_trip4").className = 'selected';
			break;
		case "TVL_B":
			document.getElementById("backpacker1").className = 'selected';
			document.getElementById("backpacker2").className = 'selected';
			document.getElementById("backpacker3").className = 'selected';
			document.getElementById("backpacker4").className = 'selected';
			break;
		case "MBD_1":
			document.getElementById("2star1").className = 'selected';
			document.getElementById("2star2").className = 'selected';
			document.getElementById("2star3").className = 'selected';
			break;
		case "MBD_2":
			document.getElementById("3star1").className = 'selected';
			document.getElementById("3star2").className = 'selected';
			document.getElementById("3star3").className = 'selected';
			break;
		case "MBD_3":
			document.getElementById("4star1").className = 'selected';
			document.getElementById("4star2").className = 'selected';
			document.getElementById("4star3").className = 'selected';
			break;
		case "MBD_4":
			document.getElementById("5star1").className = 'selected';
			document.getElementById("5star2").className = 'selected';
			document.getElementById("5star3").className = 'selected';
			break;
		case "WED_1":
			document.getElementById("2star1").className = 'selected';
			document.getElementById("2star2").className = 'selected';
			break;
		case "WED_2":
			document.getElementById("3star1").className = 'selected';
			document.getElementById("3star2").className = 'selected';
			break;
		case "WED_3":
			document.getElementById("4star1").className = 'selected';
			document.getElementById("4star2").className = 'selected';
			break;
		case "WED_4":
			document.getElementById("5star1").className = 'selected';
			document.getElementById("5star2").className = 'selected';
			break;
		case "CHE_1":
			document.getElementById("EURS1").className = 'selected';
			document.getElementById("EURS2").className = 'selected';
			document.getElementById("EURS3").className = 'selected';
			document.getElementById("EURS4").className = 'selected';
			break;
		case "CHE_2":
			document.getElementById("EURA1").className = 'selected';
			document.getElementById("EURA2").className = 'selected';
			document.getElementById("EURA3").className = 'selected';
			document.getElementById("EURA4").className = 'selected';
			break;
		case "CHE_3":
			document.getElementById("WWS1").className = 'selected';
			document.getElementById("WWS2").className = 'selected';
			document.getElementById("WWS3").className = 'selected';
			document.getElementById("WWS4").className = 'selected';
			break;
		case "CHE_4":
			document.getElementById("WWA1").className = 'selected';
			document.getElementById("WWA2").className = 'selected';
			document.getElementById("WWA3").className = 'selected';
			document.getElementById("WWA4").className = 'selected';
			break;
	}
}

function BestDealsUnHighLight(E)
{
	switch (E)
	{
		case "TVL_A":
			document.getElementById("multi_trip1").className = 'normal';
			document.getElementById("multi_trip2").className = 'normal';
			document.getElementById("multi_trip3").className = 'normal';
			document.getElementById("multi_trip4").className = 'normal';
			break;
		case "TVL_S":
			document.getElementById("single_trip1").className = 'normal';
			document.getElementById("single_trip2").className = 'normal';
			document.getElementById("single_trip3").className = 'normal';
			document.getElementById("single_trip4").className = 'normal';
			break;
		case "TVL_B":
			document.getElementById("backpacker1").className = 'normal';
			document.getElementById("backpacker2").className = 'normal';
			document.getElementById("backpacker3").className = 'normal';
			document.getElementById("backpacker4").className = 'normal';
			break;
		case "MBD_1":
			document.getElementById("2star1").className = 'normal';
			document.getElementById("2star2").className = 'normal';
			document.getElementById("2star3").className = 'normal';
			break;
		case "MBD_2":
			document.getElementById("3star1").className = 'normal';
			document.getElementById("3star2").className = 'normal';
			document.getElementById("3star3").className = 'normal';
			break;
		case "MBD_3":
			document.getElementById("4star1").className = 'normal';
			document.getElementById("4star2").className = 'normal';
			document.getElementById("4star3").className = 'normal';
			break;
		case "MBD_4":
			document.getElementById("5star1").className = 'normal';
			document.getElementById("5star2").className = 'normal';
			document.getElementById("5star3").className = 'normal';
			break;
		case "WED_1":
			document.getElementById("2star1").className = 'normal';
			document.getElementById("2star2").className = 'normal';
			break;
		case "WED_2":
			document.getElementById("3star1").className = 'normal';
			document.getElementById("3star2").className = 'normal';
			break;
		case "WED_3":
			document.getElementById("4star1").className = 'normal';
			document.getElementById("4star2").className = 'normal';
			break;
		case "WED_4":
			document.getElementById("5star1").className = 'normal';
			document.getElementById("5star2").className = 'normal';
			break;
		case "CHE_1":
			document.getElementById("EURS1").className = 'normal';
			document.getElementById("EURS2").className = 'normal';
			document.getElementById("EURS3").className = 'normal';
			document.getElementById("EURS4").className = 'normal';
			break;
		case "CHE_2":
			document.getElementById("EURA1").className = 'normal';
			document.getElementById("EURA2").className = 'normal';
			document.getElementById("EURA3").className = 'normal';
			document.getElementById("EURA4").className = 'normal';
			break;
		case "CHE_3":
			document.getElementById("WWS1").className = 'normal';
			document.getElementById("WWS2").className = 'normal';
			document.getElementById("WWS3").className = 'normal';
			document.getElementById("WWS4").className = 'normal';
			break;
		case "CHE_4":
			document.getElementById("WWA1").className = 'normal';
			document.getElementById("WWA2").className = 'normal';
			document.getElementById("WWA3").className = 'normal';
			document.getElementById("WWA4").className = 'normal';
			break;
	}
}
function UpdateCCAddress()
{
	document.frmAMT_Details.txtCCAddress1.value = document.frmAMT_Details.Address1.value;
	document.frmAMT_Details.txtCCAddress2.value = document.frmAMT_Details.Address2.value;
	document.frmAMT_Details.txtCCTown.value		= document.frmAMT_Details.txtTown.value;
	if (document.frmAMT_Details.optCCCounty != null)
	{
		document.frmAMT_Details.optCCCounty.options[document.frmAMT_Details.optCounty.selectedIndex].selected = true;
	}
	if (document.frmAMT_Details.txtPostCode != null)
	{
		document.frmAMT_Details.txtCCPostCode.value = document.frmAMT_Details.txtPostCode.value;
	}
}

function UpdateBTICCAddress()
{
	document.frmMain.txtCCAddress.value = document.frmMain.txtAddress.value;	
}

function UpdateCCForm(CCType,CountryCode)
{
	myDivCardCVVOn	= document.getElementById("CardCVVOn");
	myDivCardCVVOff = document.getElementById("CardCVVOff");
	
	switch (CCType)
	{
		case "Visa":
			myDivCardCVVOn.style.display  = 'block';
			myDivCardCVVOff.style.display = 'none'; 
			break;
		case "MC":
			myDivCardCVVOn.style.display  = 'block';
			myDivCardCVVOff.style.display = 'none'; 
			break;
		case "Laser":
			myDivCardCVVOn.style.display  = 'none';
			myDivCardCVVOff.style.display = 'block'; 
			break;
		case "Switch":
			myDivCardCVVOn.style.display  = 'block';
			myDivCardCVVOff.style.display = 'none'; 
			break;
	}
	
	if (CountryCode == "UK") 
	{
		myDivCardIssueNoOn	= document.getElementById("CardIssueNoOn")
		myDivCardIssueNoOff	= document.getElementById("CardIssueNoOff")
		
		switch (CCType)
		{
			case "Visa":
				myDivCardIssueNoOn.style.display = 'none';
				myDivCardIssueNoOff.style.display = 'block';
				break;
			case "MC":
				myDivCardIssueNoOn.style.display = 'none';
				myDivCardIssueNoOff.style.display = 'block';
				break;
			case "Laser":
				myDivCardIssueNoOn.style.display = 'none';
				myDivCardIssueNoOff.style.display = 'block';
				break;
			case "Switch":
				myDivCardIssueNoOn.style.display = 'block';
				myDivCardIssueNoOff.style.display = 'none';
				break;
		}
	}
}

function IsValid(sText,ValidChars)
{
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++)
	{
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1)
		{
			IsNumber = false;
		}
	}
	return IsNumber;
}

function UpdateLPointer(xPos)
{
	var LeadPIndexTotal = Number(eval('document.frmAMT_Details.txtLeadPIndexTotal.value'));
	for (i = 1; i < LeadPIndexTotal; i++)
	{
		if (i == xPos)
		{
			
			document.getElementById("LPointer"+i).innerHTML = "Lead";
		}
		else
		{
			document.getElementById("LPointer"+i).innerHTML = "";
		}
		
	}
}
function ComparePrices(CoverType,CoverLevel,CountryCode)
{
	
	if(CountryCode == 'Irl')
	{
		if (CoverLevel == "Essential")
			{
				document.frmCalPrice.txtCoverLevel.value = CoverLevel;
				document.frmCalPrice.submit();
				return true;
				
			}
		if (CoverLevel == "Premier")
			{
					document.frmCalPrice.txtCoverLevel.value = CoverLevel;
					document.frmCalPrice.submit();
					return true;
				
			}	
		if (CoverLevel == 'Premier Plus')
			{
				
					document.frmCalPrice.txtCoverLevel.value = CoverLevel;
					document.frmCalPrice.submit();
					return true;
				
			}
			
			if (CoverLevel == 'Backpacker')
			{
					document.frmCalPrice.txtCoverLevel.value = CoverLevel;
					document.frmCalPrice.submit();
					return true;
					
				
			}
		}
	if (CountryCode = 'UK')
	{
		document.frmCalPrice.txtCoverLevel.value = CoverLevel;
		document.frmCalPrice.submit();
		return true;
	}
}
/*EMIAL VALIDATION*/
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str == "")
		{
			alert("Please enter your email address.");
			document.frmAMT_Details.txtEmail.focus();
			return false;
		}
		if (str.indexOf(at)==-1){
		   alert("Please enter a valid email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email")
		    return false
		 }

 		 return true					
	}
/*END OF EMIAL VALIDATION*/

function CheckForm_Step3(GID,AgencyID)
{
  
   
    if (GID == "BIGroup1") 
	  {
		
		if (document.frmAMT_Details.txtAgentsRefNum.value.length  <= 5) 
		{
			alert("File Number - Agent Ref. has to be greater than five and not greater than seven. Please correct.");
			document.frmAMT_Details.txtAgentsRefNum.focus();
			return false;
		}
		if (document.frmAMT_Details.txtAgentsRefNum.value.length  > 7) 
		{
			alert("File Number - Agent Ref. has to be greater than five and not greater than seven. Please correct.");
			document.frmAMT_Details.txtAgentsRefNum.focus();
			return false;
		}
	  }
	   
   if (AgencyID == "627")//Club
   {
		ValidChars = "0123456789";
		ValidAbc = "abcdefghijklmnoprstuwqyzABCEFGHIJKLMNOPRSTUWQYZ";
		if (document.frmAMT_Details.txtAgentsRefNum.value.length != 5)
		{
			alert("File Number - Agent Ref. has to be exactly 4 digits and 1 character.")
			document.frmAMT_Details.txtAgentsRefNum.focus();
			return false;
		}
		
		var Numbers=0;
		var Characters = 0;
		var Char;
		for (i = 0; i < document.frmAMT_Details.txtAgentsRefNum.value.length; i++)
		{
			Char = document.frmAMT_Details.txtAgentsRefNum.value.charAt(i);
			if (ValidChars.indexOf(Char) != -1)
			{
				Numbers = Numbers + 1;
			}
			
		
			if (ValidAbc.indexOf(Char) != -1)
			{
				Characters = Characters + 1;
			}
		}
		if (Numbers != 4 )
		{
			alert("File Number - Agent Ref. has to be exactly 4 digits and 1 character. Please correct.")
			document.frmAMT_Details.txtAgentsRefNum.focus();
			return false;
		}
		if (Characters != 1 )
		{
			alert("File Number - Agent Ref. has to be exactly 4 digits and 1 character. Please correct.")
			document.frmAMT_Details.txtAgentsRefNum.focus();
			return false;
		}
		
   
   }
  
 
  if (document.frmAMT_Details.txtFirstName_Adult11 != null)
  {
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Adult1.value; i++)
      {
          strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult1'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult1'+i+'.value' );

          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Adult Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult1'+i );
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Adult Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult1'+i );
              strLName.focus();
              return false;
          }
		  
		  if ( eval( 'document.frmAMT_Details.txtFirstName_Adult1'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Adult1'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Adult1'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Adult1'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
			
          if (document.frmAMT_Details.optPMIType_Adult11 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult1'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult1'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult1'+i );
                  strPMIType.focus();
                  return false;
              }
			  
			  
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult1'+i );
                  strPMINumber.focus();
                  return false;
              }
          }
      }
  }
  if (document.frmAMT_Details.txtFirstName_Adult21 != null)
  {
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Adult2.value; i++)
      {
          strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult2'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult2'+i+'.value' );

          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Adult Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult2'+i );
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Adult Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult2'+i );
              strLName.focus();
              return false;
          }
			
			if ( eval( 'document.frmAMT_Details.txtFirstName_Adult2'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Adult2'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Adult2'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Adult2'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
          if (document.frmAMT_Details.optPMIType_Adult21 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult2'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult2'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult2'+i );
                  strPMIType.focus();
                  return false;
              }
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMTDetails.txtPMINumber_Adult2'+i );
                  strPMINumber.focus();
                  return false;
              }
          }
      }
  }
  if (document.frmAMT_Details.txtFirstName_Adult31 != null)
  {	
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Adult3.value; i++)
      {
         
          strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult3'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult3'+i+'.value' );
			
          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Adult Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult3'+i );
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Adult Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult3'+i );
              strLName.focus();
              return false;
          }
			
			if ( eval( 'document.frmAMT_Details.txtFirstName_Adult3'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Adult3'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Adult3'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Adult3'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
          if (document.frmAMT_Details.optPMIType_Adult31 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult3'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult3'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult3'+i );
                  strPMIType.focus();
                  return false;
              }
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult3'+i );
                  strPMINumber.focus();
                  return false;
              }
          }
      }
  }
  
  if (document.frmAMT_Details.txtFirstName_Adult41 != null)
  {	
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Adult4.value; i++)
      {
         
          strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult4'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult4'+i+'.value' );
			
          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Adult Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Adult4'+i );
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Adult Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Adult4'+i );
              strLName.focus();
              return false;
          }
		if ( eval( 'document.frmAMT_Details.txtFirstName_Adult4'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Adult4'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Adult4'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Adult4'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
          if (document.frmAMT_Details.optPMIType_Adult41 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult4'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult4'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Adult4'+i );
                  strPMIType.focus();
                  return false;
              }
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Adult4'+i );
                  strPMINumber.focus();
                  return false;
              }
          }
      }
  }
  
  if (document.frmAMT_Details.txtFirstName_Children1 != null)
  {
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Children.value;i++)
      {
		  strFName = eval ( 'document.frmAMT_Details.txtFirstName_Children'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Children'+i+'.value' );

          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Child Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Children'+i);
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Child Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Children'+i);
              strLName.focus();
              return false;
          }
			if ( eval( 'document.frmAMT_Details.txtFirstName_Children'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Children'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Children'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Children'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
          if (document.frmAMT_Details.optPMIType_Children1 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Children'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Children'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Children'+i );
                  strPMIType.focus();
                  return false;
              }
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Children'+i );
                  strPMINumber.focus();
                  return false;
              }
                  
          }
      }
  }
  
  if (document.frmAMT_Details.txtFirstName_Infant1 != null)
  {
      for (i=1;i<=document.frmAMT_Details.txtTotalPeople_Infant.value;i++)
      {
		  strFName = eval ( 'document.frmAMT_Details.txtFirstName_Infant'+i+'.value' );
          strLName = eval ( 'document.frmAMT_Details.txtSurName_Infant'+i+'.value' );

          if ((strFName == "") || (strFName == "First Name"))
          {
              alert("Please enter the FirstName of your Infant Passenger.");
              strFName = eval ( 'document.frmAMT_Details.txtFirstName_Infant'+i);
              strFName.focus();
              return false;
          }
          if ((strLName == "") || (strLName == "Surname"))
          {
              alert("Please enter the SurName of your Infant Passenger.");
              strLName = eval ( 'document.frmAMT_Details.txtSurName_Infant'+i);
              strLName.focus();
              return false;
          }
			if ( eval( 'document.frmAMT_Details.txtFirstName_Infant'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtFirstName_Infant'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
		if ( eval( 'document.frmAMT_Details.txtSurName_Infant'+i+'.value' ).search("`")  > 0 )
			{
				strFirstName =  eval( 'document.frmAMT_Details.txtSurName_Infant'+i); 
				strFirstName.value = strFirstName.value.replace("`","'");
			}  
          if (document.frmAMT_Details.optPMIType_Children1 != null)
          {
              strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Infant'+i+'.value' );
              strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Infant'+i+'.value' );

              if (strPMIType == "None")
              {
                  alert("Please select your private medical insurance plan.");
                  strPMIType = eval ( 'document.frmAMT_Details.optPMIType_Infant'+i );
                  strPMIType.focus();
                  return false;
              }
              if ((strPMINumber == "") || (strPMINumber == "Membership Number"))
              {
                  alert("Please enter your membership number for your private medical insurance plan.");
                  strPMINumber = eval ( 'document.frmAMT_Details.txtPMINumber_Infant'+i );
                  strPMINumber.focus();
                  return false;
              }
                  
          }
      }
  }
/*  if (document.frmAMT_Details.txtEmail.value == "")
  {
      alert("Please enter your email address.");
      document.frmAMT_Details.txtEmail.focus();
      return false;
  }
 */
  if (echeck(document.frmAMT_Details.txtEmail.value)==false){
		//alert("Please enter a valid email address.");
		//document.frmAMT_Details.txtEmail.value=""
		document.frmAMT_Details.txtEmail.focus()
		return false
	}
  if ((document.frmAMT_Details.txtEmail.value) != (document.frmAMT_Details.txtConfirmEmail.value))
  {
      alert("Your confirmation email does not match your original email entered.  Please adjust your email address accordingly.");
      document.frmAMT_Details.txtConfirmEmail.focus();
      return false;
  }
  if (document.frmAMT_Details.Address1.value == "")
  {
      alert("Please enter your address.");
      document.frmAMT_Details.Address1.focus();
      return false;
  }
  if (document.frmAMT_Details.txtTown.value == "")
  {
      alert("Please enter the town you live in.");
      document.frmAMT_Details.txtTown.focus();
      return false;
  }
  if (document.frmAMT_Details.optCounty != null)
  {
      if (document.frmAMT_Details.optCounty.value == "None")
      {
          alert("Please select the county you live in.");
          document.frmAMT_Details.optCounty.focus();
          return false;
      }
  }
  if (document.frmAMT_Details.txtPostCode != null)
  {
      if (document.frmAMT_Details.txtPostCode.value == "")
      {
          alert("Please enter your PostCode.");
          document.frmAMT_Details.txtPostCode.focus();
          return false;
      }
  }
   if (document.frmAMT_Details.txtOfficialStamp != null)
  {
      if (document.frmAMT_Details.txtOfficialStamp.value == "")
      {
          alert("Please enter the official stamp.");
          document.frmAMT_Details.txtOfficialStamp.focus();
          return false;
      }
  }
  if (document.frmAMT_Details.txtCCName.value == "")
  {
      alert("Please enter the Credit/Debit Card Holders Name as it appears on their card.");
      document.frmAMT_Details.txtCCName.focus();
      return false;
  }
  if (document.frmAMT_Details.optCCType.value == "Select")
  {
      alert("Please select the card type");
      document.frmAMT_Details.optCCType.focus();
      return false;
  }
  if (document.frmAMT_Details.txtCCNumber.value == "")
  {
      alert("Please enter your Credit/Debit Card Number.");
      document.frmAMT_Details.txtCCNumber.focus();
      return false;
  }
    
  if ((document.frmAMT_Details.optCCType.value != "Laser") && (document.frmAMT_Details.optCCType.value != "Switch"))
  {
      if (document.frmAMT_Details.txtCCCVVType.value == "")
      {
          alert("Please enter your CVV number.  This is the last three digits at the back of your card.");
          document.frmAMT_Details.txtCCCVVType.focus();
          return false;
      }
  }
  if (document.frmAMT_Details.optCCMonth.value == "None")
  {
      alert("Please complete the Credit Cards Expiry Date Details.");
      document.frmAMT_Details.optCCMonth.focus();
      return false;
  }
  if (document.frmAMT_Details.optCCYear.value == "None")
  {
      alert("Please complete the Credit Cards Expiry Date Details.");
      document.frmAMT_Details.optCCYear.focus();
      return false;
  }
 
  
  myDivPaymentButton = document.getElementById("PaymentButton");
  myDivPaymentProcessing = document.getElementById("PaymentProcessing");
			
  myDivPaymentButton.style.display = "none";
  myDivPaymentProcessing.style.display = "block";
  return true;

}

function CheckBTIForm_Step3()
{
	//Check Mandatory Fields
	if (document.frmMain.txtCompName.value == "")
	{
		alert("Please enter the companies name.");
		document.frmMain.txtCompName.focus();
		return false;
	}
	if (document.frmMain.txtAddress.value == "")
	{
		alert("Please enter the companies postal address.");
		document.frmMain.txtAddress.focus();
		return false;
	}
	if (document.frmMain.txtBusinessDesc.value == "")
	{
		alert("Please emter the companies business description.");
		document.frmMain.txtBusinessDesc.focus();
		return false;
	}
	if (document.frmMain.txtFirstName.value == "")
	{
		alert("Please enter a contact name for the company.");
		document.frmMain.txtFirstName.focus();
		return false;
	}
	if (document.frmMain.txtSurName.value == "")
	{
		alert("Please enter a contact name for the company.");
		document.frmMain.txtSurName.focus();
		return false;
	}
	if (document.frmMain.txtEmail.value == "")
	{
		alert("Please enter an email address for policy correspondence to be sent.");
		document.frmMain.txtEmail.focus();
		return false;
	}
	if (document.frmMain.txtNumDirectors.value == "")
	{
		alert("Please enter the number of directors on the policy.");
		document.frmMain.txtNumDirectors.focus();
		return false;
	}
	if (!IsValid(document.frmMain.txtNumDirectors.value,"0123456789"))
	{
		alert("Please enter a number for the amount of Directors on the policy.");
		document.frmMain.txtNumDirectors.focus();
		return false;
	}
	if (document.frmMain.txtNumStaff.value == "")
	{
		alert("Please enter the number of staff excluding directors on the policy.");
		document.frmMain.txtNumStaff.focus();
		return false;
	}
	if (!IsValid(document.frmMain.txtNumStaff.value,"0123456789"))
	{
		alert("Please enter a number for the amount of Staff excluding directors on the policy.");
		document.frmMain.txtNumStaff.focus();
		return false;
	}
	if (document.frmMain.txtCCName.value == "")
	{
      alert("Please enter the Credit/Debit Card Holders Name as it appears on their card.");
      document.frmMain.txtCCName.focus();
      return false;
	}
	if (document.frmMain.optCCType.value == "Select")
	{
      alert("Please select the card type");
      document.frmMain.optCCType.focus();
      return false;
	}
	if (document.frmMain.txtCCNumber.value == "")
	{
      alert("Please enter your Credit/Debit Card Number.");
      document.frmMain.txtCCNumber.focus();
      return false;
	}
    
	if ((document.frmMain.optCCType.value != "Laser") && (document.frmMain.optCCType.value != "Switch"))
	{
      if (document.frmMain.txtCCCVVType.value == "")
      {
          alert("Please enter your CVV number.  This is the last three digits at the back of your card.");
          document.frmMain.txtCCCVVType.focus();
          return false;
      }
	}
	if (document.frmMain.optCCMonth.value == "None")
	{
      alert("Please complete the Credit Cards Expiry Date Details.");
      document.frmMain.optCCMonth.focus();
      return false;
	}
	if (document.frmMain.optCCYear.value == "None")
	{
      alert("Please complete the Credit Cards Expiry Date Details.");
      document.frmMain.optCCYear.focus();
      return false;
	}
	
	myDivPaymentButton = document.getElementById("PaymentButton");
	myDivPaymentProcessing = document.getElementById("PaymentProcessing");
			
	myDivPaymentButton.style.display = "none";
	myDivPaymentProcessing.style.display = "block";
	return true;
}

function RecalculatePrice(AZeroGross,CountryCode,IPT,PolicyType)
{
	curSymbol = document.frmCalPrice.txtCurSymbol.value;

	
	if(document.forms['frmCalPrice'].txtPremier_RRPPrice_DisplayMiddle)
		if (!IsValid(document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.value,'0123456789.'))
		{
			alert("Please enter a valid gross profit.");
			document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.focus();
			return false;
		}
		
	if(document.forms['frmCalPrice'].txtPremierPlus_RRPPrice_DisplayMiddle)
		if (!IsValid(document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.value,'0123456789.'))
		{
			alert("Please enter a valid gross profit.");
			document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.focus();
			return false;
		}
		
		
	if (AZeroGross == 'Y')
	{
	
	}
	
	if (AZeroGross == 'NN') 
	{
	
		if (document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.value == 0)
			{
				alert("Gross profit can not be zero. Please change gross profit");
				document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.focus();
				return false;
			}
			
	  }
	   if (CountryCode == "Irl")
	   {
			if (PolicyType == "Premier")
			{
				SellingPrice = parseFloat(document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.value);
				NetPrice = parseFloat(document.frmCalPrice.txtPremier_TotalNetPrice.value);
				if ( SellingPrice < NetPrice)
				{
						//alert("middle pricde is " + document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.value + "\n net price is "+ document.frmCalPrice.txtPremier_TotalNetPrice.value);
						alert("Total price can't be less than total net price. Please change your total price");
						document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.focus();
						return false;
				}
				else
				{
					return false;
				}
			}	
			if (PolicyType == 'PremierPlus')
			{
				SellingPrice = parseFloat(document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.value);
				NetPrice = parseFloat(document.frmCalPrice.txtPremierPlus_TotalNetPrice.value);
				if ( SellingPrice < NetPrice )
				{
						//alert("middle pricde plus  is " + document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.value + "\n net price is "+ document.frmCalPrice.txtPremierPlus_TotalNetPrice.value);
						alert("Total price can't be less than total net price. Please change your total price");
						document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.focus();
						return false;
				}
				else
				{
					return false;
				}
			}
	   }
	   
	   if (CountryCode == "UK")
	   {
			
			
			if (PolicyType == "Premier")
			{
				var GrossProfit = document.frmCalPrice.txtPremier_RRPPrice_DisplayMiddle.value;
				if (GrossProfit == 0)
				{
					var TotalNetPr = document.frmCalPrice.txtPremier_TotalNetPrice.value;
					
					var NewNetPriceTax = (document.frmCalPrice.txtPremier_TotalNetPrice.value*IPT)/100;
					var NewNetPriceWithoutTax = document.frmCalPrice.txtPremier_TotalNetPrice.value - NewNetPriceTax;
					document.frmCalPrice.txtPremier_TotalNetPriceWithoutTax.value =  NewNetPriceWithoutTax.toFixed(2);
					document.frmCalPrice.txtPremier_TotalNetPrice.value = TotalNetPr;
					document.frmCalPrice.txtPremier_TotalTax.value =NewNetPriceTax.toFixed(2);
					//alert("gros profit is "+GrossProfit +"\n  tax is " +NewNetPriceTax +"\n price wihtout tax is "+ NewNetPriceWithoutTax +"\n ipt is " +IPT);
					
					return false;
				
				}
				
				else
				{
					
					var NewNetPriceTax = ((GrossProfit)/(IPT+100))*IPT;
										
					var NewNetPriceWithoutTax = GrossProfit - NewNetPriceTax;
					var NewNetPriceWithTax = NewNetPriceTax+NewNetPriceWithoutTax;
					//alert("gros profit is "+GrossProfit +"\n  tax is " +NewNetPriceTax +"\n price wihtout tax is "+ NewNetPriceWithoutTax +"\n ipt is " +IPT);
					document.frmCalPrice.txtPremier_TotalNetPriceWithoutTax.value =  NewNetPriceWithoutTax.toFixed(2);
					document.frmCalPrice.txtPremier_TotalNetPrice.value =  NewNetPriceWithTax.toFixed(2);
					document.frmCalPrice.txtPremier_TotalTax.value = NewNetPriceTax.toFixed(2);
					return false;
				}
			}
			if (PolicyType == 'PremierPlus')
			{
				
				
				GrossProfit = document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.value;
				if (GrossProfit == 0)
				{
					
					TotalNetPr = document.frmCalPrice.txtPremierPlus_TotalNetPrice.value;
					
					NewNetPriceTax = (document.frmCalPrice.txtPremierPlus_TotalNetPrice.value*IPT)/100;
					NewNetPriceWithoutTax = document.frmCalPrice.txtPremierPlus_TotalNetPrice.value - NewNetPriceTax;
					document.frmCalPrice.txtPremierPlus_TotalNetPriceWithoutTax.value = NewNetPriceWithoutTax;
					document.frmCalPrice.txtPremierPlus_TotalNetPrice.value = TotalNetPr;
					document.frmCalPrice.txtPremierPlus_TotalTax.value = NewNetPriceTax.toFixed(2);
					return false;
				
				}
				
				else
				{
					GrossProfit = document.frmCalPrice.txtPremierPlus_RRPPrice_DisplayMiddle.value;
					
				
					var NewNetPriceTax = ((GrossProfit)/(IPT+100))*IPT;
										
					var NewNetPriceWithoutTax = GrossProfit - NewNetPriceTax;
					var NewNetPriceWithTax = NewNetPriceTax+NewNetPriceWithoutTax;
					//alert("gros profit is "+GrossProfit +"\n  tax is " +NewNetPriceTax +"\n price wihtout tax is "+ NewNetPriceWithoutTax +"\n ipt is " +IPT);
					document.frmCalPrice.txtPremierPlus_TotalNetPriceWithoutTax.value = NewNetPriceWithoutTax.toFixed(2);
					document.frmCalPrice.txtPremierPlus_TotalNetPrice.value =  NewNetPriceWithTax.toFixed(2);
					document.frmCalPrice.txtPremierPlus_TotalTax.value =NewNetPriceTax.toFixed(2);
					return false;
				}
			}
			
	   }
	

}
function ChkFormSingle()
{
	if (document.frmSingle.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmSingle.optDestination.focus();
        return false;
    }
    
    //Check Dates
    DepartDate = document.frmSingle.optDepartDate.value+"/"+document.frmSingle.optDepartMonth.value+"/"+document.frmSingle.optDepartYear.value;
    ReturnDate = document.frmSingle.optReturnDate.value+"/"+document.frmSingle.optReturnMonth.value+"/"+document.frmSingle.optReturnYear.value;
    
    var one_day = 1000*60*60*24;
    
    var x = DepartDate.split("/");
    var y = ReturnDate.split("/");
    		
    var NewDepartDate = new Date(x[2],(x[1]-1),x[0]);
    var NewReturnDate = new Date(y[2],(y[1]-1),y[0]);
	
    Diff=Math.ceil((NewReturnDate.getTime() - NewDepartDate.getTime()) / (one_day));
    Diff = Diff + 1;
    if (Diff > 366)
    {
		alert("The maximum days allowed is 365.  Please reselect your return date.");
		document.frmSingle.optReturnDate.focus();
		return false;
	}
    //Checking that total persons is not 0
    /* if (document.frmSingle.SeniorPlus != null)
    {
		if (((document.frmSingle.Adult.value == "") || (document.frmSingle.Adult.value == "0")) && ((document.frmSingle.Senior.value == "") || (document.frmSingle.Senior.value == "0")) && ((document.frmSingle.SeniorPlus.value == "") || (document.frmSingle.SeniorPlus.value == "0")) && ((document.frmSingle.Children.value == "") || (document.frmSingle.Children.value == "0")) && ((document.frmSingle.Infant.value == "") || (document.frmSingle.Infant.value == "0")) && ((document.frmSingle.SeniorPlusPlus.value == "") || (document.frmSingle.SeniorPlusPlus.value == "0")) )
		{
			alert("Please enter the number of adults and/or children");
			document.frmSingle.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmSingle.Adult.value == "") || (document.frmSingle.Adult.value == "0")) && ((document.frmSingle.Senior.value == "") || (document.frmSingle.Senior.value == "0")) && ((document.frmSingle.Children.value == "") || (document.frmSingle.Children.value == "0")) && ((document.frmSingle.Infant.value == "") || (document.frmSingle.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmSingle.Adult.focus();
			return false;
		}
    }*/
    
    if(document.forms['frmSingle'].Adult)
    {
		if (!IsValid(document.frmSingle.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.Adult.focus();
			return false;
		}
	}
	
	if(document.forms['frmSingle'].Senior)
	{
		if (!IsValid(document.frmSingle.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.Senior.focus();
			return false;
		}
	}	
	
	if(document.forms['frmSingle'].SeniorPlus)
	{
		if (document.frmSingle.SeniorPlus != null)
		{
			if (!IsValid(document.frmSingle.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmSingle.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmSingle'].SeniorPlusPlus)
	{
		if (!IsValid(document.frmSingle.SeniorPlusPlus.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.SeniorPlusPlus.focus();
			return false;
		}
	}
	
	if(document.forms['frmSingle'].SeniorPlusPlusPlus)
	{
		if (!IsValid(document.frmSingle.SeniorPlusPlusPlus.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.SeniorPlusPlusPlus.focus();
			return false;
		}
	}
	
	if(document.forms['frmSingle'].Children)
	{
		if (!IsValid(document.frmSingle.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.Children.focus();
			return false;
		}
	}
	
	if(document.forms['frmSingle'].Infant)
	{
		if (!IsValid(document.frmSingle.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmSingle.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if(document.forms['frmSingle'].Adult)
	{
		if  (document.frmSingle.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmSingle.Adult.value);
		}
	}
	else
	{
		NAdults1 = 0;
	}
	
	if(document.forms['frmSingle'].Senior)
	{
		if (document.frmSingle.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmSingle.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;	
	}
	
	if(document.forms['frmSingle'].SeniorPlus)
	{
		if (document.frmSingle.SeniorPlus != null)
		{
			if (document.frmSingle.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmSingle.SeniorPlus.value);
			}
		}
		else
		{
			NAdults3 = 0;
		}
	}
	else
	{
		NAdults3 = 0;
	}
	if(document.forms['frmSingle'].SeniorPlusPlus)
	{
		if (document.frmSingle.SeniorPlusPlus != null)
		{
			if (document.frmSingle.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmSingle.SeniorPlusPlus.value);
			}
		}
		else
		{
			NAdults4 = 0;
		}
	}
	else
	{
		NAdults4 = 0;
	}
	if(document.forms['frmSingle'].SeniorPlusPlusPlus)
	{
		if (document.frmSingle.SeniorPlusPlusPlus != null)
		{
			if (document.frmSingle.SeniorPlusPlusPlus.value == "")
			{
				NAdults5 = 0;
			}
			else
			{
				NAdults5 = parseInt(document.frmSingle.SeniorPlusPlusPlus.value);
			}
		}
		else
		{
			NAdults5 = 0;
		}
	}
	else
	{
		NAdults5 = 0;
	}
	if(document.forms['frmSingle'].Children)
	{
		if (document.frmSingle.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmSingle.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmSingle'].Infant)
	{
		if (document.frmSingle.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmSingle.Infant.value);
		}
	}
	else
	{
		NInfant = 0;
	}			
    if (document.frmSingle.optPolType[0].checked == true) //Individual Selected
    {
    	TotalPax = NAdults1 + NAdults2 + NAdults3 + NChildren + NInfant;
		if (TotalPax > 99)
		{
			alert("Only a maximum of 99 persons can be selected on an individual policy.  Please reduce the amount of people you have entered.");
			document.frmSingle.Adult.focus();
			return false;
		}
			
	}
	All = NInfant + NChildren + NAdults5 +NAdults4 + NAdults3 + NAdults2 + NAdults1;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmSingle'].Adult)
			document.frmSingle.Adult.focus();	
		return false;
	}
	if (document.frmSingle.optPolType[1].checked == true) //Couple Selected
	{
		//Check for any children
		TotalChildrenPax = NChildren + NInfant;
		if (TotalChildrenPax > 0)
		{
			alert("Only adults can be selected on a couple policy.  Please change your cover to a family or individual to continue.");
			document.frmSingle.Children.focus();
			return false;
		}
		//Check Max of 2 Adults
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4 + NAdults5;
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a couple policy is two.  Please change your cover to individual.");
			document.frmSingle.Adult.focus();
			return false;
		}
	}
	if (document.frmSingle.optPolType[2].checked == true) //Family Selected
	{
		//Check that at least one adult
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4 + NAdults5;
		if (TotalAdultsPax < 1)
		{
			alert("At least one adult must be present on a family policy.  Please enter an adult or change your cover to individual.");
			document.frmSingle.Adult.focus();
			return false;
		}
		//Check that no more than two adults selected
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a family policy is two.  Please remove some adults from the policy or change your cover to individual.");
			document.frmSingle.Adult.focus();
			return false;
		}
		if ( (NAdults3 > 0) || (NAdults2 > 0) || (NAdults4 > 0) || (NAdults5 > 0))
		{
			alert("No Seniors are allowed on a family policy. Please change your cover to couple");
			return false;
		}
	}
   /* if (document.forms['frmSingle'].Senior)
		if (document.frmSingle.Senior != null)
		{
			if ((document.frmSingle.Senior.value != "") && (document.frmSingle.Senior.value != "0") && (document.frmSingle.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmSingle.Senior.focus();
				return false;
			}
		}
    if (document.forms['frmSingle'].SeniorPlus)
		if (document.frmSingle.SeniorPlus != null)
		{
			if ((document.frmSingle.SeniorPlus.value != "") && (document.frmSingle.SeniorPlus.value != "0") && (document.frmSingle.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmSingle.SeniorPlus.focus();
				return false;
			}
		}
    if(document.forms['frmSingle'].SeniorPlusPlus)
		if (document.frmSingle.SeniorPlusPlus != null)
		{
			if ((document.frmSingle.SeniorPlusPlus.value != "") && (document.frmSingle.SeniorPlusPlus.value != "0") && (document.frmSingle.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmSingle.SeniorPlusPlus.focus();
				return false;
			}
		}
		*/
    if (document.frmSingle.chkTerms.checked == false)
    {
        alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
    }
	return true;
}

function ChkFormTraining()
{
	if (document.frmTraining.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmTraining.optDestination.focus();
        return false;
    }
    
    //Check Dates
    DepartDate = document.frmTraining.optDepartDate.value+"/"+document.frmTraining.optDepartMonth.value+"/"+document.frmTraining.optDepartYear.value;
    ReturnDate = document.frmTraining.optReturnDate.value+"/"+document.frmTraining.optReturnMonth.value+"/"+document.frmTraining.optReturnYear.value;
    
    var one_day = 1000*60*60*24;
    
    var x = DepartDate.split("/");
    var y = ReturnDate.split("/");
    		
    var NewDepartDate = new Date(x[2],(x[1]-1),x[0]);
    var NewReturnDate = new Date(y[2],(y[1]-1),y[0]);
	
    Diff=Math.ceil((NewReturnDate.getTime() - NewDepartDate.getTime()) / (one_day));
    Diff = Diff + 1;
    if (Diff > 366)
    {
		alert("The maximum days allowed is 365.  Please reselect your return date.");
		document.frmTraining.optReturnDate.focus();
		return false;
	}
    //Checking that total persons is not 0
    /* if (document.frmTraining.SeniorPlus != null)
    {
		if (((document.frmTraining.Adult.value == "") || (document.frmTraining.Adult.value == "0")) && ((document.frmTraining.Senior.value == "") || (document.frmTraining.Senior.value == "0")) && ((document.frmTraining.SeniorPlus.value == "") || (document.frmTraining.SeniorPlus.value == "0")) && ((document.frmTraining.Children.value == "") || (document.frmTraining.Children.value == "0")) && ((document.frmTraining.Infant.value == "") || (document.frmTraining.Infant.value == "0")) && ((document.frmTraining.SeniorPlusPlus.value == "") || (document.frmTraining.SeniorPlusPlus.value == "0")) )
		{
			alert("Please enter the number of adults and/or children");
			document.frmTraining.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmTraining.Adult.value == "") || (document.frmTraining.Adult.value == "0")) && ((document.frmTraining.Senior.value == "") || (document.frmTraining.Senior.value == "0")) && ((document.frmTraining.Children.value == "") || (document.frmTraining.Children.value == "0")) && ((document.frmTraining.Infant.value == "") || (document.frmTraining.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmTraining.Adult.focus();
			return false;
		}
    }*/
    
    if(document.forms['frmTraining'].Adult)
    {
		if (!IsValid(document.frmTraining.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmTraining.Adult.focus();
			return false;
		}
	}
	
	if(document.forms['frmTraining'].Senior)
	{
		if (!IsValid(document.frmTraining.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmTraining.Senior.focus();
			return false;
		}
	}
	
	if(document.forms['frmTraining'].SeniorPlusPlus)
	{
		if (!IsValid(document.frmTraining.SeniorPlusPlus.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmTraining.SeniorPlusPlus.focus();
			return false;
		}
	}
	
	if(document.forms['frmTraining'].SeniorPlus)
	{
		if (document.frmTraining.SeniorPlus != null)
		{
			if (!IsValid(document.frmTraining.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmTraining.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmTraining'].Children)
	{
		if (!IsValid(document.frmTraining.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmTraining.Children.focus();
			return false;
		}
	}
	
	if(document.forms['frmTraining'].Infant)
	{
		if (!IsValid(document.frmTraining.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmTraining.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if(document.forms['frmTraining'].Adult)
	{
		if  (document.frmTraining.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmTraining.Adult.value);
		}
	}
	else
	{
		NAdults1 = 0;
	}
	
	if(document.forms['frmTraining'].Senior)
	{
		if (document.frmTraining.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmTraining.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;	
	}
	
	if(document.forms['frmTraining'].SeniorPlus)
	{
		if (document.frmTraining.SeniorPlus != null)
		{
			if (document.frmTraining.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmTraining.SeniorPlus.value);
			}
		}
		else
		{
			NAdults3 = 0;
		}
	}
	else
	{
		NAdults3 = 0;
	}
	if(document.forms['frmTraining'].SeniorPlusPlus)
	{
		if (document.frmTraining.SeniorPlusPlus != null)
		{
			if (document.frmTraining.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmTraining.SeniorPlusPlus.value);
			}
		}
		else
		{
			NAdults4 = 0;
		}
	}
	else
	{
		NAdults4 = 0;
	}
	if(document.forms['frmTraining'].Children)
	{
		if (document.frmTraining.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmTraining.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmTraining'].Infant)
	{
		if (document.frmTraining.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmTraining.Infant.value);
		}
	}
	else
	{
		NInfant = 0;
	}			
   
	All = NInfant + NChildren + +NAdults4 + NAdults3 + NAdults2 + NAdults1;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmTraining'].Adult)
			document.frmTraining.Adult.focus();	
		return false;
	}
	
    if (document.forms['frmTraining'].Senior)
		if (document.frmTraining.Senior != null)
		{
			if ((document.frmTraining.Senior.value != "") && (document.frmTraining.Senior.value != "0") && (document.frmTraining.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmTraining.Senior.focus();
				return false;
			}
		}
    if (document.forms['frmTraining'].SeniorPlus)
		if (document.frmTraining.SeniorPlus != null)
		{
			if ((document.frmTraining.SeniorPlus.value != "") && (document.frmTraining.SeniorPlus.value != "0") && (document.frmTraining.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmTraining.SeniorPlus.focus();
				return false;
			}
		}
    if(document.forms['frmTraining'].SeniorPlusPlus)
		if (document.frmTraining.SeniorPlusPlus != null)
		{
			if ((document.frmTraining.SeniorPlusPlus.value != "") && (document.frmTraining.SeniorPlusPlus.value != "0") && (document.frmTraining.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmTraining.SeniorPlusPlus.focus();
				return false;
			}
		}
    if (document.frmTraining.chkTerms.checked == false)
    {
        alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
    }
	return true;
}


function ChkFormJ()
{
	if (document.frmJ.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmJ.optDestination.focus();
        return false;
    }
    
    //Check Dates
    DepartDate = document.frmJ.optDepartDate.value+"/"+document.frmJ.optDepartMonth.value+"/"+document.frmJ.optDepartYear.value;
    ReturnDate = document.frmJ.optReturnDate.value+"/"+document.frmJ.optReturnMonth.value+"/"+document.frmJ.optReturnYear.value;
    
    var one_day = 1000*60*60*24;
    
    var x = DepartDate.split("/");
    var y = ReturnDate.split("/");
    		
    var NewDepartDate = new Date(x[2],(x[1]-1),x[0]);
    var NewReturnDate = new Date(y[2],(y[1]-1),y[0]);
	
    Diff=Math.ceil((NewReturnDate.getTime() - NewDepartDate.getTime()) / (one_day));
    Diff = Diff + 1;
    if (Diff > 366)
    {
		alert("The maximum days allowed is 365.  Please reselect your return date.");
		document.frmJ.optReturnDate.focus();
		return false;
	}
    //Checking that total persons is not 0
    /* if (document.frmJ.SeniorPlus != null)
    {
		if (((document.frmJ.Adult.value == "") || (document.frmJ.Adult.value == "0")) && ((document.frmJ.Senior.value == "") || (document.frmJ.Senior.value == "0")) && ((document.frmJ.SeniorPlus.value == "") || (document.frmJ.SeniorPlus.value == "0")) && ((document.frmJ.Children.value == "") || (document.frmJ.Children.value == "0")) && ((document.frmJ.Infant.value == "") || (document.frmJ.Infant.value == "0")) && ((document.frmJ.SeniorPlusPlus.value == "") || (document.frmJ.SeniorPlusPlus.value == "0")) )
		{
			alert("Please enter the number of adults and/or children");
			document.frmJ.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmJ.Adult.value == "") || (document.frmJ.Adult.value == "0")) && ((document.frmJ.Senior.value == "") || (document.frmJ.Senior.value == "0")) && ((document.frmJ.Children.value == "") || (document.frmJ.Children.value == "0")) && ((document.frmJ.Infant.value == "") || (document.frmJ.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmJ.Adult.focus();
			return false;
		}
    }*/
    
    if(document.forms['frmJ'].Adult)
    {
		if (!IsValid(document.frmJ.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmJ.Adult.focus();
			return false;
		}
	}
	
	if(document.forms['frmJ'].Senior)
	{
		if (!IsValid(document.frmJ.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmJ.Senior.focus();
			return false;
		}
	}
	
	if(document.forms['frmJ'].SeniorPlusPlus)
	{
		if (!IsValid(document.frmJ.SeniorPlusPlus.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmJ.SeniorPlusPlus.focus();
			return false;
		}
	}
	
	if(document.forms['frmJ'].SeniorPlus)
	{
		if (document.frmJ.SeniorPlus != null)
		{
			if (!IsValid(document.frmJ.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmJ.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmJ'].Children)
	{
		if (!IsValid(document.frmJ.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmJ.Children.focus();
			return false;
		}
	}
	
	if(document.forms['frmJ'].Infant)
	{
		if (!IsValid(document.frmJ.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmJ.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if(document.forms['frmJ'].Adult)
	{
		if  (document.frmJ.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmJ.Adult.value);
		}
	}
	else
	{
		NAdults1 = 0;
	}
	
	if(document.forms['frmJ'].Senior)
	{
		if (document.frmJ.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmJ.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;	
	}
	
	if(document.forms['frmJ'].SeniorPlus)
	{
		if (document.frmJ.SeniorPlus != null)
		{
			if (document.frmJ.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmJ.SeniorPlus.value);
			}
		}
		else
		{
			NAdults3 = 0;
		}
	}
	else
	{
		NAdults3 = 0;
	}
	if(document.forms['frmJ'].SeniorPlusPlus)
	{
		if (document.frmJ.SeniorPlusPlus != null)
		{
			if (document.frmJ.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmJ.SeniorPlusPlus.value);
			}
		}
		else
		{
			NAdults4 = 0;
		}
	}
	else
	{
		NAdults4 = 0;
	}
	if(document.forms['frmJ'].Children)
	{
		if (document.frmJ.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmJ.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmJ'].Infant)
	{
		if (document.frmJ.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmJ.Infant.value);
		}
	}
	else
	{
		NInfant = 0;
	}			
   
	All = NInfant + NChildren + +NAdults4 + NAdults3 + NAdults2 + NAdults1;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmJ'].Adult)
			document.frmJ.Adult.focus();	
		return false;
	}
	
    if (document.forms['frmJ'].Senior)
		if (document.frmJ.Senior != null)
		{
			if ((document.frmJ.Senior.value != "") && (document.frmJ.Senior.value != "0") && (document.frmJ.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmJ.Senior.focus();
				return false;
			}
		}
    if (document.forms['frmJ'].SeniorPlus)
		if (document.frmJ.SeniorPlus != null)
		{
			if ((document.frmJ.SeniorPlus.value != "") && (document.frmJ.SeniorPlus.value != "0") && (document.frmJ.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmJ.SeniorPlus.focus();
				return false;
			}
		}
    if(document.forms['frmJ'].SeniorPlusPlus)
		if (document.frmJ.SeniorPlusPlus != null)
		{
			if ((document.frmJ.SeniorPlusPlus.value != "") && (document.frmJ.SeniorPlusPlus.value != "0") && (document.frmJ.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmJ.SeniorPlusPlus.focus();
				return false;
			}
		}
    if (document.frmJ.chkTerms.checked == false)
    {
        alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
    }
	return true;
}



function ChkFormGroup()
{
	if (document.frmGroup.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmGroup.optDestination.focus();
        return false;
    }
    
    //Check Dates
    DepartDate = document.frmGroup.optDepartDate.value+"/"+document.frmGroup.optDepartMonth.value+"/"+document.frmGroup.optDepartYear.value;
    ReturnDate = document.frmGroup.optReturnDate.value+"/"+document.frmGroup.optReturnMonth.value+"/"+document.frmGroup.optReturnYear.value;
    
    var one_day = 1000*60*60*24;
    
    var x = DepartDate.split("/");
    var y = ReturnDate.split("/");
    		
    var NewDepartDate = new Date(x[2],(x[1]-1),x[0]);
    var NewReturnDate = new Date(y[2],(y[1]-1),y[0]);
	
    Diff=Math.ceil((NewReturnDate.getTime() - NewDepartDate.getTime()) / (one_day));
    Diff = Diff + 1;
    if (Diff > 366)
    {
		alert("The maximum days allowed is 365.  Please reselect your return date.");
		document.frmGroup.optReturnDate.focus();
		return false;
	}
    //Checking that total persons is not 0
    /* if (document.frmGroup.SeniorPlus != null)
    {
		if (((document.frmGroup.Adult.value == "") || (document.frmGroup.Adult.value == "0")) && ((document.frmGroup.Senior.value == "") || (document.frmGroup.Senior.value == "0")) && ((document.frmGroup.SeniorPlus.value == "") || (document.frmGroup.SeniorPlus.value == "0")) && ((document.frmGroup.Children.value == "") || (document.frmGroup.Children.value == "0")) && ((document.frmGroup.Infant.value == "") || (document.frmGroup.Infant.value == "0")) && ((document.frmGroup.SeniorPlusPlus.value == "") || (document.frmGroup.SeniorPlusPlus.value == "0")) )
		{
			alert("Please enter the number of adults and/or children");
			document.frmGroup.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmGroup.Adult.value == "") || (document.frmGroup.Adult.value == "0")) && ((document.frmGroup.Senior.value == "") || (document.frmGroup.Senior.value == "0")) && ((document.frmGroup.Children.value == "") || (document.frmGroup.Children.value == "0")) && ((document.frmGroup.Infant.value == "") || (document.frmGroup.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmGroup.Adult.focus();
			return false;
		}
    }*/
    
    if(document.forms['frmGroup'].Adult)
    {
		if (!IsValid(document.frmGroup.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmGroup.Adult.focus();
			return false;
		}
	}
	
	if(document.forms['frmGroup'].Senior)
	{
		if (!IsValid(document.frmGroup.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmGroup.Senior.focus();
			return false;
		}
	}
	
	if(document.forms['frmGroup'].SeniorPlusPlus)
	{
		if (!IsValid(document.frmGroup.SeniorPlusPlus.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmGroup.SeniorPlusPlus.focus();
			return false;
		}
	}
	
	if(document.forms['frmGroup'].SeniorPlus)
	{
		if (document.frmGroup.SeniorPlus != null)
		{
			if (!IsValid(document.frmGroup.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmGroup.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmGroup'].Children)
	{
		if (!IsValid(document.frmGroup.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmGroup.Children.focus();
			return false;
		}
	}
	
	if(document.forms['frmGroup'].Infant)
	{
		if (!IsValid(document.frmGroup.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmGroup.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if(document.forms['frmGroup'].Adult)
	{
		if  (document.frmGroup.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmGroup.Adult.value);
		}
	}
	else
	{
		NAdults1 = 0;
	}
	
	if(document.forms['frmGroup'].Senior)
	{
		if (document.frmGroup.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmGroup.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;	
	}
	
	if(document.forms['frmGroup'].SeniorPlus)
	{
		if (document.frmGroup.SeniorPlus != null)
		{
			if (document.frmGroup.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmGroup.SeniorPlus.value);
			}
		}
		else
		{
			NAdults3 = 0;
		}
	}
	else
	{
		NAdults3 = 0;
	}
	if(document.forms['frmGroup'].SeniorPlusPlus)
	{
		if (document.frmGroup.SeniorPlusPlus != null)
		{
			if (document.frmGroup.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmGroup.SeniorPlusPlus.value);
			}
		}
		else
		{
			NAdults4 = 0;
		}
	}
	else
	{
		NAdults4 = 0;
	}
	if(document.forms['frmGroup'].Children)
	{
		if (document.frmGroup.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmGroup.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmGroup'].Infant)
	{
		if (document.frmGroup.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmGroup.Infant.value);
		}
	}
	else
	{
		NInfant = 0;
	}			
    if (document.frmGroup.optPolType[0].checked == true) //Individual Selected
    {
    	TotalPax = NAdults1 + NAdults2 + NAdults3 + NChildren + NInfant;
		if (TotalPax > 99)
		{
			alert("Only a maximum of 99 persons can be selected on an individual policy.  Please reduce the amount of people you have entered.");
			document.frmGroup.Adult.focus();
			return false;
		}
			
	}
	All = NInfant + NChildren + +NAdults4 + NAdults3 + NAdults2 + NAdults1;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmGroup'].Adult)
			document.frmGroup.Adult.focus();	
		return false;
	}
	if (document.frmGroup.optPolType[1].checked == true) //Couple Selected
	{
		//Check for any children
		TotalChildrenPax = NChildren + NInfant;
		if (TotalChildrenPax > 0)
		{
			alert("Only adults can be selected on a couple policy.  Please change your cover to a family or individual to continue.");
			document.frmGroup.Children.focus();
			return false;
		}
		//Check Max of 2 Adults
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a couple policy is two.  Please change your cover to individual.");
			document.frmGroup.Adult.focus();
			return false;
		}
	}
	if (document.frmGroup.optPolType[2].checked == true) //Family Selected
	{
		//Check that at least one adult
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
		if (TotalAdultsPax < 1)
		{
			alert("At least one adult must be present on a family policy.  Please enter an adult or change your cover to individual.");
			document.frmGroup.Adult.focus();
			return false;
		}
		//Check that no more than two adults selected
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a family policy is two.  Please remove some adults from the policy or change your cover to individual.");
			document.frmGroup.Adult.focus();
			return false;
		}
	}
    if (document.forms['frmGroup'].Senior)
		if (document.frmGroup.Senior != null)
		{
			if ((document.frmGroup.Senior.value != "") && (document.frmGroup.Senior.value != "0") && (document.frmGroup.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmGroup.Senior.focus();
				return false;
			}
		}
    if (document.forms['frmGroup'].SeniorPlus)
		if (document.frmGroup.SeniorPlus != null)
		{
			if ((document.frmGroup.SeniorPlus.value != "") && (document.frmGroup.SeniorPlus.value != "0") && (document.frmGroup.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmGroup.SeniorPlus.focus();
				return false;
			}
		}
    if(document.forms['frmGroup'].SeniorPlusPlus)
		if (document.frmGroup.SeniorPlusPlus != null)
		{
			if ((document.frmGroup.SeniorPlusPlus.value != "") && (document.frmGroup.SeniorPlusPlus.value != "0") && (document.frmGroup.chkPMI.checked == false))
			{
				alert("Seniors must have private medical insurance to purchase this travel insurance.");
				document.frmGroup.SeniorPlusPlus.focus();
				return false;
			}
		}
    if (document.frmGroup.chkTerms.checked == false)
    {
        alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
    }
	return true;
}
function ChkFormBackpacker()
{
	if (document.frmBackpacker.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmBackpacker.optDestination.focus();
        return false;
    }
    //Check Dates
    DepartDate = document.frmBackpacker.optDepartDate.value+"/"+document.frmBackpacker.optDepartMonth.value+"/"+document.frmBackpacker.optDepartYear.value;
    ReturnDate = document.frmBackpacker.optReturnDate.value+"/"+document.frmBackpacker.optReturnMonth.value+"/"+document.frmBackpacker.optReturnYear.value;
    
    var one_day = 1000*60*60*24;
    
    var x = DepartDate.split("/");
    var y = ReturnDate.split("/");
    
    var NewDepartDate = new Date(x[2],(x[1]-1),x[0]);
    var NewReturnDate = new Date(y[2],(y[1]-1),y[0]);
    
    Diff=Math.ceil((NewReturnDate.getTime() - NewDepartDate.getTime()) / (one_day));
    Diff = Diff + 1;
    if (Diff > 366)
    {
		alert("The maximum days allowed is 365.  Please reselect your return date.");
		document.frmBackpacker.optReturnDate.focus();
		return false;
	}
	
    if ((document.frmBackpacker.Adult.value == "") || (document.frmBackpacker.Adult.value == "0"))
    {
        alert("Please enter the number of adults.");
        document.frmBackpacker.Adult.focus();
        return false;
    }
	
	if (!IsValid(document.frmBackpacker.Adult.value,'0123456789 '))
	{
		alert("Please enter the correct number of adults you wish to include on the travel insurance policy.");
		document.frmBackpacker.Adult.focus();
		return false;
	}
    if (document.frmBackpacker.chkTerms.checked == false)
    {
        alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
    }
	return true;
}

function ChkFormBT()
{
	if (document.frmBT.optCoverLevel.value == "None")
	{
		alert("Please select travel product.");
		document.frmBT.optCoverLevel.focus();
		return false;
	}
	
	//Terms and Condition Boxes have been ticked
	//if (!document.frmBT.chkManualWork.checked)
	//{
	//	alert("Please tick the box to confirm that none of the insured persons are involved in Manual Work.");
	//	document.frmBT.chkManualWork.focus();
	//	return false;
	//}
	if (!document.frmBT.chkExclProfessions.checked)
	{
		alert("Please tick the box to confirm that the company is not involved in any of the areas of work listed below.");
		document.frmBT.chkExclProfessions.focus();
		return false;
	}
				
	return true;
}

function ChkFormAnnual()
{
	
	if (document.frmAnnual.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmAnnual.optDestination.focus();
        return false;
    }
    
    if (document.frmAnnual.optAMTStartDate != null)
    {
		//Check Dates
		DateNow = document.frmAnnual.txtToday.value;
		StartDate = document.frmAnnual.optAMTStartDate.value+"/"+document.frmAnnual.optAMTStartMonth.value;
		
		var one_day = 1000*60*60*24;
		
		var x = DateNow.split("/");
		var y = StartDate.split("/");
		
		var NewDateNow = new Date(x[2],(x[1]-1),x[0]);
		var NewStartDate = new Date(y[2],(y[1]-1),y[0]);
		
		Diff = Math.ceil((NewStartDate.getTime() - NewDateNow.getTime()) / (one_day));
		Diff = Diff + 1;
		if (Diff < 1) 
		{
			alert("You cannot backdate your annual multi trip policy.  Please re-select your start date.");
			document.frmAnnual.optAMTStartDate.focus();
			return false;
		}
		if (Diff > 90)
		{
			alert("The maximum you are allowed to forward your start date is 90 Days.  Please re-select your start date.");
			document.frmAnnual.optAMTStartDate.focus();
			return false;
		}
    }
    //Checking that total persons is not 0
    
    /*if (document.frmAnnual.SeniorPlus != null)
    {
		if (((document.frmAnnual.Adult.value == "") || (document.frmAnnual.Adult.value == "0")) && ((document.frmAnnual.Senior.value == "") || (document.frmAnnual.Senior.value == "0")) && ((document.frmAnnual.SeniorPlus.value == "") || (document.frmAnnual.SeniorPlus.value == "0")) && ((document.frmAnnual.Children.value == "") || (document.frmAnnual.Children.value == "0")) && ((document.frmAnnual.Infant.value == "") || (document.frmAnnual.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmAnnual.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmAnnual.Adult.value == "") || (document.frmAnnual.Adult.value == "0")) && ((document.frmAnnual.Senior.value == "") || (document.frmAnnual.Senior.value == "0")) && ((document.frmAnnual.Children.value == "") || (document.frmAnnual.Children.value == "0")) && ((document.frmAnnual.Infant.value == "") || (document.frmAnnual.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmAnnual.Adult.focus();
			return false;
		}
    }*/
    
    if(document.forms['frmAnnual'].Adult)
    {
		if (!IsValid(document.frmAnnual.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Adult.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].Senior)
	{
		if (!IsValid(document.frmAnnual.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Senior.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].SeniorPlus)
	{
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (!IsValid(document.frmAnnual.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmAnnual.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmAnnual'].Children)
	{
		if (!IsValid(document.frmAnnual.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Children.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].Infant)
	{
		if (!IsValid(document.frmAnnual.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if (document.forms['frmAnnual'].Adult)
	{
		if  (document.frmAnnual.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmAnnual.Adult.value);
		}
	}
	else
	{
		NAdults1 = 0;
	}
	
	if(document.forms['frmAnnual'].Senior)
	{
		if (document.frmAnnual.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmAnnual.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;
	}
	
	if(document.forms['frmAnnual'].SeniorPlus)
	{
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (document.frmAnnual.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmAnnual.SeniorPlus.value);
			}
		}
	}
	else
	{
		NAdults3 = 0;
	}
	
	if(document.forms['frmAnnual'].SeniorPlusPlus)
	{
		if (document.frmAnnual.SeniorPlusPlus != null)
		{
			if (document.frmAnnual.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmAnnual.SeniorPlusPlus.value);
			}
		}
	}
	else
	{
		NAdults4 = 0;
	}
	
	if(document.forms['frmAnnual'].Children)
	{
		if (document.frmAnnual.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmAnnual.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmAnnual'].Infant)
	{
		if (document.frmAnnual.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmAnnual.Infant.value);
		}
	}
	else 
	{
		NInfant = 0;
	}
	
	All = NInfant + NChildren + NAdults4 + NAdults3 + NAdults2 + NAdults1;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmAnnual'].Adult)
			document.frmAnnual.Adult.focus();
		return false;
	}
	if (document.frmAnnual.optPolType[0].checked == true) //Individual Selected
    {
    	TotalPax = NAdults1 + NAdults2 + NAdults3 + NAdults4 + NChildren + NInfant;
		if (TotalPax > 1)
		{
			alert("Only one person can be selected on an individual policy.  Please change your Cover to Couple or Family or alternatively change the amount of people you have entered.");
			document.frmAnnual.Adult.focus();
			return false;
		}
	}
	if (document.frmAnnual.optPolType[2] != null)
	{
		if (document.frmAnnual.optPolType[1].checked == true) //Couple Selected
		{
			//Check for any children
			TotalChildrenPax = NChildren + NInfant;
			if (TotalChildrenPax > 0)
			{
				alert("Only adults can be selected on a couple policy.  Please change your cover to a family or individual to continue.");
				document.frmAnnual.Children.focus();
				return false;
			}
			//Check Max of 2 Adults
			TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
			if (TotalAdultsPax > 2)
			{
				alert("The maximum adults allowed on a couple policy is two.  Please change your cover to individual.");
				document.frmAnnual.Adult.focus();
				return false;
			}
			if (TotalAdultsPax <2)
			{
				alert("The correct amount of adults on a couple policy is two. Please change your cover to individual or change number of adults.");
				document.frmAnnual.Adult.focus();
				return false;
			}
		}
		
	}
	else
	{
		if (document.frmAnnual.optPolType[1].checked == true) //Family Selected
	{
		//Check that at least one adult
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
		if (TotalAdultsPax < 1)
		{
			alert("At least one adult must be present on a family policy.  Please enter an adult or change your cover to individual.");
			document.frmAnnual.Adult.focus();
			return false;
		}
		//Check that no more than two adults selected
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a family policy is two.  Please remove some adults from the policy or change your cover to individual.");
			document.frmAnnual.Adult.focus();
			return false;
		}
		//No senior on family policy
		if ( (NAdults3 > 0) || (NAdults2 > 0) || (NAdults4 > 0))
		{
			alert("No Seniors are allowed on a family policy. Please change your cover to couple");
			return false;
		}
	}
	}
	if (document.frmAnnual.optPolType[2] != null)
		if (document.frmAnnual.optPolType[2].checked == true) //Family Selected
		{
			//Check that at least one adult
			TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
			if (TotalAdultsPax < 1)
			{
				alert("At least one adult must be present on a family policy.  Please enter an adult or change your cover to individual.");
				document.frmAnnual.Adult.focus();
				return false;
			}
			//Check that no more than two adults selected
			if (TotalAdultsPax > 2)
			{
				alert("The maximum adults allowed on a family policy is two.  Please remove some adults from the policy or change your cover to individual.");
				document.frmAnnual.Adult.focus();
				return false;
			}
			//No senior on family policy
			if ( (NAdults3 > 0) || (NAdults2 > 0) || (NAdults4 > 0))
			{
				alert("No Seniors are allowed on a family policy. Please change your cover to couple");
				return false;
			}
		}
    if (document.forms['frmAnnual'].Senior)
    {
		if (document.frmAnnual.Senior != null)
		{
			/*if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.Senior.value != "") && (document.frmAnnual.Senior.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Senior must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.Senior.focus();
						return false;
					}
				}
			}*/
			
			if (document.frmAnnual.optWS[0] != null )
			{
				if ((document.frmAnnual.Senior.value != "") && (document.frmAnnual.Senior.value != "0") && (document.frmAnnual.optWS[0].checked == true))
				{
					alert("Wintersports is not allowed for Adults aged 66-69.  Please remove wintersports to continue.");
				
					document.frmAnnual.optWS[1].focus();
					return false;
				}
			}
		}
	}
    if(document.forms['frmAnnual'].SeniorPlus)
    {
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Senior must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.SeniorPlus.focus();
						return false;
					}
				}
			}
			if (document.frmAnnual.optWS[0] != null)
			{
				if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.optWS[0].checked == true))
				{
					alert("Wintersports is not allowed for Seniors.  Please remove wintersports to continue.");
					document.frmAnnual.optWS[1].focus();
					return false;
				}
			}
		}
    }
     if(document.forms['frmAnnual'].SeniorPlusPlus)
    {
		if (document.frmAnnual.SeniorPlusPlus != null)
		{
			if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Adults over the age of 70 must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.SeniorPlus.focus();
						return false;
					}
				}
			}
			if ((document.frmAnnual.SeniorPlusPlus.value != "") && (document.frmAnnual.SeniorPlusPlus.value != "0") && (document.frmAnnual.optWS[0].checked == true))
			{
				alert("Wintersports is not allowed for Seniors.  Please remove wintersports to continue.");
				document.frmAnnual.optWS[1].focus();
				return false;
			}
			
		}
    }
    
    if (document.frmAnnual.chkTerms.checked == false)
    {
		alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
     }
    return true;
}


function ChkFormAnnualGRA()
{
	
	
	if (document.frmAnnual.optDestination.value == "None")
    {
		alert("Please select your destination.");
        document.frmAnnual.optDestination.focus();
        return false;
    }
    
    if (document.frmAnnual.optAMTStartDate != null)
    {
		//Check Dates
		DateNow = document.frmAnnual.txtToday.value;
		StartDate = document.frmAnnual.optAMTStartDate.value+"/"+document.frmAnnual.optAMTStartMonth.value;
		
		var one_day = 1000*60*60*24;
		
		var x = DateNow.split("/");
		var y = StartDate.split("/");
		
		var NewDateNow = new Date(x[2],(x[1]-1),x[0]);
		var NewStartDate = new Date(y[2],(y[1]-1),y[0]);
		
		Diff = Math.ceil((NewStartDate.getTime() - NewDateNow.getTime()) / (one_day));
		Diff = Diff + 1;
		if (Diff < 1) 
		{
			alert("You cannot backdate your annual multi trip policy.  Please re-select your start date.");
			document.frmAnnual.optAMTStartDate.focus();
			return false;
		}
		if (Diff > 90)
		{
			alert("The maximum you are allowed to forward your start date is 90 Days.  Please re-select your start date.");
			document.frmAnnual.optAMTStartDate.focus();
			return false;
		}
    }
    //Checking that total persons is not 0
    
    /*if (document.frmAnnual.SeniorPlus != null)
    {
		if (((document.frmAnnual.Adult.value == "") || (document.frmAnnual.Adult.value == "0")) && ((document.frmAnnual.Senior.value == "") || (document.frmAnnual.Senior.value == "0")) && ((document.frmAnnual.SeniorPlus.value == "") || (document.frmAnnual.SeniorPlus.value == "0")) && ((document.frmAnnual.Children.value == "") || (document.frmAnnual.Children.value == "0")) && ((document.frmAnnual.Infant.value == "") || (document.frmAnnual.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmAnnual.Adult.focus();
			return false;
        }
	}
    else
    {
		if (((document.frmAnnual.Adult.value == "") || (document.frmAnnual.Adult.value == "0")) && ((document.frmAnnual.Senior.value == "") || (document.frmAnnual.Senior.value == "0")) && ((document.frmAnnual.Children.value == "") || (document.frmAnnual.Children.value == "0")) && ((document.frmAnnual.Infant.value == "") || (document.frmAnnual.Infant.value == "0")))
		{
			alert("Please enter the number of adults and/or children.");
			document.frmAnnual.Adult.focus();
			return false;
		}
    }*/
    
    if (document.forms['frmAnnual'].chkConfirmStudent)
	{
		if (document.frmAnnual.chkConfirmStudent.checked == false)
		{
			alert("Confirm that the children aged 19-23 are in full time education.");
			return false;
		}
	}
	if(document.forms['frmAnnual'].Adult)
    {
		if (!IsValid(document.frmAnnual.Adult.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Adult.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].Senior)
	{
		if (!IsValid(document.frmAnnual.Senior.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Senior.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].SeniorPlus)
	{
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (!IsValid(document.frmAnnual.SeniorPlus.value,'0123456789 '))
			{
				alert("Please enter a number or leave blank");
				document.frmAnnual.SeniorPlus.focus();
				return false;
			}
		}
	}
	
	if(document.forms['frmAnnual'].Children)
	{
		if (!IsValid(document.frmAnnual.Children.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Children.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].ChildrenStudent)
	{
		if (!IsValid(document.frmAnnual.ChildrenStudent.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.ChildrenStudent.focus();
			return false;
		}
	}
	if(document.forms['frmAnnual'].Infant)
	{
		if (!IsValid(document.frmAnnual.Infant.value,'0123456789 '))
		{
			alert("Please enter a number or leave blank");
			document.frmAnnual.Infant.focus();
			return false;
		}
	}
	//Count People on Policy
	if (document.forms['frmAnnual'].Adult)
	{
		if  (document.frmAnnual.Adult.value == "")
		{
			NAdults1 = 0;
		}
		else
		{
			NAdults1 = parseInt(document.frmAnnual.Adult.value);
		}
		
	}
	else
	{
		NAdults1 = 0;
	}
	
	if (document.forms['frmAnnual'].ChildrenStudent)
	{
		if (document.frmAnnual.ChildrenStudent.value == "")
		{
				NAdultStudent = 0;
		}
		else
		{
			
			NAdultStudent = parseInt(document.frmAnnual.ChildrenStudent.value);
		}
	}
	else
	{
		NAdultStudent = 0;
	}
	if(document.forms['frmAnnual'].Senior)
	{
		if (document.frmAnnual.Senior.value == "")
		{
			NAdults2 = 0;
		}
		else
		{
			NAdults2 = parseInt(document.frmAnnual.Senior.value);
		}
	}
	else
	{
		NAdults2 = 0;
	}
	
	if(document.forms['frmAnnual'].SeniorPlus)
	{
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (document.frmAnnual.SeniorPlus.value == "")
			{
				NAdults3 = 0;
			}
			else
			{
				NAdults3 = parseInt(document.frmAnnual.SeniorPlus.value);
			}
		}
	}
	else
	{
		NAdults3 = 0;
	}
	
	if(document.forms['frmAnnual'].SeniorPlusPlus)
	{
		if (document.frmAnnual.SeniorPlusPlus != null)
		{
			if (document.frmAnnual.SeniorPlusPlus.value == "")
			{
				NAdults4 = 0;
			}
			else
			{
				NAdults4 = parseInt(document.frmAnnual.SeniorPlusPlus.value);
			}
		}
	}
	else
	{
		NAdults4 = 0;
	}
	
	if(document.forms['frmAnnual'].Children)
	{
		if (document.frmAnnual.Children.value == "")
		{
			NChildren = 0;
		}
		else
		{
			NChildren = parseInt(document.frmAnnual.Children.value);
		}
	}
	else
	{
		NChildren = 0;
	}
	if(document.forms['frmAnnual'].Infant)
	{
		if (document.frmAnnual.Infant.value == "")
		{
			NInfant = 0;
		}
		else
		{
			NInfant = parseInt(document.frmAnnual.Infant.value);
		}
	}
	else 
	{
		NInfant = 0;
	}
	
	All = NInfant + NChildren + NAdults4 + NAdults3 + NAdults2 + NAdults1 + NAdultStudent;
	if (All == 0)
	{
		alert("Please enter the number of adults and/or children.");
		if (document.forms['frmAnnual'].Adult)
			document.frmAnnual.Adult.focus();
		return false;
	}
	if (document.frmAnnual.optPolType[0].checked == true) //Individual Selected
    {
    	TotalPax = NAdults1 + NAdults2 + NAdults3 + NAdults4 + NChildren + NInfant + NAdultStudent;
		//alert(NAdults1 + " " + NAdults2 + " " + NAdults3 + " " + NAdults4 + " " + NInfant + " " + NAdultStudent);
		if (TotalPax > 1 )
		{
			alert("Only one person can be selected on an individual policy.  Please change your Cover to Couple or Family or alternatively change the amount of people you have entered.");
			document.frmAnnual.Adult.focus();
			return false;
		}
	}
	
	if (document.frmAnnual.optPolType[1].checked == true) //Family Selected
	{
		//Check that at least one adult
		TotalAdultsPax = NAdults1 + NAdults2 + NAdults3 + NAdults4;
		if (TotalAdultsPax < 1)
		{
			alert("At least one adult must be present on a family policy.  Please enter an adult or change your cover to individual.");
			document.frmAnnual.Adult.focus();
			return false;
		}
		//Check that no more than two adults selected
		if (TotalAdultsPax > 2)
		{
			alert("The maximum adults allowed on a family policy is two.  Please remove some adults from the policy or change your cover to individual.");
			document.frmAnnual.Adult.focus();
			return false;
		}
		//No senior on family policy
		
	
	}
	
    if (document.forms['frmAnnual'].Senior)
    {
		if (document.frmAnnual.Senior != null)
		{
			/*if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.Senior.value != "") && (document.frmAnnual.Senior.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Senior must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.Senior.focus();
						return false;
					}
				}
			}*/
			
			if (document.frmAnnual.optWS[0] != null )
			{
				if ((document.frmAnnual.Senior.value != "") && (document.frmAnnual.Senior.value != "0") && (document.frmAnnual.optWS[0].checked == true))
				{
					alert("Wintersports is not allowed for Adults aged 66-69.  Please remove wintersports to continue.");
				
					document.frmAnnual.optWS[1].focus();
					return false;
				}
			}
		}
	}
    if(document.forms['frmAnnual'].SeniorPlus)
    {
		if (document.frmAnnual.SeniorPlus != null)
		{
			if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Senior must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.SeniorPlus.focus();
						return false;
					}
				}
			}
			if (document.frmAnnual.optWS[0] != null)
			{
				if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.optWS[0].checked == true))
				{
					alert("Wintersports is not allowed for Seniors.  Please remove wintersports to continue.");
					document.frmAnnual.optWS[1].focus();
					return false;
				}
			}
		}
    }
     if(document.forms['frmAnnual'].SeniorPlusPlus)
    {
		if (document.frmAnnual.SeniorPlusPlus != null)
		{
			if (document.frmAnnual.chkPMI != null)
			{
				if (document.frmAnnual.chkPMI.value != "")
				{
					if ((document.frmAnnual.SeniorPlus.value != "") && (document.frmAnnual.SeniorPlus.value != "0") && (document.frmAnnual.chkPMI.checked == false))
					{
						alert("Adults over the age of 70 must have private medical insurance to purchase this travel insurance.");
						document.frmAnnual.SeniorPlus.focus();
						return false;
					}
				}
			}
			if ((document.frmAnnual.SeniorPlusPlus.value != "") && (document.frmAnnual.SeniorPlusPlus.value != "0") && (document.frmAnnual.optWS[0].checked == true))
			{
				alert("Wintersports is not allowed for Seniors.  Please remove wintersports to continue.");
				document.frmAnnual.optWS[1].focus();
				return false;
			}
			
		}
    }
    
    if (document.frmAnnual.chkTerms.checked == false)
    {
		alert("Please tick the box to confirm that you have read and agree with the Terms & Conditions.");
        return false;
     }
    return true;
}
function SubmitFirstForm(frm)
{
	
	
		
	
	switch (frm)
	{
		case "S":
			if (ChkFormSingle())
			{
				document.frmSingle.submit();
			}
			break;
		case "B":
			if (ChkFormBackpacker())
			{
				document.frmBackpacker.submit();
			}
			break;
		case "G":
			if (ChkFormGroup())
			{
				document.frmGroup.submit();
			}
			break;
		case "T":
			if (ChkFormTraining())
			{	
				document.frmTraining.submit();
			}
			break;
		case "J":
			if (ChkFormJ())
			{	
				document.frmJ.submit();
			}
			break;
		case "BT":
			if (ChkFormBT())
			{	
				document.frmBT.submit();
			}
			break;
		case "MyPolicy":
			if (chkMyPolicyLogin())
			{
				document.frmMyPolicyLogin.submit();
			}
			break;
		case "MyQuote":
			if (chkMyQuoteLogin())
			{
				document.frmMyQuote.submit();
			}
			break;
		case "CallCentre":
	        if (chkCallCentreLogin())
	        {
			    document.frmCallCentreLogin.submit();			   
			}
			break;
		case "AGRA":
			{
			if (ChkFormAnnualGRA())
			{
				document.frmAnnual.submit();
			}
			break;
			}
		default:
			if (ChkFormAnnual())
			{
				document.frmAnnual.submit();
			}
			break;
	}
}


function GenOverLib(Message,Caption)
{
	return overlib(Message,WIDTH,290,CSSCLASS,FULLHTML,VAUTO,HAUTO);

}

function openWindow()
{
	window.open("http://www.blueinsurance.ie/common/TermsandConditions.asp","TermsandConditions","menubar=0,resizable=0,scrollbars=1,width=550,height=350,left=550,top=280");
}

function CheckPMI(PMIType)
{
	var PMI = eval('document.frmAMT_Details.'+PMIType+'.value');
	var PMIR = eval('document.frmAMT_Details.'+PMIType);
	var i = PMI.indexOf(":N");
	if (i != -1 )
	{
		alert(PMI.substring(0,PMI.indexOf(":N")) + " is not allowed. Please select different PMI.");
		PMIR.selectedIndex = 0;
		return false;
	}

}

function CheckPMI(PMIType,FormName)
{
	var PMI = eval('document.'+FormName+'.'+PMIType+'.value');
	var PMIR = eval('document.'+FormName+'.'+PMIType);
	var i = PMI.indexOf(":N");
	if (i != -1 )
	{
		alert(PMI.substring(0,PMI.indexOf(":N")) + " is not allowed. Please select different PMI.");
		PMIR.selectedIndex = 0;
		return false;
	}

}

function signal(target_id) {
	var query = window.location.search.substring(1);
	var halves = query.split("AgencyID=");
	var id = halves[1].substring(0,2);
	if (id == target_id) parent.location = 'http://www.clubworldtravel.com/index.html#signal';
}

function ChkIfStudent() {
	
		if (document.frmAnnual.ChildrenStudent.value != "")
		{
			if (IsValid(document.frmAnnual.ChildrenStudent.value,'0123456789 '))
			{
				//document.getElementById("ConfirmStudent").innerHTML = "<li><input type='checkbox' name='chkConfirmStudent' > Confirm that your children if full time student</li>";
				document.getElementById("ConfirmStudent").innerHTML = "<input type='checkbox' name='chkConfirmStudent' > Confirm that the children aged 19-23 are in full time education.";
			}
			else
			{
				document.getElementById("ConfirmStudent").innerHTML = "";
			}
		}
		else
			{
				document.getElementById("ConfirmStudent").innerHTML = "";
			}
		
	
}

function UpdateDate(What,WhichForm)
	{
		len = eval("document."+WhichForm+".optDepart"+What+".length");
		var i = ""
		for (i = 0; i <=len-1; i ++)
		{
			if (eval("document."+WhichForm+".optDepart"+What+"["+i+"].selected"))
			{
				var e = eval("document."+WhichForm+".optReturn"+What+"["+i+"]");
				e.selected = true;
			}
		}
	}