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 validateRegistrationData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok

	
  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 - this will be your username\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 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.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 (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 validateAccomData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.accomname.value == "")
    errorMsg += 'The name of your Accommodation is required.\n';
	
  if (form.country.value == "0")
    errorMsg += 'Please select a country in which the accommodation operates.\n';
	
  if (form.areas.value == "0" && form.otherarea.value == "")
    errorMsg += 'Please give the area in which the accommodation 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 (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 validateCafeData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  // Test that all the required fields are filled out ok
  if (form.cafename.value == "")
    errorMsg += 'The name of your Establishment is required.\n';
	
  if (form.country.value == "0")
    errorMsg += 'Please select a country in which the establishment operates.\n';
	
  if (form.areas.value == "0" && form.otherarea.value == "")
    errorMsg += 'Please give the area in which the establishment operates.\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 validateTripData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  // Test that all the required fields are filled out ok
  if (form.tripname.value == "")
    errorMsg += 'The name of your Trip / Tour / Excursion is required.\n';
	
  if (form.country.value == "0")
    errorMsg += 'Please select a country in which the Trip/Tour/Excursion operates.\n';
  if (form.areas.value == "0" && form.otherarea.value == "")
    errorMsg += 'Please give the area in which the Trip/Tour/Excursion operates.\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 validateJobData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  // Test that all the required fields are filled out ok
  if (form.jobtitle.value == "")
    errorMsg += 'A Job Title is required.\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 validateRegistrationData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok

	
  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 - this will be your username\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 validateCompetitionAnswer(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
  	
  if (form.answer.value == "")
    errorMsg += 'Please enter your answer.\n';
	
  if (form.member_id.value == "1" || form.member_id.value == "")
    errorMsg += 'You must be logged in as a member to enter this competition\n';
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function validateMemberProfile(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
	
  if (form.member_id.value == "1" || form.member_id.value == "")
    errorMsg += 'You must be logged in as a member to do this\n';
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function validateMessage(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
	
  if (form.tomembers.value == "")
  {
    errorMsg += 'You must define at least 1 member or non-member to receive this message.\n';
	form.tomembers.focus();
	form.tomembers.select();
  }
  
  if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function checkMemberLoggedIn(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Check that the member is logged in and (not the Demo User)
  if (form.member_id.value == "1" || form.member_id.value == "")
    errorMsg += 'You must be logged in as a member to do this\n';
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function checkJournalEntry(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Check that the member is logged in and (not the Demo User)
  //if (form.member_id.value == "1" || form.member_id.value == "")
  if (form.member_id.value == "0" || form.member_id.value == "")
    errorMsg += 'You must be logged in as a member to do this\n';
	
  if (form.title.value == "")
      errorMsg += 'Please enter a title for your Journal entry';
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function checkformLogEntry(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Check that the member is logged in and (not the Demo User)
  if (form.member_id.value == "1" || form.member_id.value == "")
    errorMsg += 'You must be logged in as a member to do this.\n';
	
  if (form.body.value == "")
  {
	  errorMsg += 'Please enter some text in your Tracking Log entry.';
	  form.body.focus();
	  form.body.select();
  }
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}


function checkSuggestion(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
	
  if (form.name.value == "")
      errorMsg += 'Please enter a name for your suggestion';
	  
	  
	  
  if (form.Email.value != "" )
  {
	x = form.Email.value.indexOf('@');
	y = form.Email.value.indexOf('.');

    if (x < 1 || x == (form.Email.value.length-1) || y < 1 ) 
	{
	  errorMsg += 'The email address does not appear valid - please check.\n';
	  form.Email.focus();
	  form.Email.select();
	}
	  
    s = form.Email.value.indexOf(' ');
    if (s != -1)
	{
	  errorMsg += 'The email address should not contain or have leading/trailing spaces \n';
	  form.Email.focus();
	  form.Email.select();
	}
  }	
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}

function checkBoardEntry(form,tcode) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Check that the member is logged in and (not the Demo User)
  if ( (form.member_id.value == "1") || (form.member_id.value) == "" || (form.member_id == "0") )
    errorMsg += 'You must be logged in as a member to do this\n';
	
  if (form.topic_id.value == "" || form.topic_id.value == "0" )
    errorMsg += 'There appears to be no topic associated with this posting\n';
	
  if (form.subject.value == "")
      errorMsg += 'Please enter a Subject for your posting\n';
	  
  if (form.textcode.value != tcode)
    errorMsg += 'Please copy the security characters into the box provided.\n';
	
   if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}


function validatePhotoData(form) 
{
  //alert('Checking form...');
  var errorMsg = '';
  
  // Test that all the required fields are filled out ok
	
  //if (form.title.value == "")
  //{
  //  errorMsg += 'Please give a title for your photo\n';
  //}
    
  badChar = "'";
  if ( form.albumcategory.value.indexOf(badChar) >=0  )
  {
     errorMsg += 'Please do not use quotes in the Album name\n';
  }
  
  badChar = "\"";
  if ( form.albumcategory.value.indexOf(badChar) >=0  )
  {
     errorMsg += 'Please do not use quotes in the Album name\n';
  }
  
  if (errorMsg) 
	alert('\n'+errorMsg);
		
  document.returnValue = (errorMsg == '');
}


function checkReview(form) 
{
  Msg = 'Thank you, your comments will appear as soon as we can process them\n';
  if (Msg) 
	alert('\n'+Msg);
  document.returnValue = (true);
}
