// JavaScript Document
jQuery(document).ready(function($){
	var GlobalLightButtonZindex = 0;
	var GlobalPlayerZindex = 0;
	var GlobalShadoxZindex = 0;
	$('.main-stream-video-player-button').click(function(){										 
			if($('#'+$(this).attr('PanelId')).is(':hidden')){
				if(GlobalPlayerZindex!=0){
					$('.main-stream-video-player-alert-content div').css({'z-index':GlobalPlayerZindex+1});	
					$('.main-stream-video-player-button .UpArrow').css({'z-index':GlobalPlayerZindex+1});
				}
				$('#'+$(this).attr('PanelId')).siblings().hide();
				$(this).siblings().children().hide();
				$('#'+$(this).attr('PanelId')).fadeIn('fast');																  
				$('.UpArrow',this).slideDown('fast');
			}else{
				$('#'+$(this).attr('PanelId')).siblings().hide();
				$(this).siblings().children().hide();
				$('#'+$(this).attr('PanelId')).fadeOut('fast');
				$('.UpArrow',this).slideUp('fast');
			}
			
		}
	);
	$('.CloseToolTipButton').click(function(){
		$(this).parent().hide();
		$('div[panelid='+$(this).parent().attr('id')+']').children().hide();
	});
	$("#shadow").css("height", $(document).height()).hide();
	$('.main-stream-video-player-buttons .button-light').click(function(){
		if($('#shadow').is(':hidden')){
			$('.main-stream-video-player-alert-content div').hide();	
			$('.main-stream-video-player-button .UpArrow').hide();
			
			//lightbutton
			var zindex = new Number($(this).css('z-index'));
			if(GlobalLightButtonZindex!=0) GlobalLightButtonZindex += 1; else GlobalLightButtonZindex = zindex+1;
			$(this).css({'z-index':GlobalLightButtonZindex});

			//playerwrap
			zindex = new Number($('#'+$(this).attr('PanelId')).css('z-index'));
			if(GlobalPlayerZindex!=0) GlobalPlayerZindex += 1; else GlobalPlayerZindex = zindex+1;
			$('#'+$(this).attr('PanelId')).css({'z-index':GlobalPlayerZindex});
			
			//shadow
			zindex = new Number($("#shadow").css('z-index'));
			if(GlobalShadoxZindex!=0) GlobalShadoxZindex += 1; else GlobalShadoxZindex = zindex+1;
			$("#shadow").css({'z-index':GlobalShadoxZindex});
			
			$("#shadow").toggle();
		}else{
			$("#shadow").toggle();
		}																	
	});
});


