/*
----------------------------------------------------------------------
  Home JavaScript.
  For section /index.html
----------------------------------------------------------------------
*/

var HomePage = Class.extend( {

initFlash : function() {

	// If testing with disabled flash: ex. "index.html?noflash".
	if ( window.location.href.indexOf( 'noflash' ) >= 0 ) return;

	// Create a new unique communications ID (for full screen Flash).
	var commId = new Date().getTime();

	// Load the promo module.
	var so = new SWFObject( "/flash/global/mainPromoLoader.swf", "promoModule_flash", "725", "300", "8", "#ffffff" );
	so.addVariable( "xml", "/xml/home/v6/landingPagePromosList.xml" );
	so.addVariable( "dateUrl", "/cfmx/web/gytires/utilities/getDate.cfm" );
	so.addVariable( "showConsole", "false" );
	so.addVariable( "commId", commId );
	//so.addVariable( "s_gdyr.prop31", s_gdyr.getDaysSinceLastVisit('s_lv') );
	so.addParam( "wmode", "transparent" );
	so.write( "my_flashContent" );

}, // End initFlash().

initFlashCarousel : function() {

	// If testing with disabled flash: ex. "index.html?noflash".
	if ( window.location.href.indexOf( 'noflash' ) >= 0 ) return;

	// Create a new unique communications ID (for full screen Flash).
	var commId = new Date().getTime();

	// Load the carousel module.
	var so = new SWFObject( "/flash/home/v6/gy_carousel.swf", "flashContent", "725", "200", "8", "#f2f5fa" );
	so.addVariable( "basePath", "" );
	so.addVariable( "omnitureAccount", "goodyeartirescom" );
	so.addVariable( "showConsole", "false" );
	so.addParam( "wmode", "transparent" );
	so.write( "my_flashContentCarousel" );

}, // End initFlash().

initMainLinks : function() {

	var thisObj = this;

	$( '#my_mainLink_carMinivan' ).mouseover(
		function( e ) {
			thisObj.onMainLinkRollOver( 'carMinivan' );
		}
	);
	$( '#my_mainLink_suvTruck' ).mouseover(
		function( e ) {
			thisObj.onMainLinkRollOver( 'suvTruck' );
		}
	);
	$( '#my_mainLink_sportPerf' ).mouseover(
		function( e ) {
			thisObj.onMainLinkRollOver( 'sportPerf' );
		}
	);
	$( '#my_mainLink_winter' ).mouseover(
		function( e ) {
			thisObj.onMainLinkRollOver( 'winter' );
		}
	);

	$( '#my_mainLink_carMinivan' ).mouseout(
		function( e ) {
			thisObj.onMainLinkRollOver( 'none' );
		}
	);
	$( '#my_mainLink_suvTruck' ).mouseout(
		function( e ) {
			thisObj.onMainLinkRollOver( 'none' );
		}
	);
	$( '#my_mainLink_sportPerf' ).mouseout(
		function( e ) {
			thisObj.onMainLinkRollOver( 'none' );
		}
	);
	$( '#my_mainLink_winter' ).mouseout(
		function( e ) {
			thisObj.onMainLinkRollOver( 'none' );
		}
	);

}, // End initMainLinks().

onMainLinkRollOver : function( category ) {

	var cssClass;

	switch ( category ) {

		case 'carMinivan':
			cssClass = 'my_mainLinksText_carMinivan';
			break;

		case 'suvTruck':
			cssClass = 'my_mainLinksText_suvTruck';
			break;

		case 'sportPerf':
			cssClass = 'my_mainLinksText_sportPerf';
			break;

		case 'winter':
			cssClass = 'my_mainLinksText_winter';
			break;

		default:
			cssClass = 'my_mainLinksText_none';

	} // End switch.

	var my_mainLinksText = $( '#my_mainLinksText' )[ 0 ];
	my_mainLinksText.className = cssClass;

} // End onMainLinkRollOver().

} );

var homePage = new HomePage();
