function checknull(form,fields){
        arr = fields.split(",");
        var puste=true;
        for(var i=0; i< arr.length; i++){
                var e = document.forms[form].elements[ arr[i] ];

                if(e.value==''){
                        e.style.border = "1px dotted red";
                        puste=false;
                }
        }
        if(!puste) alert('Wypełnij brakujące pola');
        return puste;
}







// -->


        function formatText(index, panel) {
    		  return index + "";
    	  };
    
        $(function () {
        
            $('.anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 5000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 500,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
            		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
    		        navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
            });
            
            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(2);
            });
            
        });



function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 



			
			function dodajEmail(){
			
				var newsletter = $('#newsletter');

				var email= '';
				
			
				
				var txt = 'Zapisz się do listy odbiorców :'+'<div class="field"><label for="email">Adres e-mail:</label><input type="text" id="email" name="email" value="'+email+'" /></div>';
				
				$.prompt(txt,{ 
					buttons:{Dodaj:true, Anuluj:false},
					submit: function(v,m,f){
				
						var flag = true;
						if (v) {
							
							if ($.trim(f.email) == '#%#*&*!') {
								m.find('#email').addClass('error');
								flag = false;
							}
							else m.find('#email').removeClass('error');
							
						
							
						}
						return flag;
					},
					callback: function(v,m,f){
						
							
							if(v){							
							
							
									$.post("http://www.krainapiekna.com/panel/newsletter/dodaj_mail", { email: f.email } );
											newsletter.find('.msg').show();
									newsletter.find('.msg').text('Adres e-mail zostanie zweryfikowany a następnie dodany do listy odbiorców newslettera. Dziękujemy');
											
							
						}

						
						else{ }
						
					}
				});
			}
			
			
			function usunEmail(){
			
				var newsletter = $('#newsletter');

				var email= '';
				
			
				
				var txt = 'Wypisz się z newslettera :'+'<div class="field"><label for="email">Adres e-mail:</label><input type="text" id="email" name="email" value="'+email+'" /></div>';
				
				$.prompt(txt,{ 
					buttons:{Usuń:true, Anuluj:false},
					submit: function(v,m,f){
				
						var flag = true;
						if (v) {
							
							if ($.trim(f.email) == '#%#*&*!') {
								m.find('#email').addClass('error');
								flag = false;
							}
							else m.find('#email').removeClass('error');
							
						
							
						}
						return flag;
					},
					callback: function(v,m,f){
						
							
							if(v){							
							
							
									$.post("http://www.krainapiekna.com/panel/newsletter/usun_mail", { email: f.email } );
											newsletter.find('.msg').show();
									newsletter.find('.msg').text('Adres e-mail zostanie usunięty z listy odbiorców newslettera. Zapraszamy ponownie');
											
							
						}

						
						else{ }
						
					}
				});
			}






     Cufon.replace('h1,h2,h3');  


//	Cufon.replace('a.box_green,a.box_orange,a.box_green_dark'); 
	
	//Cufon.replace('a.header'); 

		
		Cufon.replace('.topnav a');  
		
		
	


		
		
		
			$(document).ready(function(){

			$(".btn-slide").click(function(){
			$("#mapa_strony").slideToggle("slow");
			$(this).toggleClass("active");
			});

		});
			
			

$(document).ready(function(){
 /*<![CDATA[*/

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li a").mouseover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown(100).show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
/*]]>*/

});



	
				$(document).ready(
					function(){
					
					$('#slajdy').innerfade({
						animationtype: 'fade',
						speed: 2000,
						timeout: 7200,
						type: 'sequence',
						containerheight: '480'
					});
					});

					
	
				$(document).ready(
					function(){
					$('#slajdybox').innerfade({
						animationtype: 'fade',
						speed: 2000,
						timeout: 6500,
						type: 'sequence',
						containerheight: '150'
					});
					});
		


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 



			

