/*$(document).ready(function(){

$("#menu_js > li > div").click(function()
{
               // $("p:visible").slideUp("slow");
                   $("#menu_js > li > div").next("ul").not($(this)).slideUp("slow");

               // $(this).next("ul").slideToggle(300).siblings("ul").slideUp("slow");
                    //$("#menu_js > li > div").next("ul").slideUp("normal");
                      $(this).next("ul").slideDown("slow");
    //$(this).next("ul").slideToggle(300).siblings("ul").slideUp("slow");

});


	});	
          */

$(document).ready(function(){

$(".dane_techniczne tr td:first-child").css({"text-align":"right", "font-weight":"bold"});



	});	


function swapImages(){
var $active1 = $('#logo_img .active1');
var $active2 = $('#logo_img .active2');
var $active3 = $('#logo_img .active3');
var $next1 = ($('#logo_img .active3').next().length > 0) ? $('#logo_img .active3').next() : $('#logo_img div:first-child');
$active1.fadeOut(1000,function(){
/*$('div.demo-container1').html($('img.active1').attr('src')+'  $next1'+$next1.attr('src'));*/
$active1.removeClass('active1');
$next1.fadeIn(1000).addClass('active1');
});

var $next2 = ($next1.next().length > 0) ? $next1.next() : $('#logo_img div:first-child');
$active2.fadeOut(1000,function(){
/*$('div.demo-container2').html($('img.active2').attr('src')+'  $next2'+$next2.attr('src'));  */
$active2.removeClass('active2');
$next2.fadeIn(1000).addClass('active2');
});

var $next3 = ($next2.next().length > 0) ? $next2.next() : $('#logo_img div:first-child');
$active3.fadeOut(1000,function(){
/*$('div.demo-container3').html($('img.active3').attr('src')+'  $next3'+$next3.attr('src'));*/
$active3.removeClass('active3');
$next3.fadeIn(1000).addClass('active3');
});
}

    $(document).ready(function(){
     $('#logo_img div').css({ opacity: 0.8 });

     $('#logo_img div:first-child').addClass('active1');

      var $next1 = ($('#logo_img .active1').next().length > 0) ? $('#logo_img .active1').next() : $('#logo_img div:first-child');
     $next1.fadeIn().addClass('active2');

      var $next2 = ($('#logo_img .active1').next().length > 0) ? $('#logo_img .active2').next() : $('#logo_img div:first-child');
     $next2.fadeIn().addClass('active3');


     setInterval('swapImages()',8000);
    });

   function swapImages2(){
         var $oznacz_img1 = $('.reklama_img .reklama_img_oznacz');
         var $oznacz_img_next1 = ($('.reklama_img .reklama_img_oznacz').next().length > 0) ? $('.reklama_img .reklama_img_oznacz').next() : $('.reklama_img div:first-child');
         var $oznacz_btn1 = $('.reklama_btn .reklama_btn_oznacz');
         var $oznacz_btn_next1 = ($('.reklama_btn .reklama_btn_oznacz').next().length > 0) ? $('.reklama_btn .reklama_btn_oznacz').next() : $('.reklama_btn div:first-child');

$oznacz_img1.fadeOut(function(){
$oznacz_img1.removeClass('reklama_img_oznacz');
$oznacz_img_next1.fadeIn().addClass('reklama_img_oznacz');
$oznacz_btn1.removeClass('reklama_btn_oznacz');
$oznacz_btn_next1.fadeIn().addClass('reklama_btn_oznacz');
});


   }


    $(document).ready(function(){
      $('.reklama_img div:first-child').addClass('reklama_img_oznacz');
       $('.reklama_btn div:first-child').addClass('reklama_btn_oznacz');

            timeoutID = setInterval(function() {swapImages2(); }, 6000);

     $('.reklama_btn div')

			.click(
				function() {
				
                                   if (timeoutID) {clearTimeout(timeoutID);}
                                   var $oznacz_btn2 = $('.reklama_btn .reklama_btn_oznacz');
                                   $oznacz_btn2.removeClass('reklama_btn_oznacz');
					     $(this).addClass('reklama_btn_oznacz');
					      timeoutID = setInterval(function() {swapImages2(); }, 7000);

			})



    });



    		$(document).ready(function() {

			$.featureList(
				$("#tabs li"),
				$("#output li"), {
					start_item	: 0
				}
			);

		});
		
		
		
				$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='example1']").colorbox();
			$("a[rel='example2']").colorbox({transition:"fade"});
			$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
			$("a[rel='example4']").colorbox({slideshow:true});
			$(".example5").colorbox();
			$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
			$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
			$(".example9").colorbox({
				onOpen:function(){ alert('onOpen: colorbox is about to open'); },
				onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
				onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
				onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
				onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
			});
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
		
		
		

$(document).ready(function(){	
$('#p-slider').cycle({

    fx:     'scrollUp',
    speed:   300,
    timeout: 3000,
    next:   '#s3',
    pause:   1,
    prev:   '#prevBtn',
    next:   '#nextBtn'
});

/*facebook*/


$("#wysuwane").css("right","-210px");


$("#wysuwane").mouseover(function() {
                                                 $("#wysuwane").stop();
                                                 $("#wysuwane").animate({
                                                                 right: "0"
                                                                 },210
                                                                 );
                                                 })
                     $("#wysuwane").mouseout(
                                          function() {
                                                   $("#wysuwane").stop();
                                                   $("#wysuwane").animate({
                                                                  right: "-210"
                                                                  }, 210
                                                                  );
                                                                  });


});	


/*
$(document).ready(function(){
alert(history.length);

if (window.history.length <= 2) {

$('.back_btn').css("display","none");


}

else {
$('.back_btn').css("display","block");
};


});	
	
		
*/		
		
jQuery.fn.extend({
	simpleslider: function(userConfig)
	{
		// domyślna konfiguracja
		var config = {
			leftTrigger: null,	// przewiń w lewo
			rightTrigger: null,	// przewiń w prawo
			icons: null,		// kontener z ikonkami
			duration: 2,		// czas trwania animacji
			timer: 5,			// czas automatycznego przewinięca
			loop: true,			// powtarzaj od początku
			stopOnUserEvent: true,	// zatrzymaj automatyczne przewijanie po interakcji użytkownika
			startOnInit: true		// stratuj po wywołaniu
		}
		
		jQuery.extend(config, userConfig);
		
		var sliderWindow = jQuery(this).find('.slider_window');
		var itemsContainer = sliderWindow.find('.slider_items');
		var items = itemsContainer.find('.item');
		
		var icons = null;
		if (config.icons)	// przypięcie akcji do ikonek
		{
			icons = jQuery('#'+config.icons).find('.ico');
			
			icons.each(function(index, obj)
			{
				jQuery(this).click(function(ev){					
					ev.preventDefault();
					userEventStopTimer();
					scrollTo(index);	
				});
			});
		}
		
		
		/* kontener musi miec szerokosc ktora zmiesci wszystkie elementy do przewijania */
		itemsContainer.css({clear: 'both', width: items.outerWidth() * (items.size()*2)});
		//itemsContainer.css({width: })

		var leftArrow = jQuery('#'+config.leftTrigger);
		var rightArrow = jQuery('#'+config.rightTrigger);
		
		//if (leftArrow.size()) leftArrow.bind('click', scrolToPrev);
		if (rightArrow.size()) rightArrow.bind('click', scrolToNext);
		
		var carret = 0;
		
		selectIco(carret)
		
		var slideTimer = null;
					
		if (config.startOnInit) startTimer();
		
		// przewiń
		function scrollTo(no)
		{
			if (no == 'next')
			{
				carret++;
			}
			else if (no == 'prev')
			{
				carret--;
			}
			else if (carret != no)
			{
				carret = no;
			}
			else
			{
				return;
			}
			
			// przypnij akcje do trzałek jeżeli istnieją
			if (leftArrow.size()) leftArrow.unbind('click', scrolToPrev);
			if (rightArrow.size()) rightArrow.unbind('click', scrolToNext);

			if (carret > items.size()-2)
			{
				if (leftArrow.size()) leftArrow.bind('click', scrolToPrev);
			}
			else if (carret == 0)
			{				
				if (rightArrow.size()) rightArrow.bind('click', scrolToNext);
			}
			else
			{
				if (leftArrow.size()) leftArrow.bind('click', scrolToPrev);
				if (rightArrow.size()) rightArrow.bind('click', scrolToNext);
			}

			// wylicz margines przesunięcia
			var length = items.outerWidth() * -carret;

			itemsContainer.animate({
				marginLeft: length
			}, {
				queue: true,
				duration: config.duration * 1000,
				complete: function() {selectIco(carret)}
			});
		}

		// oznacz ikonkę/strzałkę za pomocą css
		function selectIco(no)
		{
			if (config.icons)
			{
				icons = jQuery('#'+config.icons).find('.ico');

				icons.each(function(index, obj)
				{
					jQuery(this).removeClass('selected');

					if (index == no) jQuery(this).addClass('selected');						
				});
			}
			
			if (rightArrow.size()) rightArrow.removeClass('disabled');
			if (leftArrow.size()) leftArrow.removeClass('disabled');
			
			if (leftArrow.size() && no == 0) leftArrow.addClass('disabled');									
			if (rightArrow.size() && no == items.size()-1) rightArrow.addClass('disabled');
		}
		
		function scrolToNext(ev)
		{
			ev.preventDefault();
			userEventStopTimer();
			scrollTo('next');
		}
		
		function scrolToPrev(ev)
		{
			ev.preventDefault();
			userEventStopTimer();
			scrollTo('prev');
		}			
					
		function userEventStopTimer()
		{
			if (slideTimer) clearInterval(slideTimer);
			
			if (!(config.stopOnUserEvent))
			{
				startTimer();
			}
		}
		
		function startTimer()
		{
			if (config.timer)
			{
				slideTimer = setInterval(timerSlide, config.timer * 1000);
			}				
		}
		
		function timerSlide()
		{
			if (config.loop && carret >= items.size()-1) carret = -1;
			if (!config.loop && carret == items.size()-2 && slideTimer) clearInterval(slideTimer);

			scrollTo('next');
		}
	}
});




 $(document).ready(function(){
// get handle to the scrollable DIV
var scroll = $("#scroll");

// initialize rangeinput
$(":range").rangeinput({

	// slide the DIV along with the range using jQuery's css() method
	onSlide: function(ev, step)  {
		scroll.css({left: -step});
	},

	// display progressbar
	progress: true,

	// initial value. also sets the DIV's initial scroll position
	value: 200,

	// this is called when the slider is clicked. we animate the DIV
	change: function(e, i) {
		scroll.animate({left: -i}, "fast");
	},

	// disable drag handle animation when when slider is clicked
	speed: 0

});

 });



	

