


function launchMainVideo($el) {

	//make sure panel video isn't playing
	removeActiveVideo();
	
	var $this;
	if(!$el) {
		$this = $('a#featured-video-link');
	} else {
		$this = $el;
	}
	//do video
	_bkgd = '#000000';
	_width = 760;
	_height = 550;	
 	var $overlay = doOverlay(_width,_height,_bkgd);
	var $closelink = $('<a id="close-video-link" class="close" href="#" />').html('close').click(function() {
		$('#overlay-container').empty();
		$.unblockUI();
		//add active video back
		reembedActiveVideo();			
		return false;			
	});
	$overlay.prepend($closelink);
				
	$overlay.append('<div id="video-container" />');
	var _title = $this.attr('title');
	var _url = ($this.attr('href')).replace('m4v','flv');
	_bkgd = '#000000';

	var flashvars = {};
	flashvars.videoTitle = _title;
	flashvars.flvPath = _url;
	flashvars.transcriptLink = "transcript-ecomagination-is-ge.html";
	flashvars.downloadVideoLink = $this.attr('href');
	var params = {};
		params.bgcolor = _bkgd;
	var attributes = {};
	swfobject.embedSWF("_files/swf/eco_video_player_main.swf", "video-container", "720", "510", "9.0.28", null, flashvars, params, attributes);	
	return false;
}


/*
 * ONLOAD EVENTS
 */
$(document).ready(function() {

	/* ECO VIDEO and DIAGRAM OVERLAYS
		============================= */
	//$('img#intro-video-still').css('cursor','pointer');
	
	$('a#what-is-eco-link, a#our-progress-link, a#featured-video-link').click(function() {		
		var $this = $(this);		
		var isVideo = $this.attr('id').indexOf('-video-') !== -1;
		var isProgress = $this.attr('id') === 'our-progress-link';
		var _bkgd = '#ffffff';
		if(isVideo) {
			//chage $this to get url and such
			/*
			if($this.attr('id') === 'intro-video-still') { 
				$this = $('a#featured-video-link'); 
			}
			*/
			launchMainVideo($this);
		} else if (isProgress) {
			var $overlay = doOverlay(650,600,'#ffffff','40px');
			//get content
			$overlay.load($this.attr('href') + ' #our-progress', function() {
				//make sure panel video isn't playing
				removeActiveVideo();
				handleProgressOverlay();
				$('#our-progress').hide().fadeIn()
			});		
		} else {
			//eco diagram
				var $overlay = doOverlay(860,550,'#ffffff');
				//get content
				$overlay.load($this.attr('href') + ' #what-is-eco', function() {
					//make sure panel video isn't playing
					removeActiveVideo();
					$('#what-is-eco a.close').click(function() {
						$('#overlay-container').empty();
						$.unblockUI();
						//add active video back
						reembedActiveVideo();					
						return false;
					});
					$('#what-is-eco').hide().fadeIn()
				});
		}		
		return false;
	});
	
	
});





