<!-- hide JS code
 var justValidating = true
 function validateForm(form)  // validate form data
  {

if (form.name){
	 if (!validatename(form.name.value))   // verify firstnames blank?
   {
    form.name.focus()
    return false
    }
}
  
if (form.email){
	 if (!validateEMail(form.email.value))   // verify firstnames blank?
   {
    form.email.focus()
    return false
    }
}  

if (form.occasion){
	 if (!validateoccasion(form.occasion.value))   // verify firstnames blank?
   {
    form.occasion.focus()
    return false
    }
}  

if (form.date_time){
	 if (!validatedate_time(form.date_time.value))   // verify firstnames blank?
   {
    form.date_time.focus()
    return false
    }
}  

if (form.description){
	 if (!validatedescription(form.description.value))   // verify firstnames blank?
   {
    form.description.focus()
    return false
    }
}  


} 

// functions below 

function validatename(name)
  {
  if (isBlank(name))               // first name field blank?
    {
    alert("Please enter your name")
    return false
    }
  return true
  }  

function validateEMail(email)
  {
  if (isBlank(email))                       // email blank?
    {
    alert("Please enter your email address")
    return false
    }
  var atsignPos = email.indexOf("@", 0)     // check for @
  if (atsignPos == -1)	
    {
    alert("Enter a valid email address with an @, please!")
    return false
    }
  if (email.indexOf(".", atsignPos) == -1)  // check for . after @	
    {
    alert("Enter a valid email domain after the @, please!")
    return false
    }
  return true
  }
    
function validateoccasion(occasion)
  {
  if (isBlank(occasion))               // first name field blank?
    {
    alert("Please enter the type of occasion you visited Olley's for, for example - retirement party ")
    return false
    }
  return true
  }  
  	
function validatedate_time(date_time)
  {
  if (isBlank(date_time))               // first name field blank?
    {
    alert("Please enter the date and time that you visited Olley's ")
    return false
    }
  return true
  }  
  	
function validatedescription(description)
  {
  if (isBlank(description))               // first name field blank?
    {
    alert("Please enter your review")
    return false
    }
  return true
  }  
  	
function isBlank(testStr)
  {
  if (testStr.length == 0)                     // nothing entered?
    return true
  for (var i = 0; i <= testStr.length-1; i++)  // all spaces?
    if (testStr.charAt(i) != " ")
      return false
  return true
  }
  
// end JS hide -->
