$(document).ready(
		function(){
			
			$('#main_picture').innerfade({
				speed: 1000,
				timeout: 5000,
				type: 'sequence',
				containerheight: '486px'
			});
			
			$("input[type=file]").filestyle({ 
		     image: "./public/templates/file_input.gif",
			     imageheight : 29,
			     imagewidth : 89,
			     width : 145
			 });
			 
			 $('a.lightbox').lightBox({
			 	imageLoading:			'./public/templates/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
				imageBtnPrev:			'./public/templates/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
				imageBtnNext:			'./public/templates/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
				imageBtnClose:			'./public/templates/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
				imageBlank:				'./public/templates/lightbox-blank.gif',
				txtImage:				'Zdjęcie',	// (string) Specify text "Image"
				txtOf:					'z'
			 }); 	
			 
			 $("ul#form_okazy #gatunek").DefaultValue("Gatunek ryby");
			 $("ul#form_okazy #dlugosc").DefaultValue("Długość");
			 $("ul#form_okazy #miejsce").DefaultValue("Miejsce");
			 $("ul#form_okazy #data").DefaultValue("Data");
			 $("ul#form_okazy #przyneta").DefaultValue("Przynęta");
			 $("ul#form_okazy #imie").DefaultValue("Twoje imię i nazwisko");
					
			 
			$("form[name=form_zgloszenie]").submit(function(){
			 	var inp; var error =0;
			 	 
			 	if($("#gatunek").val()=="" || $("#gatunek").val()=="Gatunek ryby") {
			 		inp = $("#gatunek"); error++;
			 	} else if($("#dlugosc").val()=="" || $("#dlugosc").val()=="Długość") {
			 		inp = $("#dlugosc"); error++;
			 	} else if($("#miejsce").val()=="" || $("#miejsce").val()=="Miejsce") {
			 		inp = $("#miejsce"); error++;
			 	} else if($("#data").val()=="" || $("#data").val()=="Data") {
			 		inp = $("#data"); error++;
			 	} else if($("#przyneta").val()=="" || $("#przyneta").val()=="Przynęta") {
			 		inp = $("#przyneta"); error++;
			 	} else if($("#imie").val()=="" || $("#imie").val()=="Twoje imię i nazwisko") {
			 		inp = $("#imie"); error++;
			 	} else if ($("#agreement").is(':checked') == false) {
			 		alert("Musisz zaakaceptować regulamin"); return false;
			 	} else if(LimitAttach($("#input_file1").val()) == false) return false;

			 	
			 	if(error>0) {
			 		inp.toggleClass("formempty").val("Wpisz wymaganą wartość");
			 		setTimeout(function(){
			 			inp.val("");
			 			inp.toggleClass("formempty");
			 			inp.focus();
			 		},1500);
			 		return false;
			 	}
			 	
			 	
			 });
			 
			 
		
		}
		
		
	);
	
	 

		$(window).load(function() {
		  
			$(".article_mini_photo img").each(function() {
				 $(this).removeAttr("width");
				 var width = this.width;
				 $(this).parent().next("p").css("width",width+20);
			});
			
			$(".article_mini_photo_right img").each(function() {
				 $(this).removeAttr("width");
				 var width = this.width;
				 $(this).parent().next("p").css("width",width+20);
			});
			
			$(".gallery_mini_photo img").each(function() {
				 $(this).removeAttr("width");
				 var width = this.width;
				 $(this).parent().next("p").css("width",width+20);
			})
		
		});
