/*
----------------------------------------------------------------------
 Media Player functions 2.0.0
----------------------------------------------------------------------
*/

var currentVideoId = '';
var flashLoaded = false;

function mp_getFlashMovie( movieName ) {

    if ( navigator.appName.indexOf("Microsoft") != -1 ) {
        return window[ movieName ];
    } else {
        return document[ movieName ];
    } // End if.

} // End mp_getFlashMovie().

function mp_initFlash( startVideoId ) {

	var so = new SWFObject( "/flash/blimpVideo/mediaPlayer.swf", "mp_flashVideo_content", "410", "275", "8", "#ffffff" );
	so.addParam( "flashvars", "xml=xml/mediaPlayer.xml&showConsole=false&skinUrl=/flash/blimpVideo/videoPlayerSkin.swf&startVideoId=" + startVideoId );
	so.addParam( "wmode", "transparent" );
	so.write( "mp_flashVideo" );

	flashLoaded = true;

} // End mp_initFlash().

function mp_setVideo( videoId ) {

	// Deselect the old video's link in the video list.
	mp_setLinkSelected( currentVideoId, false );

	// Select the new video's link in the video list.
	mp_setLinkSelected( videoId, true );

	currentVideoId = videoId;

	if ( flashLoaded ) {
		mp_getFlashMovie( 'mp_flashVideo_content' ).setVideo( videoId );

	} else {
		mp_initFlash( videoId );

	} // End if.

	// Show/hide the non-Flash video link.
	var nonFlashLinkObj = document.getElementById( 'mp_nonFlashVideoLink' );
	if ( nonFlashLinkObj ) {
		nonFlashLinkObj.style.visibility = ( ( nonFlashVideoUrls[ currentVideoId ] == null ) ? 'hidden' : 'visible' );
	} // End if.

} // End mp_setVideo().

function mp_setPhoto( photoId ) {

	// Only load photos if the Flash component is initialized.
	if ( flashLoaded ) {
		mp_getFlashMovie( 'mp_flashVideo_content' ).setPhoto( photoId );
	} // End if.

} // End mp_setPhoto().

function mp_showDesc( videoId ) {

	var shortDescObj = document.getElementById( 'mp_desc_short_' + videoId );
	var longDescObj = document.getElementById( 'mp_desc_long_' + videoId );

	if ( shortDescObj ) shortDescObj.style.display = 'none';
	if ( longDescObj ) longDescObj.style.display = 'block';

} // End mp_showDesc().

function mp_hideDesc( videoId ) {

	var shortDescObj = document.getElementById( 'mp_desc_short_' + videoId );
	var longDescObj = document.getElementById( 'mp_desc_long_' + videoId );

	if ( shortDescObj ) shortDescObj.style.display = 'block';
	if ( longDescObj ) longDescObj.style.display = 'none';

} // End mp_hideDesc().

function mp_rollOverListItem( listItemObj ) {

	if ( listItemObj.className == 'mp_videoListItem_selected' ) return;
	listItemObj.className = 'mp_videoListItem_over';

} // End mp_rollOverListItem().

function mp_rollOutListItem( listItemObj ) {

	if ( listItemObj.className == 'mp_videoListItem_selected' ) return;
	listItemObj.className = '';

} // End mp_rollOutListItem().

function mp_setLinkSelected( videoId, b ) {

	var obj = document.getElementById( 'mp_link_' + videoId );
	if ( obj == null ) return;

	obj.className = ( ( b ) ? 'mp_videoListItem_selected' : '' );
	if ( obj.blur ) obj.blur();

} // End mp_setLinkSelected().

<!-- Survey script originally taken from this URL... -->
function mp_openSurvey( surveyUrl ) {

	// Track the survey with Omniture.
	var surveyTitle = surveyTitles[ currentVideoId ];
	if ( surveyTitle == null ) surveyTitle = 'Goodyear Tires | Blimp Video | (' + currentVideoId + ')';
	s.pageName = surveyTitle;
	var s_code; try { s_code=s.t(); } catch( e ) { ; } if(s_code)document.write(s_code);

	// Go to the survey.
	var w = window.open( surveyUrl,"win","width=900,height=960,scrollbars=yes,resizable=yes,status=yes" );
	if ( w == null ) window.location.href = surveyUrl;

} // End mp_openSurvey().

function mp_openNonFlashVideo() {

	var wmvUrl = nonFlashVideoUrls[ currentVideoId ];
	if ( wmvUrl ) {		
		var w = window.open( wmvUrl );
		if ( w == null ) window.location.href = wmvUrl;
	} // End if.

} // End mp_openNonFlashVideo().
