/*------------------------------------------------------------------
[JQuery Games Detail]
Copyright:		Chillingo 2009
Client:			Chillingo
Project:		Chillingo Website
Created By: 	Daniel Cork - Corking Design 
URL:			http://corkingdesign.co.uk
-------------------------------------------------------------------*/
jQuery.noConflict();
var $j = jQuery;
$j(document).ready(function() {
	$j('.trailer').children('a').click(function (e) {
		e.preventDefault();
		$j(".selectedThumb").removeClass("selectedThumb");
		$j(this).addClass("selectedThumb");
		var trailerLink = $j(this).attr("href");
		$j('#Screenshot').hasClass("flash-cont");
		$j('#Screenshot').removeClass("flash-cont");
		$j('#Screenshot').empty();
		var so = new SWFObject("_includes/Flash/videoplayer.swf?fileName="+trailerLink+"&autoHide=true&hideType=fade&autoStart=true&startVol=80&hideDelay=20&bgAlpha=100", "so", "399", "266", "8", "#000000");
		so.addParam("allowFullScreen", "true");
		so.write("Screenshot");
		$j('#Screenshot').addClass("flash-cont");
		$j('#Screenshot img').css({opacity: 0}).stop().animate({opacity: 0},1000).animate({opacity: 1},300, "easeInOutQuad");
	}); 

	//view image
	$j('.thumbs').children('a').click(function (e) {
		e.preventDefault();
		$j(".selectedThumb").removeClass("selectedThumb");
		$j(this).addClass("selectedThumb");
		var thumbnailLink = $j(this).attr("href");
		if ($j('#Screenshot').hasClass("flash-cont")){
			$j('#Screenshot').removeClass("flash-cont");
			$j('#Screenshot').empty();
			$j('#Screenshot').append("\<img src='"+thumbnailLink+"'\/>");
			$j('#Screenshot img').css({opacity: 0}).stop().animate({opacity: 0},1000).animate({opacity: 1},300, "easeInOutQuad");
		} else {
			$j('#Screenshot img').fadeOut('fast', function() {
				$j('#Screenshot').empty();
				$j('#Screenshot').append("\<img src='"+thumbnailLink+"'\/>");
				$j('#Screenshot img').css({opacity: 0}).stop().animate({opacity: 0},500).animate({opacity: 1},500, "easeInOutQuad");
			});
		}
	});

	$j("ul.tabs").tabs("div.panes > div", {effect: 'fade', fadeOutSpeed: 400, fadeInSpeed:600}); 
});