







var colors = new Array('red', 'blue', 'green');
var i=0;







$(document).ready(function(){

$.validator.addMethod("phone", function(ph, element) {
   if (ph == null) {
	return false;
   }
   var stripped = ph.replace(/[\s()+-]|ext\.?/gi, "");
   return ((/\d{9,}/i).test(stripped));
}, "Please enter a valid phone number");
$.validator.addMethod("url", function(ph, element) {
   if (ph == null) {
	return false;
   }
   
   if(ph == 'http://') return true;

	var urlRegxp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
        
	if (urlRegxp.test(ph) != true) {
		return false;
	} else {
		return true;
	}   

}, "Please enter a valid phone number");


      
    $("#contactForm").validate({
	rules: {
            name: {
                required:true,
                minlength: 5
            },
            company: {
                required:true,
                minlength: 3
            },            
            position: {
                required:true,
                minlength: 5
            },
            phone: {
                    required: true,
                    phone: true
                    
            },
            mail: {
                    required: true,
                    email: true
            }
	},
	messages: {
		name: "Proszę wpisać swoje dane",
		position: "Proszę wpisać stanowisko",
		mail: "Proszę wpisać poprawny e-mail",
		tresc: "Proszę wpisać treść wiadomości",
		phone: "Proszę wpisać poprawny numer",
                company: "Proszę wpisać nazwę firmy"
	}
    });

  
   $('.submit').hover(function(){
      
      $(this).addClass('hover')
   },function(){
      $(this).removeClass('hover')
   })

});


 






