/****************************************************************************
eBIT-Site
-------------------
Copyright 2006 - 2009 Davide Zaccaria davide@ottoeotto.com

This file is part of eBIT-Site, a module of the framework POMO.

eBIT-Site is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

eBIT-Site is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with eBIT-Site.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
  mydate = new Date();
  var this_day = mydate.getDate();
  var this_month = mydate.getMonth()+1;
  var this_year = mydate.getFullYear();

//alert(this_day+" "+this_month + " "+ this_year);
$(function() {
  // validate signup form on keyup and submit
  var validator = $("#reqform").validate({
    rules: {
			'fields[company]': "required",
			'fields[tel]': "required",
			'fields[adr]': "required",
			'fields[pro]': "required",
			req_pdata: "required",
      'fields[email]': {
        required: true,
        email: true
      }
    },
    messages: {
      'fields[company]': {
        required: "&nbsp; Inserire un nome o un'azienda"
      },
      'fields[tel]': {
        required: "&nbsp; Inserire il telefono"
      },
      'fields[adr]': {
        required: "&nbsp; Inserire l'indirizzo"
      },
      'fields[pro]': {
        required: "&nbsp; Inserire la provincia"
      },
      'fields[email]': {
        required: "&nbsp; Inserire l'e-mail",
        email: "&nbsp; Inserire un indirizzo valido"
      },
			req_pdata: " "
    },
    // the errorPlacement has to take the table layout into account
    errorPlacement: function(error, element) {
      if ( element.is(":checkbox") )
        error.appendTo ( element.next() );
      else
        error.appendTo( element.parent().next() );
    },
    // set this class to error-labels to indicate valid fields
    success: function(label) {
      // set &nbsp; as text for IE
      label.html("&nbsp;").addClass("checked");
    }
  });
});
