/****************************************************************************
eBIT-Site
-------------------
Copyright 2006, 2007, 2008 Davide Zaccaria, Orazio Langenbach

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/>.
****************************************************************************/

$(function() {
  // validate signup form on keyup and submit
  var validator = $("#quotationform").validate({
    rules: {
      'fields[email]': {
        required: true,
        email: true
      }
    },
    messages: {
      'fields[email]': {
        required: "&nbsp; Inserire l'e-mail",
        email: "&nbsp; Inserire un inidrizzo valido"
      }
    },
    // the errorPlacement has to take the table layout into account
    errorPlacement: function(error, element) {
        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");
    }
  });
});
