// JavaScript Document
$(document).ready(function()
{ 
	//var browserName=navigator.appName;
	
	//if (browserName=="Opera"){ 
	//	alert("Opera!");
	//} else {
	//var h = parseInt((getWindowHeight() - 500) / 2);
	//$('.main').css('marginTop', h);
	//}
	
	//$(document).pngFix();

	//$('.windowFrame').fadeTo('fast',0.6);
	
	// animacja startowa
	$('.trojka').hide();
	$('.trojkaSlider').hide();
	$('.trojkaSlider').width("0px");
	
	$(function() {
		$('.trojka').hide();
		$('.trojkaSlider').animate({right: "0px", width: "480px"}, 350).animate({right: "0px", width: "500px"}, 1250, onSlide);
	});
	
	function onSlide() { 
		
      $('.trojkaSlider').animate({left: "500px", width: "20px"}, 150).animate({left: "500px", width: "0px"}, 750).hide('fast',onSlideEnd);

		
	} 
	
	function onSlideEnd() { 
		$('.trojka').fadeIn('slow');
	}
	// animacja startowa koniec

	// glowna galeria
//    $('.picSliderImage0').hide();
//	$('.picSliderImage1').hide();
//	$('.picSliderImage2').hide();
//	$('.picSliderImage3').hide();
//	$('.picSliderImage4').hide();
//	$('.picSliderImage5').hide();
//	$('.picSliderImage6').hide();
//	$('.picSliderImage7').hide();
//
//	$('.picSliderImage0').attr('src', 'startowe/0.jpg').load(function() {  
//		  $('.picSliderImage0').show();
//	});
//	
//	$('.picSliderImage1').attr('src', 'startowe/1.jpg').load(function() {  
//		  $('.picSliderImage1').show();
//	});
//	
//	$('.picSliderImage2').attr('src', 'startowe/2.jpg').load(function() {  
//		  $('.picSliderImage2').show();
//	});
//	
//	$('.picSliderImage3').attr('src', 'startowe/3.jpg').load(function() {  
//			$('.picSliderImage2').show();  
//	});
//	
//	$('.picSliderImage4').attr('src', 'startowe/4.jpg').load(function() {  
//			$('.picSliderImage4').show();
//	});
//	
//	$('.picSliderImage5').attr('src', 'startowe/5.jpg').load(function() {  
//			$('.picSliderImage5').show();
//	});
//	
//	$('.picSliderImage6').attr('src', 'startowe/6.jpg').load(function() {  
//			$('.picSliderImage6').show();
//	});
//	
//	$('.picSliderImage7').attr('src', 'startowe/7.jpg').load(function() {  
//			$('.picSliderImage7').show();
//	});
	
	$('#s2').cycle({ 
	fx:     'fade', 
    speed:   2500, 
    timeout: 4000, 
    next:   '#s2', 
    pause:   1 
	});
	
	$('.s3').cycle({ 
	fx:     'scrollDown', 
    timeout: 6000, 
    pause:   1 
	});
	
	$('#s6').cycle({
    fx:    'scrollUp',
	timeout: 10000,
    delay: -6000,
	pause: 1
	});

	// glowna galeria koniec
	
	// animacja menu
	$(".menu li a").hover(function(){
		$(this).fadeTo(1, 0.0, LinkFadeEnd);
		
		function LinkFadeEnd() { 
		$(this).css('background-color', 'white').css('color', '#1b3a63').fadeTo(350, 1.0);  
	}
		
	},function(){
   		$(this).fadeTo(1, 0.0, LinkFadeEndSec);
		
		function LinkFadeEndSec() { 
		$(this).css('background-color', '').css('color', '#1b3a63').fadeTo(1, 1.0);
		$(this).css('color', '#fff');
		}
	});
	// animacja menu koniec
	
	// animacja linków
	$(".LinksMove").hover(function(){
		$(this).fadeTo(50, 0.5).animate({marginLeft: "5px"}, 150).fadeTo(50, 1.0);
	},function(){
   		$(this).animate({marginLeft: "0px"}, 150);
	});
	// animacja linków koniec

$("a[rel^='prettyPhoto']").prettyPhoto();

$(function(){ 
	// find all the input elements with title attributes
	$('input[title!=""]').hint();
});



//$('.sponsorFlip').bind("click",function(){
//
//		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):
//
//		var elem = $(this);
//
//		// data('flipped') is a flag we set when we flip the element:
//
//		if(elem.data('flipped'))
//		{
//			// If the element has already been flipped, use the revertFlip method
//			// defined by the plug-in to revert to the default state automatically:
//
//			elem.revertFlip();
//
//			// Unsetting the flag:
//			elem.data('flipped',false)
//		}
//		else
//		{
//			// Using the flip method defined by the plugin:
//
//			elem.flip({
//				direction:'lr',
//				speed: 350,
//				onBefore: function(){
//					// Insert the contents of the .sponsorData div (hidden
//					// from view with display:none) into the clicked
//					// .sponsorFlip div before the flipping animation starts:
//
//					elem.html(elem.siblings('.sponsorData').html());
//				}
//			});
//
//			// Setting the flag:
//			elem.data('flipped',true);
//		}
//	});


	$('.sponsor').hover(
	  function () {
		$(this).find('.sponsorFlip').hide();
		$(this).find('.sponsorData').show();
	  },
	  function () {
		$(this).find('.sponsorFlip').show();
		$(this).find('.sponsorData').hide();
	  }
	);


	$('.katListBox #kategoria').change(function() {
		var NewLink = $(this).val();
		window.location.replace(NewLink);
	});
	
	$('.katListBox #firma').change(function() {
		var NewLink = $(this).val();
		window.location.replace(NewLink);
	});


});
