// JavaScript Document
function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}



$(document).ready(function() 
{
// -------------------- Flash Embed ---------------------------	
	$('#logo').flashembed({src: "_flash/flash_entergy_logo.swf", version: [9, 0], wmode: "opaque"});
	$('#index_flash_AP_div.principled').flashembed({src: "_flash/PRINCIPLED.swf", version: [9, 0], wmode: "transparent"});
	$('#flash_banner_main.letter').flashembed({src: "_flash/LETTER.swf", version: [9, 0], wmode: "opaque"});
	$('#flash_banner_main.respect').flashembed({src: "_flash/RESPECT.swf", version: [9, 0], wmode: "opaque"});
	$('#flash_banner_main.safety').flashembed({src: "_flash/SAFETY.swf", version: [9, 0], wmode: "opaque"});
	$('#flash_banner_main.community').flashembed({src: "_flash/COMMUNITY.swf", version: [9, 0], wmode: "opaque"});
	$('#flash_banner_main.stakeholders').flashembed({src: "_flash/STAKEHOLDERS.swf", version: [9, 0], wmode: "opaque"});
	$('#secondary_page_flash_AP_div.relentless').flashembed({src: "_flash/RELENTLESS.swf", version: [9, 0], wmode: "transparent"});
	$('#secondary_page_flash_AP_div.urgent').flashembed({src: "_flash/URGENT.swf", version: [9, 0], wmode: "transparent"});
	$('#secondary_page_flash_AP_div.future').flashembed({src: "_flash/FUTURE.swf", version: [9, 0], wmode: "transparent"});
	$('#secondary_page_flash_AP_div.resourceful').flashembed({src: "_flash/RESOURCEFUL.swf", version: [9, 0], wmode: "transparent"});
	

	
	

	




// -------------------- Flowpanes -----------------------------
	$('#flowpanes').scrollable({size: 1, clickable: false}).navigator({navi: '#card_thumbs', naviItem: 'a', activeClass: 'current'});
	
	$('#small').click(function(){
		$('#flowpanes p').css('font-size', '14px').css('line-height','19px').css('margin-bottom', '14px');
		$('#flowpanes h2').css('font-size', '14px');
		$('#flowpanes h3').css('font-size', '12px');
		$('#flowpanes .items .drop_cap').css('width', '40px').css('height', '52px').css('margin-right', '4px');
		$('#flowpanes .items ul').css('margin-top', '-14px').css('font-size', '14px').css('line-height','19px').css('margin-bottom', '14px');
	});
	$('#medium').click(function(){
		$('#flowpanes p').css('font-size', '18px').css('line-height','25px').css('margin-bottom', '18px');
		$('#flowpanes h2').css('font-size', '18px');
		$('#flowpanes h3').css('font-size', '16px');
		$('#flowpanes .items .drop_cap').css('width', '52px').css('height', '67px').css('margin-right', '6px');
		$('#flowpanes .items ul').css('margin-top', '-18px').css('font-size', '18px').css('line-height','25px').css('margin-bottom', '18px');
	});
	$('#large').click(function(){
		$('#flowpanes p').css('font-size', '22px').css('line-height','30px').css('margin-bottom', '22px');
		$('#flowpanes h2').css('font-size', '22px');
		$('#flowpanes h3').css('font-size', '20px');
		$('#flowpanes .items .drop_cap').css('width', '63px').css('height', '82px').css('margin-right', '8px');
		$('#flowpanes .items ul').css('margin-top', '-22px').css('font-size', '22px').css('line-height','30px').css('margin-bottom', '22px');
	});
	


// -------------------- Overlays ------------------------------

	$("#key_data_content ul li a[rel]").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0});
	$("#recycling_thumb a[rel]").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0});
	$("#video_thumb a[rel]").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0,
		onLoad: function() {
        
				var video_name = $("#video_thumb a[rel]").attr('rel');
				video_name = video_name.slice(1);
				var swf = "_flash/" + video_name + ".swf";
				var box = ".video_box." + video_name + "_div";
				
				$(box).flashembed({src:swf, version: [9, 0], wmode: "transparent"});
    
        },
		onClose: function() {
                var video_name = $("#video_thumb a[rel]").attr('rel');
				video_name = video_name.slice(1);
				var swf = "_flash/" + video_name + ".swf";
				var box = ".video_box." + video_name + "_div";
				
				$(box).html("");
                
        }
	});
	
	
	$(".internal_communications_thumb").mouseup(function(){
		thumb_class = $(this).attr('class');
		thumb_class="." + thumb_class.slice(30);
		
		
		$(".internal_communications_thumb" + thumb_class + " a[rel]").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0,
			onLoad: function() {
					var video_name = $(".internal_communications_thumb" + thumb_class + " a[rel]").attr('rel');
					video_name = video_name.slice(1);
					var swf = "_flash/" + video_name + ".swf";
					var box = ".small_video_box." + video_name + "_div";
				
					$(box).flashembed({src:swf, version: [9, 0], wmode: "transparent"});
		
			},
			onClose: function() {
					var video_name = $(".internal_communications_thumb" + thumb_class + " a[rel]").attr('rel');
					video_name = video_name.slice(1);
					var swf = "_flash/" + video_name + ".swf";
					var box = ".small_video_box." + video_name + "_div";
					
					$(box).html("");
					
			}
											   
		});
	
		
	});
	
	$("#findyourco2_thumb a").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0,
		onLoad: function() {
        							
				$('.video_box.findyourco2_div').flashembed({src:"_flash/findyourco2.swf", version: [9, 0], wmode: "transparent"});
    
        },
		onClose: function() {
                				
				$('.video_box.findyourco2_div').html("");
                
        }
	});

	$("#multimedia_content ul li a[rel]").overlay({mask: {color: '#000', opacity: .75}, effect: 'apple', fixed: false, top: 0,

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".multimedia_overlay_content");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}

	});



// -------------------- Tabs ----------------------------------

	$('.tab').toggle(
	function()
	{
		var tab_name = $(this).attr('id');
		var tab_wrapper = '#' + tab_name + '_wrapper';
				
		$(tab_wrapper).animate({marginLeft: "0px"}, 250);
	},
	function()
	{
		var tab_name = $(this).attr('id');
		var tab_wrapper = '#' + tab_name + '_wrapper';
		var tab_content = '#' + tab_name + '_content';
		var content_width = $(tab_content).css('width');
		var content_padding_left = $(tab_content).css('padding-left');
		var content_padding_right = $(tab_content).css('padding-right');
		
			
		content_width = content_width.slice(0, -2);
		content_padding_left = content_padding_left.slice(0, -2);
		content_padding_right = content_padding_right.slice(0, -2);
		
		content_width = parseInt(content_width);
		content_padding_left = parseInt(content_padding_left);
		content_padding_right = parseInt(content_padding_right);
		
		var content_width_total = content_width + content_padding_left + content_padding_right + "px";
		var content_width_neg = "-" + content_width_total;
		
		
		$(tab_wrapper).animate({marginLeft: content_width_neg}, 500);		
	});
	

// -------------------- SHEMS ----------------------------------
	
	$("#SHEMS_chart .has_tip.top_left").tooltip({effect: 'slide', relative: true, position: "top left", offset: [30, 30]}).dynamic();
	$("#SHEMS_chart .has_tip.bottom_left").tooltip({effect: 'slide', relative: true, position: "bottom left", offset: [0, 30]}).dynamic();
	$("#SHEMS_chart .has_tip.bottom_right").tooltip({effect: 'slide', relative: true, position: "bottom right", offset: [0, 0]}).dynamic();
	$("#SHEMS_chart .has_tip.top_right").tooltip({effect: 'slide', relative: true, position: "top right", offset: [30, 0]}).dynamic();

// -------------------- Nav Animation ----------------------------------	
	
	//$('#global_nav a').hover(function(){
//		li_class = $(this).parent().attr('class');
//		link_class = li_class.slice(10);
//		col_class = li_class.slice(0, 9);
//		bg_pos = null;
//		
//		if(link_class == "letter")
//		{
//		bg_pos = '-75px';
//		}
//		else if(link_class == "safety")
//		{
//		bg_pos = '-120px';
//		}
//		else if(link_class == "financial")
//		{
//		bg_pos = '-110px';
//		}
//		else if(link_class == "profile")
//		{
//		bg_pos = '-55px';
//		}
//		else if(link_class == "aspirations")
//		{
//		bg_pos = '-20px';
//		}
//		else if(link_class == "environment")
//		{
//		bg_pos = '-85px';
//		}
//		else if(link_class == "future")
//		{
//		bg_pos = '-115px';
//		}
//		else if(link_class == "contact")
//		{
//		bg_pos = '-160px';
//		}
//		else if(link_class == "policies")
//		{
//		bg_pos = '-60px';
//		}
//		else if(link_class == "social")
//		{
//		bg_pos = '-120px';
//		}
//		
//		$('#global_nav li.' + col_class + '.' + link_class).stop().animate({backgroundPosition:bg_pos +' 0px'});
//		},
//		function(){
//		$('#global_nav li.' + col_class + '.' + link_class).stop().animate({backgroundPosition: '-243px 0px'});
//		});
//		
	
	
});


