function run()
{
	initIndexPageTabs()
	initSubPageTabs();
	/*
	jQuery(window).resize( function () {
		invalidatePopup();
	});
	jQuery(window).scroll( function () {
		invalidatePopup();
	});
	jQuery(document).keypress(function(e){  
		if(e.keyCode==27 ) {  
			closePopup();  
		} 
	});
	
	jQuery("#InterstitialModalBg,.closeWindowButton").click( function () {
		closePopup();
	}); 
	
	showPopup();
	*/
}

function initIndexPageTabs()
{
	jQuery("#VideoTabClosed").click( function () {
		jQuery("#VideoTabContentFlash").get(0).resetMediaPlayer();
		jQuery("#VideoTabContentFlash").hide();
		
		$this = jQuery(this);
		$this.siblings("#VideoTabContent").slideUp("fast");
		$this.siblings("#VideoTabOpen").show();
		$this.hide();
	});
	
	jQuery("#VideoTabOpen").click( function () {
		jQuery("#VideoTabContentFlash").show();
		$this = jQuery(this);
		$this.siblings("#VideoTabContent").slideDown("fast");
		$this.siblings("#VideoTabClosed").show();
		$this.hide();
	});
}

function initSubPageTabs()
{
	jQuery(".subpageTab > .tab-closed").click( function () {
		$this = jQuery(this);
		$this.siblings(".tab-content").slideDown("fast");
		$this.siblings(".tab-open").show();
		$this.hide();
	});
	
	jQuery(".subpageTab > .tab-open").click( function () {
		$this = jQuery(this);
		$this.siblings(".tab-content").slideUp("fast");
		$this.siblings(".tab-closed").show();
		$this.hide();
	});
	
	if ( pendingTabPage != "" )
	{
		$this = jQuery("#"+pendingTabPage+" > .tab-closed");
		$this.siblings(".tab-content").slideDown("fast");
		$this.siblings(".tab-open").show();
		$this.hide();
	}
}

function invalidateHeight()
{
	equalHeight( jQuery("#LeftColumn, #RightColumn") );
}

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var marginBottom = parseInt( jQuery(this).css("margin-bottom") );
		var thisHeight = jQuery(this).height() - 30;
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

function invalidatePopup() {
	var windowHeight = jQuery(window).height();
	
	//only need force for IE6  
	jQuery("#InterstitialModalBg").css({  
		"height": windowHeight  
	});
}

function showPopup() {
	jQuery("#InterstitialModalBg").show();
	jQuery("#InterstitialWindow").show();
}

function closePopup() {
	jQuery("#InterstitialModalBg").hide();
	jQuery("#InterstitialWindow").hide();
}


