/**
 *
 * jQuery functions
 * Author: Jakub Samulski CSIN (www.enter-price.pl)
 * 
 */

$(document).ready(
	function(){
		$('a.lightbox').lightBox(); // Select all links that contains lightbox in the attribute rel

		$('ul.sf-menu').superfish({ 
			delay:       0,                 // one second delay on mouseout 
			animation:   {opacity:'show'},  // fade-in and slide-down animation 
			speed:       'normal',          // faster animation speed 
			autoArrows:  false,             // disable generation of arrow mark-up 
			dropShadows: false              // disable drop shadows 
		}); 

		$("#registration_form").submit(
			function(){
				var person = $("#reg_person").val();
				var company = $("#reg_company").val();
				var address = $("#reg_address").val();
				var vatNumber = $("#reg_vatNumber").val();
				var email = $("#reg_email").val();
				var telephone = $("#reg_telephone").val();
				var password = $("#reg_password").val();
				var password2 = $("#reg_password2").val();
	
				if (person == null || person == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie imienia i nazwiska.");
					return false;
				}
				else if (company == null || company == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie nazwy firmy.");
					return false;
				}
				else if (address == null || address == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie dokładnego adresu.");
					return false;
				}
				else if (vatNumber == null || vatNumber == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie numeru NIP.");
					return false;
				}
				else if (email == null || email == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie poprawnego adresu e-mail.");
					return false;
				}
				else if (telephone == null || telephone == ""){
					$(".message").html("<br>Błąd: Prosimy o podanie telefonu kontaktowego.");
					return false;
				}
				else if (password == null || password == ""){
					$(".message").html("<br>Błąd: Prosimy o ustalenie hasła dostępu.");
					return false;
				}
				else if (password2 == null || password2 == ""){
					$(".message").html("<br>Błąd: Prosimy o powtórzenie hasła dostępu.");
					return false;
				}
				else if (password != password2){
					$(".message").html("<br>Błąd: Hasła do siebie nie pasują.");
					return false;
				}
			}
		);
	}
);
