// JavaScript Document

$(document).ready(function(){
		
	// INITIAL SETUP
	$('.tabs div').each(function(){
											
		if($(this).hasClass("tabs-on")){
			$('#'+$(this).attr("title")).removeClass("tabs-hide");
			$('#'+$(this).attr("title")).addClass("tabs-show");
		}else{
			$('#'+$(this).attr("title")).removeClass("tabs-show");
			$('#'+$(this).attr("title")).addClass("tabs-hide");
		}
				
	});
	
	// TOGGLING
	$('.tabs div').click(function(){
							
		if($(this).hasClass("tabs-on")){
			
			// DO NOTHING.. ALREADY SELECTED

		}else{
			
			// STOP THE VIDEO IF ITS PLAYING
			try{
				var player = document.getElementById('swf_video');
				if(player != null)
					player.sendEvent('STOP');
			}catch(e){}
			
			// CLOSE OTHER TAB(S)
			$(this).siblings(".tabs-on").each(function(){
													  
				$(this).removeClass("tabs-on").addClass("tabs-off");
				$('#'+$(this).attr("title")).removeClass("tabs-show");
				$('#'+$(this).attr("title")).addClass("tabs-hide");
				
			});
			
			// SELECT THIS TAB
			$(this).removeClass("tabs-off").addClass("tabs-on");
			$('#'+$(this).attr("title")).removeClass("tabs-hide");
			$('#'+$(this).attr("title")).addClass("tabs-show");
			
		}
						
	});
});
