$(document).ready(function(){
///**************************************///				   
///*****        Sell Panels         *****///	
///**************************************///
	$('#sellPanels').cycle({ 
    	fx:'fade', 
    	speed:'medium', 
    	timeout: 0, 
    	pager:'.panelNavDots',
    	next:'.nextPanel', 
    	prev:'.prevPanel'
	});
	
	$(".sellThumb a").fancybox({
		'hideOnContentClick': false,
		'overlayShow': true,
		'zoomSpeedOut': 400
	});

///**************************************///				   
///*****      Video Thumbnails      *****///	
///**************************************///
	$('#groupVideoThumbnails').cycle({ 
    	fx:'scrollHorz', 
    	speed:'fast', 
    	timeout: 0, 
    	pager:'.videoNavDots',
    	next:'.nextPanelVid', 
    	prev:'.prevPanelVid'
	});
	$('div#groupVideoThumbnails a').each(function(index){				
		$(this).click(function(){
			$('div.gameVideoRight div.videoText').filter(':visible').fadeOut(300, function(){
       			$('div.gameVideoRight div.videoText').eq(index).fadeIn(300);
			});
			return false;
		});
	});	
///**************************************///				   
///*****     Video Descriptions     *****///	
///**************************************///
	$('#groupDesc').cycle({ 
    	fx:'fade', 
    	speed:'medium', 
    	timeout: 0, 
    	pager:'div#groupVideoThumbnails .thumbnailContainer .videoThumbnail'
	});
	
///**************************************///				   
///*****         Flow Player        *****///	
///**************************************///
	$(function() { 
    	$f("player", {src:"http://static.plaync.com/flowplayer/flowplayer.commercial-3.0.3.swf",wmode:'transparent'}, { 
    	key: '#@1f1270be5ab708347ad',
		plugins: {controls:{autoHide: 'always', opacity: 0.8, backgroundGradient: [0.4, 0.2, 0.0], backgroundColor: '#000000',buttonColor: '#0aeeff', progressColor:'#0aeeff', timeColor: '#000000', durationColor: '#000000'}} 
    	}).playlist("div#groupVideoThumbnails .thumbnailContainer .videoThumbnail", {loop:true});
	});
	
	$f("a.sellVideo", "http://static.plaync.com/flowplayer/flowplayer.commercial-3.0.3.swf", { 
    	key: '#@1f1270be5ab708347ad',
		plugins: {controls:{autoHide: 'always', opacity: 0.8, backgroundGradient: [0.4, 0.2, 0.0], backgroundColor: '#000000',buttonColor: '#0aeeff', progressColor:'#0aeeff', timeColor: '#000000', durationColor: '#000000'}}
  	});
	
	$('.panelNavArrows a, .panelNavDots a, .sellThumb a').click(function(){
		$f().unload();
	});

	$('#walls').jcarousel({vertical: true, scroll: 3});
	
	$('#walls .jcarousel-item').bind("mouseenter",function(){
		$(this).children("div").fadeIn('fast');
	});
	
	$('#walls .jcarousel-item').bind("mouseleave",function(){
		$(this).children("div").fadeOut('fast');
	});
	
///**************************************///				   
///*****        Features Tab        *****///	
///**************************************///	
	var tabs = $('ul#featureTabs > li');
	var featureDivs = $('#featureSlider > div');
	featureDivs.hide().filter(':first').show();
	var featureText = $('#featureSlider > div > p');
			
	$('ul#featureTabs li a:not(:last)').click(function () {		
		$('ul#featureTabs li a').removeClass('activeTab');
		$(this).addClass('activeTab');
		
		featureDivs.removeClass('activeFeature');
		var myid = this.id;
		myid = myid.replace(/Tab/, 'Feature');
		featureDivs.hide();
		featureDivs.filter('#'+myid).show();
		return false;
	}).filter(':first').click();
	
	featureText.fadeTo("fast", 0.75);
	
	// The "_game" variable for the overview flashvar is defined in each of the game templates
	// var _game = 'aion';

    $('#storyFeature').flash(
        { src: '/global/includes/flash/overview.swf',
          width: 960,
          height: 403,
          wmode: 'transparent',
          flashvars: { lang:_lang, game:_game }		  
        },
        { version: 9 }
    );
	
	$('#blackBg').flash(
		{ src: '/global/includes/flash/black_bg.swf',
		  width: 960,
		  height: 403,
		  wmode: 'transparent'},
		{ version: 9 }
	);

	$('div.alt').hide();
	
///**************************************///				   
///*****      Screenshot Slider     *****///	
///**************************************///	
					
    jQuery('#screensSlider').jcarousel({
        vertical: true,
        scroll: 2
    });

      $("#screensSlider li img").click(function(){ 
          fullsize = $(this).attr("src").replace('thumbs','full'); 
          $("div#imagePlaceHolder img").attr("src",fullsize); 
        }
        
      );  
	  
	  $("#player").append('<div class="videoTabPlayButton"></div>');
	  $(".sellVideo").append('<div class="sellPanelPlayButton"></div>');
	  
///**************************************///				   
///*****         News Toggle        *****///	
///**************************************///
$("#newsToggle").addClass("newsToggleMore");
	$("#newsToggle").toggle(
		function(){
			$(".hideMe").show();
			$("#newsToggle").removeClass("newsToggleMore").addClass("newsToggleLess");
		},
		function(){
			$(".hideMe").hide();
			$("#newsToggle").removeClass("newsToggleLess").addClass("newsToggleMore");
		}
	);
	
///***
});
///***
