﻿$(document).ready(function() {

	$(document).pngFix();
	
	
	// Logo Scroller
		(function($) {
		$(function() { //on DOM ready
			$("#scroller").simplyScroll({
				autoMode: 'loop'
			});
		});
	})(jQuery);





	// Mapa Polski - firmy

			$('#polska li').click(function() {
				currentId = $(this).attr("id");
				$("#firmy div").fadeOut(0).removeClass("hit");
				$("#firmy").find("div." + currentId).fadeIn("slow").addClass("hit");
		
			});




	// start slider
						
			$("#slide").easySlider({
				prevText: '&laquo; poprzedni',
				nextText: 'następny &raquo;',
				auto: true,
				continuous: true 
			});




	// Flash animation

			$('#anim').flash({
		    	src: 'flash/anim.swf',
		   	 	width: 434,
		    	height: 291,
		    	wmode: 'transparent',
		    	expressInstall: true
		    });





	// Focus border remove

			$("a").focus(function() {
				$(this).blur();
			});
		

	
	
	
	// Lightbox

			$(".lightbox, #gallery a").prettyPhoto({theme:'light_square'});	
	


	
	
	
	// Menu Drop-Down:
	
			$(".menu_head").click(function() {
				$(this).next(".menu_body").slideToggle(300).siblings(".menu_body").slideUp("fast");	
			});
		
		
			$(".hit").next(".menu_body").slideToggle(300).siblings(".menu_body").slideUp("fast");
	
	
	


	
	
	// Empty field after click
	
				$('input[type="text"], input[type="password"]').focus(function() { $(this).val(''); });
				
	





//form validation
				
$('#error').hide();
$('form').bind('submit', function(){
    
	var valid = true;
	
	$('.required').click(function(){
		$(this).removeClass('error-input');
	});
	
	$('.required').each(function(){
		if($(this).val() == ''){
			$(this).addClass('error-input');
			 valid = false;
		} else {
			$(this).removeClass('error-input');
		}
	});
	if(!valid){
		$('#error').fadeIn();
		return false;
	}
});

});
