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);
	}
}

function SendDataToFlashMovie(newPage)
{
	var flashMovie=getFlashMovieObject("main_flash");
	flashMovie.sendTextToFlash(newPage);
	flashMovie.closeFromJS();
}



function closeFlashWin() {
	var flashMovie=getFlashMovieObject("main_flash");
	flashMovie.closeFromJS();
}

// The moment has been clicked and is starting to open
function momentIn(id) {
    jQuery.noConflict();            
    (function($) { 
      $(function() {

		$.get('/watchlite/'+id+'?type=info', function(data) {
			$('#moment-info').html(data);
			jQuery('#moment-info').fadeIn('fast', function() {
		  	  // Animation complete.
		    });
		});

		$.get('/watchlite/'+id+'?type=player', function(data) {
			$('#moment-player').html(data);
		});

      });
    })(jQuery);

    _gaq.push(['_trackEvent', 'Flashwall View', id]);

}

// The moment has finished zooming in and we should now fade in our panels
function momentOn(id) {
    jQuery('#moment-player').show();
    
}

// The moment is closed and zooming back to the wall
function momentOut() {

if (jQuery('#moment-info').is(':visible')) {
    var flashMovie=getFlashMovieObject("main_flash");
    flashMovie.closeFromJS();

    jQuery('#moment-info').fadeOut('fast', function() {
  	    jQuery('#moment-info').html('');
    });
}

if (jQuery('#moment-player').is(':visible')) {
    jQuery('#moment-player').fadeOut('fast', function() {
        jQuery('#moment-player').html('');
    });
}
}


