function OpenT(name,childX,childY) {
	popupWin = window.open(name,'open_window',',status=0,resizable=0,scrollbars=1,width=' + childX + ',height=' + childY);
}
$(document).ready(function() {
	var whichId;
	var whichPopup;
	
	function dimLayers(boo){
		if (boo) {
			$('.apdVideoMouse').animate({ opacity: 0.5 }, 500);
			$('.apdVideoProd').animate({ opacity: 0.5 }, 500);
		} else {
			//$('.apdVideoMouse').animate({ opacity: 1.0 }, 100);
			//$('.apdVideoProd').animate({ opacity: 1.0 }, 100);
			$('.apdVideoMouse').css({ filter: 'alpha(opacity=100)', opacity: '1.0' });
			$('.apdVideoProd').css({ filter: 'alpha(opacity=100)', opacity: '1.0' });
		}
	}
	
	function showLayer(whichLayer) {
		$('#featProdsTitle').css({ visibility: 'hidden' });
		$('#apdVideoTitle').css({ visibility: 'hidden' });
		$('.apdVideoPopup').html('').fadeOut(500);
		$('#apdVideoPopup' + whichLayer).load('/fragments/ajax/video_' + whichLayer + '.aspx');
	}
	
	function removeLayer() {
		$('.apdVideoPopup *:animated').stop(true,true);
		$('.apdVideoPopup').html('').fadeOut(500);
		dimLayers(false);
		$('#featProdsTitle').css({ visibility: 'visible' });
		$('#apdVideoTitle').css({ visibility: 'visible' });
	}
	
	$('.apdVideoMouse').hover(function(){
		whichId = $(this).attr('id');
		whichPopup = whichId.charAt(8);
		showLayer(whichPopup);
	},function(){return false;});
	
	$('#apdVideoPopup1').bind('mouseleave', removeLayer);
	$('#apdVideoPopup2').bind('mouseleave', removeLayer);
	$('#apdVideoPopup3').bind('mouseleave', removeLayer);
	$('#apdVideoPopup4').bind('mouseleave', removeLayer);
	
	$('#apdVideoContainer').ajaxStop(function(){
		$('#apdVideoPopup' + whichPopup).fadeIn(500);
		dimLayers(true);
	});
	
	var pageReloadPopup = $.jqURL.get("s_ev8");
	if (pageReloadPopup == 'Home_UCG-Test_Acctg-Video') {
		whichPopup = '1';
		showLayer(whichPopup);
	} else if (pageReloadPopup == 'Home_UCG-Test_Integrate-Video') {
		whichPopup = '2';
		showLayer(whichPopup);
	} else if (pageReloadPopup == 'Home_UCG-Test_Tax-Video') {
		whichPopup = '3';
		showLayer(whichPopup);
	} else if (pageReloadPopup == 'Home_UCG-Test_Pay-Video') {
		whichPopup = '4';
		showLayer(whichPopup);
	} else {
		// Do nothing
	}
	
});