function isEurozoneCountry(strCountry) 
{
   var strUC = strCountry.toUpperCase();
   
   return ((strUC == "AUSTRIA")    || (strUC == "BELGIUM")     || (strUC == "GERMANY")  || (strUC == "SPAIN")   ||
           (strUC == "FRANCE")     || (strUC == "FINLAND")     || (strUC == "GREECE")   || (strUC == "IRELAND") ||
		   (strUC == "LUXEMBOURG") || (strUC == "NETHERLANDS") || (strUC == "PORTUGAL"))
}

function validateBusinessData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.business.value == "")
    errorMsg += 'The name of your business is required.\n';
	
  if (form.contact.value == "")
    errorMsg += 'A contact name is required.\n';
	
  if (form.tel.value == "")
    errorMsg += 'A telephone number is required.\n';
	
  if (form.country.value == "" || form.country.value=="0")
    errorMsg += 'Please select a country where the business is resident.\n';
	
  if (form.password.value == "")
  {
    errorMsg += 'A password is required.\n';
    form.password.focus();
  }
	
  if (form.password.value != form.confirm.value) 
  {
    errorMsg += 'The password and confirmation do not match - please re-enter.\n';
	form.password.focus();
  }
  
  if (form.Email.value == "" )
  {
    errorMsg += 'An Email address is required\n';
	form.Email.focus();
  }
  else
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid email address.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check the email address. It should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   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 IsInteger(sText)
{
   var ValidChars = "0123456789";
   var IsInteger=true;
   var Char;
   for (i = 0; i < sText.length && IsInteger == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsInteger = false;
         }
      }
   return IsInteger;
}


function validateTourAccomData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.touraccomname.value == "")
    errorMsg += 'The name of your Accommodation or Cycling tour/base is required.\n';
	
  if (form.country.value == "0")
    errorMsg += 'Please select a country in which the accommodation or cycling operates.\n';
	
  if (form.areas.value == "0" && form.otherarea.value == "")
    errorMsg += 'Please give the area in which the accommodation or cycling operates.\n';
	
  if ( !IsInteger(form.sleepsmax.value) )
  {
     errorMsg += 'Please give the Sleeps Maximum value as a whole number - without other symbols or spaces.\n';
	 form.sleepsmax.focus();
	 form.sleepsmax.select();
  }

  if ( !IsInteger(form.doubles.value) )
  {
     errorMsg += 'Please give the Doubles value as a whole number - without other symbols or spaces.\n';
	 form.doubles.focus();
	 form.doubles.select();
  }
  
  if ( !IsInteger(form.twins.value) )
  {
     errorMsg += 'Please give the Twins value as a whole number - without other symbols or spaces.\n';
	 form.twins.focus();
	 form.twins.select();
  }
  
  if ( !IsInteger(form.singles.value) )
  {
     errorMsg += 'Please give the Singles value as a whole number - without other symbols or spaces.\n';
	 form.singles.focus();
	 form.singles.select();
  }
  
    
  if ( !IsInteger(form.cots.value) )
  {
     errorMsg += 'Please give the Cots value as a whole number - without other symbols or spaces.\n';
	 form.cots.focus();
	 form.cots.select();
  }
	 
	 	
  if ( !IsNumeric(form.price_from_gbp.value) )
  {
     errorMsg += 'Please give prices without currency symbols, spaces or commas.\n';
 	 form.price_from_gbp.focus();
	 form.price_from_gbp.select();
  }
  
  if ( !IsNumeric(form.price_from_usd.value) )
  {
     errorMsg += 'Please give prices without currency symbols, spaces or commas.\n';
 	 form.price_from_usd.focus();
	 form.price_from_usd.select();
  }
	 
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
   else if (!confirm('Are you sure these are the details you wish to submit?'))
	      errorMsg = 'notconfirmed';
	
  document.returnValue = (errorMsg == '');
}

function validateBranchData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.branchname.value == "")
    errorMsg += 'The branch name is required.\n';
	
  if (form.country.value == "0")
    errorMsg += 'Please select a country in which this branch is based.\n';
	
  if (form.areas.value == "0" && form.otherarea.value == "")
    errorMsg += 'Please give the cycling area nearest to this branch.\n';  
	 
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
   else if (!confirm('Are you sure these are the details you wish to submit?'))
	      errorMsg = 'notconfirmed';
	
	
  document.returnValue = (errorMsg == '');
}


function validateFormData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.firstname.value == "")
    errorMsg += 'Your first name is required.\n';
	
  if (form.tel.value == "")
    errorMsg += 'Your telephone number is required.\n';
	
  if (form.Email.value == "" )
  {
    errorMsg += 'An Email address is required\n';
	form.Email.focus();
  }
  else
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid email address.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check your email address. It should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
  document.returnValue = (errorMsg == '');
}

function validateSubscriberData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';

  if (form.Email.value == "" )
  {
    errorMsg += 'An email address is required\n';
	form.Email.focus();
  }
  else
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid email address.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check your email address. It should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
  document.returnValue = (errorMsg == '');
}

function validateEnquiryData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.Email.value == "" )
  {
    errorMsg += 'An Email address is required\n';
	form.Email.focus();
  }
  else
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'You must give a valid email address.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'Please check the email address. It should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
  
  if (form.Enquiry.value == "" )
  {
    errorMsg += 'Please enter your enquiry\n';
	form.Enquiry.focus();
  }
  
  //alert('Enquiry = '+ form.Enquiry.value);
   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}


function validateBusinessEdit(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.business.value == "")
    errorMsg += 'The name of your business is required.\n';
	
  if (form.contact.value == "")
    errorMsg += 'A contact name is required.\n';
	
  if (form.tel.value == "")
    errorMsg += 'A telephone number is required.\n';
	
  if (form.country.value == "" || form.country.value=="0")
    errorMsg += 'Please select a country where the business is resident.\n';
	
  if (form.password.value == "")
  {
    errorMsg += 'A password is required.\n';
    form.password.focus();
  }


   if (errorMsg) 
	alert('Required form fields:\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}
