function validate(f)
{
   if ( f.show[0].selected )
   {
      alert("Please select a show night.");
      f.fname.focus();
      return (false);
   }
   if ( f.adult.value < 1 && f.student.value < 1 && f.senior.value < 1 && f.balcony1.value < 1 && f.balcony2.value < 1 && f.balcony3.value < 1 && f.season1.value < 1 && f.season2.value < 1)
   {
      alert("Please select the number of tickets.");
      f.adult.focus();
      return (false);
   }

   if ( f.adult.value > 14 || f.student.value > 14 || f.senior.value > 14 || f.balcony1.value > 14 || f.balcony2.value > 14 || f.balcony2.value > 14 )
   {
      alert("Please call the Box Office at (514) 804-4900 for Group Rates.");
      f.adult.focus();
      return (false);
   }

   var amt=0;
   
   amt = parseInt(f.adult.value) + parseInt(f.student.value) + parseInt(f.senior.value) + parseInt(f.balcony1.value) + parseInt(f.balcony2.value) + parseInt(f.balcony3.value);
   if ( amt > 14 )
   {
      alert("Total number of tickets exceed 15. Please call the Box Office at (514) 804-4900 for Group Rates.");
      f.adult.focus();
      return (false);
   }
   if ( f.fname.value.length == 0 )
   {
      alert("Please enter a First Name.");
      f.fname.focus();
      return (false);
   }
   if ( f.lname.value.length == 0 )
   {
      alert("Please enter a Last Name.");
      f.lname.focus();
      return (false);
   }
   if ( f.email.value.length == 0 )
   {
      alert("Please enter an Email Address.");
      f.email.focus();
      return (false);
   }
   if ( f.phone.value.length == 0 )
   {
      alert("Please enter a Telephone Number.");
      f.phone.focus();
      return (false);
   }
   if ( f.address1.value.length == 0 )
   {
      alert("Please enter an Address.");
      f.address1.focus();
      return (false);
    }
    if ( f.city.value.length == 0 )
    {
       alert("Please enter a City.");
       f.city.focus();
       return (false);
    }
    if  ( f.pcode.value.length == 0 )
    {
       alert("Please enter a Postal Code.");
       f.pcode.focus();
       return (false);
    }

    if ( f.student.value > 0 && (f.show[1].selected || f.show[5].selected || f.show[6].selected) )
    {
       alert("Student rates are only available on Sat. Matinee/Sun. Matinee/Thu. only");
       f.student.focus();
       return (false);
     }

    if ( f.senior.value > 0 && (f.show[1].selected || f.show[5].selected || f.show[6].selected) )
    {
       alert("Senior rates are only available on Sat. Matinee/Sun. Matinee/Thu. only");
       f.senior.focus();
       return (false);
    }

    if ( f.balcony2.value > 0 && (f.show[1].selected || f.show[5].selected || f.show[6].selected) )
    {
       alert("Reduced Balcony rates are only available on Sat. Matinee/Sun. Matinee/Thu. only");
       f.balcony2.focus();
       return (false);
    }

    if ( f.balcony3.value > 0 && (f.show[1].selected || f.show[5].selected || f.show[6].selected) )
    {
       alert("Reduced Balcony rates are only available on Sat. Matinee/Sun. Matinee/Thu. only");
       f.balcony3.focus();
       return (false);
    }

    if ( (f.pref[4].selected || f.pref[5].selected) && (f.adult.value > 0 || f.student.value > 0 || f.senior.value > 0))
    {
       alert("Seating preference (Balcony seating) does not match number of tickets (Orchestra rate).");
       f.balcony1.focus();
       return (false);
    }

    if ( (f.pref[1].selected || f.pref[2].selected || f.pref[3].selected) && (f.balcony1.value > 0 || f.balcony2.value > 0 || f.balcony3.value > 0) )
    {
       alert("Seating preference (Orchestra seating) does not match number of tickets (Balcony rate).");
       f.balcony1.focus();
       return (false);
    }

    if ( f.season2.value > 0 && (f.show[1].selected || f.show[5].selected || f.show[6].selected) )
    {
       alert("Student/Senior rate for Season's tickets are only available on Sat. Matinee/Sun. Matinee/Thu. only");
       f.season2.focus();
       return (false);
    }



    // Everything is good
    f.submit();
}


function dototal(f)
{
   var ttl=0;	
   ttl=(parseInt(f.adult.value)*25)+(parseInt(f.student.value)*18)+(parseInt(f.senior.value)*18)+(parseInt(f.balcony1.value)*23)+(parseInt(f.balcony2.value)*16)+(parseInt(f.balcony3.value)*16)+(parseInt(f.season1.value)*55)+(parseInt(f.season2.value)*40);
   f.total.value=ttl+".00";
}


function opencaptcha()
{
   window.open('http://llo.org/captcha.html', 'Captcha', 'toolbar=0,status=0,resizable=1,width=500,height=300,scrollbars=yes')

}
