

$(document).ready(function() {	
		//Show Banner

		$(".main_image .desc").show(); //Show Banner
		/*$(".main_image .block").animate({ opacity: 0.8 }, 1 ); //Set Opacity*/

		//Click and Hover events for thumbnail list
		$(".image_thumb ul li:first").addClass('active');
		
		$(".main_image .sliderImage").click(function(){
			//doSlideSwitch($(this));
			//slideSwitch();
			$link = $('#slideshow li.active .block .control a:last-child');
			$link.attr("temp", "tmp");
			if($link.attr('href') != '#' && $link.attr('href') != undefined) {
				window.location = $link.attr('href');
			}
		});
		
		$(".main_image a.playyt").click(function(){
			var vid = $(this).attr('alt');
			var flash = 'http://www.youtube.com/v/' + vid + '&hl=pl_PL&fs=1&color1=0x402061&color2=0x9461ca';
			Shadowbox.open({
				content:    flash,
				player:     "swf",
				title:      "",
				height:     389,
				width:      481
			});
			return false;
		});
		
		/*$(".image_thumb ul li").click(function(){
			//Set Variables
			doSlideSwitch($(this));
		}).hover(function(){
			$(this).addClass('hover');
			}, function() {
			playSlideshow = setInterval( "slideSwitch()", 5000 );
		});*/

		//Toggle Teaser
		$("a.collapse").click(function(){
			$(".main_image .block").slideToggle();
			$("a.collapse").toggleClass("show");
		});

		$(".image_thumb ul li").hover(function(){
			clearInterval(playSlideshow);
			}, function() {
			$(this).removeClass('hover');
		});

	});//Close Function

	/*	
	function doSlideSwitch(obj) {
		var $$ = obj;
		var imgAlt = $$.find('a').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $$.find('a').attr("href"); //Get Main Image URL
		var imgDesc = $$.find('.block').html(); //Get HTML of block
		//var imgHeader = $$.find('h2').html();
		var imgDescHeight = $(".main_image").find('.block').height(); 

		// Calculate height of block	
		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser		
			$(".main_image img.sliderImage").animate({ opacity: 0}, 250 );
			$(".main_image .block").animate({ opacity: 0.8, marginLeft: "-600", marginTop: "-50" }, 250 , function() {
				$(".main_image img.sliderImage").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
				$(".main_image .block").html(imgDesc).animate({ opacity: 1.0, width:"208px", marginLeft: "0", marginTop: "0" }, 400 );
				//$(".main_image .block p").animate({ width:"570px" }, 150 );
				if(imgAlt == '') $(".main_image a.playyt").hide(150);
				else $(".main_image a.playyt").attr('alt', imgAlt).show(150);
			});
			
			//$(".main_image h2").html(imgHeader);
		}

		$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$$.addClass('active');  //add class of 'active' on this list only
		return false;
	};*/

	function imgSlideSwitch(obj) {
	};


	function slideSwitch() {
		var $active = $('#slideshow li.active');
		if ( $active.length == 0 ) $active = $('#slideshow li:last');
		
		// use this to pull the divs in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
		: $('#slideshow li:first');

		// uncomment below to pull the divs randomly
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		//$active.addClass('last-active');
		doSlideSwitch($next);
	};

	function rslideSwitch() {
		var $active = $('#slideshow li.active');
		if ( $active.length == 0 ) $active = $('#slideshow li:last');
		
		// use this to pull the divs in the order they appear in the markup
		var $next =  $active.prev().length ? $active.prev()
		: $('#slideshow li:last');

		// uncomment below to pull the divs randomly
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		//$active.addClass('last-active');
		doSlideSwitch($next);
	};
	$(function() {
		playSlideshow = setInterval( "slideSwitch()", 10000 );
	});