<!--
/* <![CDATA[ */

function FeedbackValidation(theForm,theDetails)
{
if(theDetails.indexOf("txtSurname1")!=-1)
{
// Surname
  if (theForm.txtSurname1.value == "")
  {
    alert("Please enter a value for the first \"Surname\" field.");
    theForm.txtSurname1.focus();
    return (false);
  }

  if (theForm.txtSurname.value.length < 1)
  {
    alert("Please enter at least 1 characters in the first \"Surname\" field.");
    theForm.txtSurname1.focus();
    return (false);
  }

  if (theForm.txtSurname1.value.length > 25)
  {
    alert("Please enter at most 25 characters in the first \"Surname\" field.");
    theForm.txtSurname1.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtEmail")!=-1)
{ 
//txtAddress1
  if (theForm.txtEmail.value == "")
  {
    alert("Please enter a value for the first \"Email Address\" field.");
    theForm.txtEmail.focus();
    return (false);
  }

  if (theForm.txtEmail.value.length < 5)
  {
    alert("Please enter at least 5 characters in the first \"Email Address\" field.");
    theForm.txtEmail.focus();
    return (false);
  }

  if (theForm.txtEmail.value.length > 100)
  {
    alert("Please enter at most 100 characters in the first \"Email Address\" field.");
    theForm.txtEmail.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@._";
  var checkStr = theForm.txtEmail.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.txtEmail.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.txtEmail.focus();
     return (false);
  }
  
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"@._\" characters in the \"Email Address\" field.");
    theForm.txtEmail.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtAddress1")!=-1)
{ 
// txtAddress1
  if (theForm.txtAddress1.value == "")
  {
    alert("Please enter a value for the \"Address Line 1\" field.");
    theForm.txtAddress1.focus();
    return (false);
  }

  if (theForm.txtAddress1.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Address Line 1\" field.");
    theForm.txtAddress1.focus();
    return (false);
  }
  if (theForm.txtAddress1.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Address Line 1\" field.");
    theForm.txtAddress1.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtSuburb")!=-1)
{ 
// txtSuburb
  if (theForm.txtSuburb.value == "")
  {
    alert("Please enter a value for the \"Suburb\" field.");
    theForm.txtSuburb.focus();
    return (false);
  }

  if (theForm.txtSuburb.value.length < 1)
  {
    alert("Please enter at least 1 character in the \"Suburb\" field.");
    theForm.txtSuburb.focus();
    return (false);
  }
  if (theForm.txtSuburb.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Suburb\" field.");
    theForm.txtSuburb.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtState")!=-1)
{ 
// txtState

  if (theForm.txtState.selectedIndex < 0)
  {
    alert("Please select one of the \"State\" options.");
    theForm.txtState.focus();
    return (false);
  }

  if (theForm.txtState.selectedIndex == 0)
  {
    alert("A blank \"State\" option is not a valid selection.  Please choose one of the other options.");
    theForm.txtState.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtPostcode")!=-1)
{ 
// txtPostcode
  if (theForm.txtPostcode.value == "")
  {
    alert("Please enter a value for the \"Postcode\" field.");
    theForm.txtPostcode.focus();
    return (false);
  }

  if (theForm.txtPostcode.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Postcode\" field.");
    theForm.txtPostcode.focus();
    return (false);
  }

  if (theForm.txtPostcode.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"Postcode\" field.");
    theForm.txtPostcode.focus();
    return (false);
  }
}

if(theDetails.indexOf("txtCountry")!=-1)
{ 
// txtCountry

  if (theForm.txtCountry.selectedIndex < 0)
  {
    alert("Please select one of the \"Country\" options.");
    theForm.txtCountry.focus();
    return (false);
  }

  if (theForm.txtCountry.selectedIndex == 0)
  {
    alert("The first \"Country\" option is not a valid selection.  Please choose one of the other options.");
    theForm.txtCountry.focus();
    return (false);
  }
}
  return (true);
}
/* ]]> */
//-->
