/** JAVASCRIPT METHODS UNIQUE TO TEMPLATE PAGE PLAYERS TAB ONLY */
if (typeof EQ2 === "undefined") {
	EQ2 = {};
}
/** CHECK IF TABS EXISTS */
if( typeof main_tabs_api !== "undefined" ){
	/** CHECK IF WE ARE ON THE PLAYERS TAB */
	if( main_tabs_api.getIndex() == 0 ){
		if( playersInit == false ){
			initPlayersTab();
		}		
	}
}else{
	/** this script loaded prior to DOM ready so do nothing */
}
EQ2.method = {
	initPlayersTab:function(){
		
		if( playersInit == false ){
			/** ONLY INITIALIZE ONCE */
			playersInit = true;
			if( typeof window.console != 'undefined' && typeof window.console.log != 'undefined' ){
				console.log("players tab initialized");
			}			
			/** CODE FOR PLAYERS TAB HERE */
			$("ul.site_nav li."+catagory+"_nav a.nav.top", document.body).addClass( "active");
			$("#dropdown_trigger").click(function(){
				if(updateOpen == false){
					$("#expansion_options").slideDown('fast').show();
					$('a.option_select_btn span').addClass('open');
					$('a.expansion').bind('click', function(event){
						$('#selected_expansion').text($(this).text())
						document.location.href='?expansion='+event.target.id;
						updateOpen = false;
					})
					updateOpen = true;
				}else{
					$("#expansion_options").slideUp('slow');
					$('a.option_select_btn span').removeClass('open');
					$('a.expansion').unbind('click');
					updateOpen = false;
				}
			});
			
			
			$('a.fancy_img').colorbox({innerwWdth:'75%', innerHeight:'75%', scalePhotos:true, current:""});
			$('a.open_avatar').colorbox({current:""});
			
			/** END */
		}
		return false;
	},
	
	playMovie:function(vName){
		$.colorbox({
			href:"/_pageContent/modals/movie.vm",
			scrolling:false,
			opacity:0.70,
			width:"820px",
			height:"572px",
			onComplete:function(){
				var flashvars = {};
				flashvars.fileName = vName;
				flashvars.stillPath = "video/stills_lg/index.html";
				flashvars.videoPath = "http://www-cdn.everquest2.com/video/flvs/en/";
				flashvars.skinPath = "flash/skins/eq2-skin-ftp.swf";
				flashvars.autoplay = "true";
				flashvars.replayStill = "true";
				var params = {};
				params.quality = "high";
				params.wmode = "opaque";
				params.bgcolor = "#000000";
				params.allowscriptaccess = "sameDomain";
				params.allowfullscreen = "true";
				var attributes = {};
				attributes.id = "soe_player";
				attributes.name = "soe_player";
				attributes.align = "middle";
				swfobject.embedSWF("flash/player788x443/soe_player.swf", "movieContainer", "796", "452", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
			}
		});
	},
	
	
	anotherMethod:function( val ){
		/** NOT USED AT THIS TIME FOR EXAMPLE ONLY */
		// Do something with val
		return false;
	}
};

/** DEFINE FUNCTIONS FOR DIRECT ACCESS */
function initPlayersTab()		{EQ2.method.initPlayersTab();}
function anotherMethod( val )		{EQ2.method.anotherMethod( val );}
var catagory = 'media';
var playersInit = false;
var updateOpen = false;
