<!--
/* <![CDATA[ */

function FeedbackValidation(theForm,theDetails)
{
if(theDetails.indexOf("Title")!=-1)
{ 
// Title
  if (theForm.Title.selectedIndex < 0)
  {
    alert("Please select one of the \"Title\" options.");
    theForm.Title.focus();
    return (false);
  }

  if (theForm.Title.selectedIndex == 0)
  {
    alert("The first \"Title\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Title.focus();
    return (false);
  }
}

if(theDetails.indexOf("Firstname")!=-1)
{
   // FistName
  if (theForm.Firstname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.Firstname.focus();
    return (false);
  }

  if (theForm.Firstname.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"First Name\" field.");
    theForm.Firstname.focus();
    return (false);
  }

  if (theForm.Firstname.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"First Name\" field.");
    theForm.Firstname.focus();
    return (false);
  }
}

if(theDetails.indexOf("Surname")!=-1)
{
// Surname
  if (theForm.Surname.value == "")
  {
    alert("Please enter a value for the \"Surname\" field.");
    theForm.Surname.focus();
    return (false);
  }

  if (theForm.Surname.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Surname\" field.");
    theForm.Surname.focus();
    return (false);
  }

  if (theForm.Surname.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"Surname\" field.");
    theForm.Surname.focus();
    return (false);
  }
}

if(theDetails.indexOf("Email")!=-1)
{ 
//Email
  if (theForm.Email.value == "")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@._";
  var checkStr = theForm.Email.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  
  var i = 1;
  var sLength = checkStr.length;
  
  // look for @
  while ((i < sLength) && (checkStr.charAt(i) != "@"))
  { i++;}
  diff=sLength-i;
  if(diff<1)
  {
     alert("You have not used an \"@\" symbol in your email address.Please use one.")
     theForm.Email.focus();
     return (false);
  }
  
  // look for .
  i = 1;
  while ((i < sLength) && (checkStr.charAt(i) != "."))
  { i++;}
  diff=sLength-i;
  if(diff<1)
  {
     alert("You have not used an \".\" symbol in your email address.Please use one.")
     theForm.Email.focus();
     return (false);
  }
  
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"@._\" characters in the \"Email Address\" field.");
    theForm.Email.focus();
    return (false);
  }
}

if(theDetails.indexOf("JobTitle")!=-1)
{ 
// JobTitle
  if (theForm.JobTitle.value == "")
  {
    alert("Please enter a value for the \"Job Title\" field.");
    theForm.JobTitle.focus();
    return (false);
  }

  if (theForm.JobTitle.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Job Title\" field.");
    theForm.JobTitle.focus();
    return (false);
  }
}

if(theDetails.indexOf("Company")!=-1)
{ 
// Company
  if (theForm.Company.value == "")
  {
    alert("Please enter a value for the \"Company\" field.");
    theForm.Company.focus();
    return (false);
  }

  if (theForm.Company.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Company\" field.");
    theForm.Company.focus();
    return (false);
  }
}

if(theDetails.indexOf("CompanyType")!=-1)
{ 
// CompanyType

  if (theForm.CompanyType.selectedIndex < 0)
  {
    alert("Please select one of the \"Company Type\" options.");
    theForm.CompanyType.focus();
    return (false);
  }

  if (theForm.CompanyType.selectedIndex == 0)
  {
    alert("The first \"Company Type\" option is not a valid selection.  Please choose one of the other options.");
    theForm.CompanyType.focus();
    return (false);
  }
}

if(theDetails.indexOf("AddressStreet")!=-1)
{ 
// Street Address
  if (theForm.AddressStreet.value == "")
  {
    alert("Please enter a value for the \"Street Address\" field.");
    theForm.AddressStreet.focus();
    return (false);
  }

  if (theForm.AddressStreet.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Street Address\" field.");
    theForm.AddressStreet.focus();
    return (false);
  }

  if (theForm.AddressStreet.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Street Address\" field.");
    theForm.AddressStreet.focus();
    return (false);
  }
}

if(theDetails.indexOf("AddressCity")!=-1)
{ 
// City
  if (theForm.AddressCity.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.AddressCity.focus();
    return (false);
  }

  if (theForm.AddressCity.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"City\" field.");
    theForm.AddressCity.focus();
    return (false);
  }

  if (theForm.AddressCity.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"City\" field.");
    theForm.AddressCity.focus();
    return (false);
  }
}

if(theDetails.indexOf("AddressState")!=-1)
{ 
// State
  if (theForm.AddressState.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.AddressState.focus();
    return (false);
  }

  if (theForm.AddressState.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.AddressState.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"State\" field.");
    theForm.AddressState.focus();
    return (false);
  }  
}

if(theDetails.indexOf("AddressCountry")!=-1)
{ 
// Country

  if (theForm.AddressCountry.selectedIndex < 0)
  {
    alert("Please select one of the \"Country\" options.");
    theForm.AddressCountry.focus();
    return (false);
  }

  if (theForm.AddressCountry.selectedIndex == 0)
  {
    alert("The first \"Country\" option is not a valid selection.  Please choose one of the other options.");
    theForm.AddressCountry.focus();
    return (false);
  }
}

if(theDetails.indexOf("AddressPostCode")!=-1)
{ 
// Postcode
  if (theForm.AddressPostCode.value == "")
  {
    alert("Please enter a value for the \"Postcode\" field.");
    theForm.AddressPostCode.focus();
    return (false);
  }

  if (theForm.AddressPostCode.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Postcode\" field.");
    theForm.AddressPostCode.focus();
    return (false);
  }

  if (theForm.AddressPostCode.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Postcode\" field.");
    theForm.Postcode.focus();
    return (false);
  }  
}

if(theDetails.indexOf("PhoneHome")!=-1)
{  
// Telephone
  if (theForm.PhoneHome.value == "")
  {
    alert("Please enter a value for the \"Telephone\" field.");
    theForm.PhoneHome.focus();
    return (false);
  }

  if (theForm.PhoneHome.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Telephone\" field.");
    theForm.PhoneHome.focus();
    return (false);
  }

  if (theForm.PhoneHome.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Telephone\" field.");
    theForm.PhoneHome.focus();
    return (false);
  }
}

if(theForm.PhoneHome && !RF_CheckGenericPhoneNumber(theForm.PhoneHome.value))
{
	alert("Please enter at valid phone number.");
	theForm.PhoneHome.focus();
	return (false);
}

if(theDetails.indexOf("PhoneMobile")!=-1)
{  
// Mobile Phone
  if (theForm.PhoneMobile.value == "")
  {
    alert("Please enter a value for the \"Mobile Phone\" field.");
    theForm.PhoneMobile.focus();
    return (false);
  }

  if (theForm.PhoneMobile.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Mobile Phone\" field.");
    theForm.PhoneMobile.focus();
    return (false);
  }

  if (theForm.PhoneMobile.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Mobile Phone\" field.");
    theForm.PhoneMobile.focus();
    return (false);
  }
}
if(theForm.PhoneMobile && !RF_CheckGenericPhoneNumber(theForm.PhoneMobile.value))
{
	alert("Please enter at valid phone number.");
	theForm.PhoneMobile.focus();
	return (false);
}

if(theDetails.indexOf("Gender")!=-1)
{ 
// Gender
  if (theForm.Gender.selectedIndex < 0)
  {
    alert("Please select one of the \"Gender\" options.");
    theForm.Gender.focus();
    return (false);
  }

  if (theForm.Gender.selectedIndex == 0)
  {
    alert("The first \"Gender\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Gender.focus();
    return (false);
  }
}

if(theDetails.indexOf("AgeBracket")!=-1)
{ 
// AgeBracket

  if (theForm.AgeBracket.selectedIndex < 0)
  {
    alert("Please select one of the \"Age Bracket\" options.");
    theForm.AgeBracket.focus();
    return (false);
  }

  if (theForm.AgeBracket.selectedIndex == 0)
  {
    alert("The first \"Age Bracket\" option is not a valid selection.  Please choose one of the other options.");
    theForm.AgeBracket.focus();
    return (false);
  }
}

if(theDetails.indexOf("FeedbackCategoryID")!=-1)
{ 
//FeedbackCategoryID
  if (theForm.FeedbackCategoryID.selectedIndex < 0)
  {
    alert("Please select a \"Feedback Category\".");
    theForm.FeedbackCategoryID.focus();
    return (false);
  }

  if (theForm.FeedbackCategoryID.selectedIndex == 0)
  {
    alert("Please select a \"Feedback Category\".");
    theForm.FeedbackCategoryID.focus();
    return (false);
  }
}

if(theDetails.indexOf("Comments")!=-1)
{ 
//Comments
 if (theForm.Comments.value == "")
  {
    alert("Please enter a \"Comment\".");
    theForm.Comments.focus();
    return (false);
  }

  if (theForm.Comments.value.length < 1)
  {
    alert("Please enter a \"Comment\".");
    theForm.Comments.focus();
    return (false);
  }
  
  if (theForm.Comments.value.indexOf("http://") != -1)
  {
    alert("Please do not enter URLs using the http:// prefix. Enter URLs without this prefix.");
    theForm.Comments.focus();
    return (false);
  }
}

  if(theForm.btnSubmit)
     theForm.btnSubmit.disabled = true;

  return (true);
}
/* ]]> */
//-->
