// Color Palette class.
var ColorPalette = Class.create();
ColorPalette.prototype =
{

	initialize : function()
	{
	},

	loadFlash : function()
	{
		var flashvars =
		{
			color_visualizer_relative_page : '../../../color/color-visualizer.do',
			top_ten_relative_page          : '../../../inspiration/top-10-color-palettes.do'
		};
	
		var params =
		{
			menu            : 'false',
			wmode           : 'transparent',
			bgcolor         : '#ffffff',
			base            : '../flash/color/colorpalette/',
			allowFullScreen : 'true'
		};
	
		swfobject.embedSWF('../flash/color/color-palette/palette.r03.swf',
				'my_flashContent', '940', '500', '9.0.0',
				null, flashvars, params, null);
	},

	trackPath : function(path)
	{
		pageTracker._trackPageview('/color/color-palette/tracking/' + path);
	},

	sharePage : function()
	{
		this.trackPath( 'sharePage' );
		shareDialog.show( this.getBaseUrl(), 'Glidden Color Palette', 'Share This Tool' );
	},

	// Returns the base URL without session or query information.
	//
	getBaseUrl : function()
	{
	
		var retVal = window.location.href;
	
		// Remove the anchor information.
		var anchorPos = retVal.indexOf( '#' );
		if ( anchorPos > 0 ) {
	
			var retVal = window.location.href.substr( 0, anchorPos );
	
		} // End if.

		// Remove the session ID information.
		var sessionIdPos = retVal.indexOf( ';' );
		if ( sessionIdPos > 0 ) {
	
			var retVal = window.location.href.substr( 0, sessionIdPos );
	
		} // End if.
	
		// Remove the query variables.
		var queryPos = retVal.indexOf( '?' );
		if ( queryPos > 0 ) {
	
			var retVal = window.location.href.substr( 0, queryPos );
	
		} // End if.
	
		return retVal;
	
	}

}


var colorPalette = new ColorPalette();

//----- Called from the Flash component.

function trackPath( path ) {

	colorPalette.trackPath( path );

} // End trackPath().

function linkToOther (linkID)
{
	if (linkID == "homedepot")
	{
		window.location.href = '../store-locator/where-to-buy.do';
	}
}

function sharePage()
{
	colorPalette.sharePage();
}

