<!--
	//----------------------------------------------------
	// product attributes object declaration
	//----------------------------------------------------
	var oProductAttributes = new Object();
	
	oProductAttributes.sName;
	oProductAttributes.fBasePrice;
	oProductAttributes.nId;
	oProductAttributes.bError = false;
	oProductAttributes.sBasketLayer = '';
	oProductAttributes.oAttributes 		= new Object();				
	oProductAttributes.oExclusions 		= new Object();				
	oProductAttributes.oAbsolutePrices 	= new Object();				
		
	//----------------------------------------------------
	// attribute methods
	//----------------------------------------------------
	
	oProductAttributes.registerAttribute = function( nId, sName, bOption, sImage )
	{
		var oAttribute = new Object();
		
		oAttribute.nId				= nId;
		oAttribute.sName			= sName;
		oAttribute.bOption			= bOption;
		oAttribute.sImage			= sImage;
		oAttribute.oSelectedValue;
		oAttribute.oValues			= new Object();
		oAttribute.bRequired		= true;
		
		oAttribute.registerValue = function( nId, sName, sImage, bSelected, fPriceModifier )
		{
			var oValue = new Object();
			
			oValue.nId 			= nId;
			oValue.sName 		= sName;
			oValue.bSelected	= bSelected;
			oValue.sImage		= sImage;
			oValue.oAttribute	= this;
			oValue.aOptions		= new Array();
			oValue.fPriceModifier = fPriceModifier;
			
			oValue.highlight = function( bHighlight )
			{
				var oTable 		= getObject( 'attributeValueTable' + this.nId );
				var oTableCell	= getObject( 'attributeValueTableCell' + this.nId );
				var oImage 		= getObject( 'productModelShot' );
				var bExcluded	= this.isExcluded();

				for( var nOption = 0; nOption < this.aOptions.length; nOption++ )
				{
					var oOption = oProductAttributes.oAttributes[ this.aOptions[ nOption ] ];
					var sOptionLayer = 'productOption' + this.aOptions[ nOption ];
					
					if( oOption )
						oOption.bRequired = bHighlight;
											
					if( bHighlight )
						showLayer( sOptionLayer );
					else
						hideLayer( sOptionLayer );
				}

				if( oTable )																
				{
					oTable.style.borderStyle = 'solid';
					
					if( bExcluded )
					{
						oTable.style.borderColor = '#CCCCCC';
						
						if( bHighlight || this.bSelected )
							oTable.style.borderWidth = '2px';					
						else
						{
							oTable.style.borderWidth = '1px';					
							oTable.style.borderStyle = 'dashed';
						}
					}
					else
					{
						if( bHighlight || this.bSelected )
						{
							oTable.style.borderColor = '#333333';
							oTable.style.borderWidth = '2px';					
						}
						else
						{
							oTable.style.borderColor = '#999999';
							oTable.style.borderWidth = '1px';
						}
					}
				}
				
				if( oTableCell )
				{
					if( bExcluded )
					{
						oTableCell.style.backgroundColor = '#EEEEEE';
						oTable.style.color = '#FFFFFF';
					}
					else
					{
						if( bHighlight || this.bSelected )
						{
							oTableCell.style.backgroundColor = '#AAAAAA';
							oTable.style.color = '#FFFFFF';
						}
						else
						{
							oTableCell.style.backgroundColor = '#FFFFFF';
							oTable.style.color = '#666666';
						}
					}
				}
				
				if( oImage )
				{
					if( this.sImage.length > 0 )
					{				
						if( bHighlight || this.bSelected )
							oImage.src = this.sImage;
						else
							if( this.oAttribute.oSelectedValue )
								oImage.src = this.oAttribute.oSelectedValue.sImage;
							else
								if( this.oAttribute.sImage )
									oImage.src = this.oAttribute.sImage;
								
					}
				}						
				
			}
			
			oValue.isExcluded = function()
			{
				var sExclusion = oProductAttributes.generateProductKey( this );
						
				//alert( sExclusion );		
				if( oProductAttributes.oExclusions[ sExclusion ] )
					return true;
				else
					return false;
			}

			this.oValues[ nId ] = oValue;
			
			if( oValue.bSelected )
			{
				this.selectValue( nId );
				this.setCaption( sName );
			}
			else
			{
				oValue.highlight( oValue.bSelected );
			}
						
			return oValue;
		}
		
		oAttribute.registerOption = function( nValueId, nOptionId )
		{
			var oValue = this.oValues[ nValueId ];
			var oOption = oProductAttributes.oAttributes[ nOptionId ];
			var sOptionLayer = 'productOption' + nOptionId;
								
			if( oValue )
			{
				oValue.aOptions.push( nOptionId );
			}
			
			if( oOption )
				oOption.bRequired = false;

			hideLayer( sOptionLayer );
		}
		
		
		oAttribute.selectValue = function( nId )
		{
			for( var nIndex in this.oValues )
			{
				var oValue = this.oValues[ nIndex ];
				if( oValue.nId == nId )
				{
					oValue.highlight( true )
					oValue.bSelected = true;
					this.oSelectedValue = oValue;
				}
				else
				{
					oValue.bSelected = false;
					oValue.highlight( false )
				}
			}
			
			if( this.oSelectedValue.isExcluded() )
				oProductAttributes.setError();
			else
				oProductAttributes.clearError();
					
			
			oProductAttributes.updatePrice();
		}
		
		oAttribute.setExcluded = function( oSelectedAttribute, oValue )
		{
			var oSelectedValue = oSelectedAttribute.oSelectedValue;
			
			oSelectedAttribute.oSelectedValue = oValue;
			
			for( var nIndex in this.oValues )
			{
				var oValue = this.oValues[ nIndex ];
				
				oValue.highlight( oValue == this.oSelectedValue );
			}
			
			oSelectedAttribute.oSelectedValue = oSelectedValue;
		}
		
		oAttribute.setCaption = function( sCaption )
		{
			var oCaption = getObject( 'attributeCaption' + this.nId );			
			if( oCaption )
			{
				oCaption.innerHTML = sCaption;
			}
		}
						
		oAttribute.setDefaultCaption = function()
		{
			if( this.oSelectedValue )			
				this.setCaption( this.oSelectedValue.sName );
			else
				this.setCaption( '' );
		}
		
		oAttribute.handleError = function()
		{
			this.setMessage( 'Please select a ' + this.sName.toLowerCase() );
		}
		
		oAttribute.setMessage = function( sMessage )
		{
			var sLayer = 'attributeMessage' + this.nId;
			var oLayer = getObject( sLayer );
			
			oLayer.innerHTML = sMessage;
			
			if( sMessage.length > 0 )
				showLayer( sLayer );
			else
				hideLayer( sLayer );				
		}
						
		this.oAttributes[ nId ] = oAttribute;				
		
		return oAttribute;
	}
	
	oProductAttributes.generateProductKey = function( oDefaultValue )
	{
		var sKey = '';
		
		for( var nIndex in this.oAttributes )
		{
			var oAttribute = this.oAttributes[ nIndex ];
			
			if( !oAttribute.bOption )
			{
				var sID = '';
				
				if( oDefaultValue && ( oAttribute == oDefaultValue.oAttribute ) )
				{
					// insert default attribute id
					sID = oDefaultValue.nId;
				}
				else
				{
					// insert selected value id
					if( oAttribute.oSelectedValue )					
						sID = oAttribute.oSelectedValue.nId;						
				}
								
				if( sKey.length )
					sKey += ':';
					
				sKey += sID;
			}							
		}	
		
		return sKey;	
	}
	
	oProductAttributes.updatePrice = function()
	{
		var oConfiguredPrice = document.getElementById( 'configuredPrice' );
		
		if( oConfiguredPrice )
		{
			var sKey = oProductAttributes.generateProductKey();
			var fPrice = 0.0;
			
			if( this.oAbsolutePrices[ sKey ] )
			{
				fPrice = this.oAbsolutePrices[ sKey ];
			}
			else
			{
				fPrice = this.fBasePrice;
				
				for( var nIndex in this.oAttributes )
				{
					var oAttribute = this.oAttributes[ nIndex ];
					var oValue = oAttribute.oSelectedValue;
					
					if( oValue )
						fPrice += oValue.fPriceModifier;
					else
					{
						// SLB 9/30/2008
						// if we don't have all the information then don't update the price
						if( oAttribute.bRequired )
							return;
					}
				}	
			}
			
			oConfiguredPrice.innerHTML = '$' + fPrice + '.00';
			
		}	
	}
	
	oProductAttributes.registerExclusion = function( sExclusion )
	{
		this.oExclusions[ sExclusion ] = true;
	}
	
	oProductAttributes.registerAbsolutePrice = function( sKey, fPrice )
	{
		this.oAbsolutePrices[ sKey ] = fPrice;
	}
	
	oProductAttributes.onMouseEvent = function( nAttributeId, nValueId, bMouseOver )
	{
		var oSelectedAttribute 	= this.oAttributes[ nAttributeId ];
		var oSelectedValue 		= oSelectedAttribute.oValues[ nValueId ];

		if( oSelectedAttribute.oSelectedValue != oSelectedValue )
		{
			oSelectedValue.highlight( bMouseOver );
		
			for( var nIndex in this.oAttributes )
			{
				var oAttribute = this.oAttributes[ nIndex ];
	
				if( oAttribute == oSelectedAttribute )
				{
					if( bMouseOver )
						oAttribute.setCaption( oSelectedValue.sName );
					else
						oAttribute.setDefaultCaption();						
				}
				else
				{
					if( bMouseOver )
						oAttribute.setExcluded( oSelectedAttribute, oSelectedValue );
					else
						oAttribute.setExcluded( oSelectedAttribute, oSelectedAttribute.oSelectedValue );
				}
			}			
		}
	}
	
	oProductAttributes.onMouseOver = function( nAttributeId, nValueId )
	{
		this.onMouseEvent( nAttributeId, nValueId, true );
	}
	
	oProductAttributes.onMouseOut = function( nAttributeId, nValueId )
	{
		this.onMouseEvent( nAttributeId, nValueId, false );
	}
	
	oProductAttributes.onClick = function( nAttributeId, nValueId )
	{
		var oAttribute = this.oAttributes[ nAttributeId ];

		oAttribute.selectValue( nValueId );
	}
				
	oProductAttributes.setError = function()
	{
		var sMessage 	= this.sName + ' is not available in '; 
		var sAttributes = '';
		
		for( nIndex in this.oAttributes )
		{
			var oAttribute = this.oAttributes[ nIndex ];

			if( oAttribute.oSelectedValue )
			{
				if( sAttributes )
					sAttributes += ', ';
					
				sAttributes += oAttribute.oSelectedValue.sName;
			}
		}
		
		this.setMessage( sMessage + sAttributes );	
		this.bError = true;
	}
	
	oProductAttributes.clearError = function()
	{
		this.setMessage( '' );	
		this.bError = false;
	}
	
	oProductAttributes.closeBag = function()
	{
		oAnimatedLayers.closeLayer( this.sBasketLayer );
	}	
			
	oProductAttributes.onAddToBag = function( nProductId )
	{
		if( this.bError )
		{
		}
		else
		{
			var sUrl = '/quickbasket.aspx?pid=' + nProductId + '&';
			
			for( var nIndex in this.oAttributes )
			{
				var oAttribute = this.oAttributes[ nIndex ];
				
				if( oAttribute.oSelectedValue )
				{
					oAttribute.setMessage( '' );
					sUrl += 'a' + oAttribute.nId + '=' + oAttribute.oSelectedValue.nId + '&';				
				}
				else
				{
					if( oAttribute.bRequired )
					{
						oAttribute.handleError();
						return false;
					}
					else
					{
						oAttribute.setMessage( '' );
					}
				}
			}
			
			var oQuantity = getObject( 'productQuantity' );
			var nQuantity = 0; 
			
			if( oQuantity )
			{
				var oBasketItems = getObject( 'basketItems' );	
				
				nQuantity = parseInt( oQuantity.value );
				
				if( oBasketItems )
					oBasketItems.innerHTML = parseInt( oBasketItems.innerHTML ) + nQuantity;
				
				sUrl += 'qty=' + nQuantity;
			}
	
			//oAnimatedLayers.openLayer( this.sBasketLayer, sUrl );
			//window[ "cart" ].location.replace( '/blank.htm' );
			//window[ "cart" ].location.replace( sUrl );
			setTimeout( "window[ 'cart' ].location.replace( '/blank.htm' );", 10 );
			setTimeout( "window[ 'cart' ].location.replace( '" + sUrl + "' );", 100 );
			showLayer( 'basketLayer' );
			setTimeout( "hideLayer( 'basketLayer' );", 7000 );		
	
			// display the shop more button		
			var oShopMore = getObject( 'shopMore' );
			
			oShopMore.src = "/images/button_shopmore.gif";
			
			this.setMessage( nQuantity + ' ' + this.sName + ' has been added to your bag.'  );
		}
	}					
	
	oProductAttributes.setMessage = function( sMessage )
	{
		var sLayer = 'productMessage';
		var oLayer = getObject( sLayer );
		
		oLayer.innerHTML = sMessage;
		
		if( sMessage.length > 0 )
			showLayer( sLayer );
		else
			hideLayer( sLayer );			
	}
	
						
	var oProductTabs = new Object();
	
	oProductTabs.oTabs = new Object();
	
	oProductTabs.registerTab = function( sName, sActiveImage, sInactiveImage )
	{
		var oTab = new Object();
		
		oTab.sName 			= sName;
		oTab.sActiveImage 	= sActiveImage;
		oTab.sInactiveImage = sInactiveImage;
		
		this.oTabs[ sName ] = oTab;
	}

	oProductTabs.setProductTab = function( sActiveTab )
	{
		for( var nIndex in this.oTabs )
		{
			var oTab 	= this.oTabs[ nIndex ];
			var oImage 	= getObject( oTab.sName + 'Button' );
			
			if( oTab.sName == sActiveTab )
			{
				if( oImage )
					oImage.src = oTab.sActiveImage;
					
				showLayer( oTab.sName );
			}
			else
			{
				if( oImage )
					oImage.src = oTab.sInactiveImage;
					
				hideLayer( oTab.sName );
			}
		}
	}
	
	oProductTabs.registerTab( 'productDescription', '/images/product_tab_description_active.gif', '/images/product_tab_description_inactive.gif' );
	oProductTabs.registerTab( 'productSizing', '/images/product_tab_sizing_active.gif', '/images/product_tab_sizing_inactive.gif' );
	oProductTabs.registerTab( 'productRelated', '/images/product_tab_related_active.gif', '/images/product_tab_related_inactive.gif' );
																		
//-->
