// The Top Ten Page class.
var TopTenPage = Class.create();
TopTenPage.prototype =
{
	initialize : function()
	{
	},
	
	loadFlash : function()
	{	
		var flashvars = {};
	
		var params =
		{
			menu            : 'false',
			wmode           : 'transparent',
			bgcolor         : '#ffffff',
			base            : '../flash/color/colorpalette/',
			allowFullScreen : 'true'
		};
	
		swfobject.embedSWF('../flash/inspiration/top-10-color-palettes/top10.r14.swf',
				'my_flashContent', '940', '722', '9.0.0',
				null, flashvars, params, null);	
	},
	
	sharePage : function()
	{	
		shareDialog.show( this.getBaseUrl(), 'Top 10 Colors', '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 topTenPage = new TopTenPage();

//----- Functions called from the Flash component
function sharePage()
{
	topTenPage.sharePage();
}
