// JavaScript for client side configuration

	function allowAddToCart( showDiv )
	{
		var addToCart1 = document.getElementById("addEnabled") ;
		var noAddToCart = document.getElementById("addDisabled") ;
		if ( showDiv == 1 )
		{
			addToCart1.style.display = "block" ;
			noAddToCart.style.display = "none" ;
		}
		if ( showDiv == 0 )
		{
			addToCart1.style.display = "none" ;
			noAddToCart.style.display = "block" ;
		}
	}
	
	function OnChange(driveitem)
	{
		curddlist = document.getElementById(DriveOrder[driveitem]);
		//change last selection
		curddlist.parentNode.className ='mySelection';
		allowAddToCart( 0 );

		if( 0 == curddlist.selectedIndex )
		{	
			if( 0 == driveitem )
			{
				InitPage() ;
			}
			else
			{
				var lastControlWithSel = driveitem ;
				var lastSel ;
				while( lastControlWithSel > 0 )
				{
					lastControlWithSel-- ;
					var c = document.getElementById( DriveOrder[lastControlWithSel] ) ;
					lastSel = c.selectedIndex ;
					
					if( 0 != lastSel )
						break ;
				}

				UpdateRangeInfo( lastControlWithSel ) ;
			}

			DisableControls( driveitem+1 ) ;	// Clear out following dropdowns, current DD sel NOT valid
					
			// Only call SetConfigModeByChoosingASelection() if the first driveitem dropdown is changed
			if (0 == driveitem)
			{
				SetConfigModeByChoosingASelection();
			}			
			
			return ;
		}

		selectval = curddlist.options[curddlist.selectedIndex].value; 
        
		newddlist = document.getElementById(DriveOrder[driveitem+1]);
		newddlist.length = 0;	// Clear out options array

		//Re-create OPTIONS array, first entry always Choose name, -1
		var selectStr = "Make your selection" ;
		newddlist.options[newddlist.options.length] = new Option( selectStr,-1 ) ;

		var newOptions = SelectDeltas[driveitem][selectval];
		var baseOptions = SelectDeltas[driveitem][0];
		var valueOffset = newOptions[0] - baseOptions[0];	// bump index to account for selects multiple data sets

		var optionTextOffset = newOptions[0] ;
		var optionsLength = newOptions[1] ;

		for(i = 0; i < optionsLength; i++ )
		{
			newddlist.options[newddlist.options.length] = new Option(OptionText[optionTextOffset], valueOffset );
			valueOffset++ ;
			optionTextOffset++ ;
		}
		//sets next drop down class to active
		newddlist.parentNode.className ='active';	
		newddlist.disabled = false;
		

		// Ripple forward for only one sel...
		if( 1 == optionsLength )
		{
			
			newddlist.selectedIndex = 1 ;
			var next = driveitem + 1 ;
			//skips last drop down
			newddlist.parentNode.className ='mySelection';

			if( DriveOrder.length == next )
				newddlist.onlastchange( next ) ;
			else
				newddlist.onchange( next ) ;	
		}
		else
		{
			// Clear out following dropdowns, current DD sel valid
			DisableControls( driveitem+2 ) ;
		}

		UpdateRangeInfo( driveitem ) ;
		
		// Only call SetConfigModeByChoosingASelection() if the first driveitem dropdown is changed
		if (0 == driveitem)
		{
			SetConfigModeByChoosingASelection();
		}
		

	}// OnChange

	function UpdateRangeInfo( driveitem )
	{
		minPrice = 99999.99 ;
		maxPrice = -1 ;

		var control ;
		var cindex ;
		var lo ;
		var loBase ;
		var start ;
		var finish ;
		var adjustOffset ;
		var length ;
		var offset ;

		// First get driveitem length and offset from current control
		control = document.getElementById( DriveOrder[driveitem] ) ;
		cindex = control.options[control.selectedIndex].value ;

		lo = SelectDeltas[driveitem][cindex] ;
		loBase = SelectDeltas[driveitem][0] ;
		adjustOffset = loBase[0] ;	// Bring length zero based
		length = lo[1] - 1 ; // zero based for last section
		offset = lo[0] - adjustOffset ;

		driveitem++ ;

		while( driveitem < DriveOrder.length - 1 )
		{
			start = SelectDeltas[driveitem][offset] ;
			finish = SelectDeltas[driveitem][offset+length] ;
			loBase = SelectDeltas[driveitem][0] ;
			adjustOffset = loBase[0] ;

			offset = start[0] - adjustOffset ;
			length = finish[0] + finish[1] - start[0] - 1 ;

			driveitem++ ;
		}

		PriceRange( offset, length + 1) ;

		Availability( offset, length + 1 ) ;

	}// UpdateRangeInfo

	function DisableControls( iStartFrom )
	{

		for( var i = iStartFrom; i < DriveOrder.length; i++ )
		{
			var control = document.getElementById( DriveOrder[i] ) ;
			//remove class to render disabled
			control.parentNode.className ='';
			control.selectedIndex = 0 ;
			control.disabled = true ;
		}

		HideCheckboxes() ;
	}// DisableControls
	
	function DisableDropdownControls()
	{
		for( var i = 0; i < DriveOrder.length; i++ )
		{
			var control = document.getElementById( DriveOrder[i] ) ;
			control.selectedIndex = 0 ;
			control.disabled = true ;
		}
	}

	function OnLastChange( driveitem )
	{
		curddlist = document.getElementById(DriveOrder[driveitem]);
		selectval = curddlist.options[curddlist.selectedIndex].value;

		if( -1 == selectval )
		{
			allowAddToCart( 0 ) ;
			return ;
		}
		
		var skuControl = document.getElementById("sku");
		
		allowAddToCart( 1 );

		var baseOL = SelectDeltas[driveitem-1][0] ;
		var baseIndex = selectval - baseOL[0] ;
	}

	function OnLastChangeCB( driveitem )
	{
		
		curddlist = document.getElementById(DriveOrder[driveitem]);
		
		selectval = curddlist.options[curddlist.selectedIndex].value ;
		
		if( -1 == selectval )
		{
			HideCheckboxes() ;
			// no value added, keep active
			curddlist.parentNode.className ='active';
			return ;
		}else{
			//deselect last drop down
			curddlist.parentNode.className ='mySelection';
		}

		var ol = SelectDeltas[driveitem][selectval] ;
		var olBase = SelectDeltas[driveitem][0] ;
		var o = ol[0] ;
		var l = ol[1] ;
		var skuOffset = o - olBase[0] ;

		EnablePopulateCheckboxes( skuOffset, o, l ) ;
	}

	function EnablePopulateCheckboxes( so, o, l )
	{
		// Hide all first, then show selectable
		HideCheckboxes();
		var cntl ;
	
		for( i = 0; i < l; i++ )
		{
			
			cntl = document.getElementById( OptionText[ o ] + "v" ) ;
			cntl.style.display = "block" ;

			var price = Price[so] ;
			var sku = Code[so] ;
			var iAvail = Avail[so] ;
			var shipWeight = Weight[so] ;
			var pb = PicBase[so] ;			
			var avail = AvailTxt[iAvail] ;

			cntl = document.getElementById( OptionText[ o ] ) ;
			cntl.value = sku ;

			cntl = document.getElementById( OptionText[ o ] + "p" ) ;
			cntl.value = FormatNumber( price, 2 ) ;

			cntl = document.getElementById( OptionText[ o ] + "a" ) ;
			cntl.value = avail ;
		
			cntl = document.getElementById( OptionText[ o ] + "h" ) ;
// RJL Text for Availability			
//			cntl.value = iAvail + ":" + shipWeight + ":" + pb ;
			cntl.value = avail + ":" + shipWeight + ":" + pb ;

			o++ ;
			so++ ;
		}
		showHeaderAndFooter("block");
	}

	function HideCheckboxes()
	{
		var cntl ;
		//alert(CBList.length);
		
		for( var i = 0; i < CBList.length; i++ )
		{
			cntl = document.getElementById( CBList[i] ) ;
			cntl.value = "" ;
			CBJSDSel( cntl ) ;

			cntl = document.getElementById( CBList[i] + "v" ) ;
			
			cntl.style.display = "none" ;

			cntl = document.getElementById( CBList[i] + "p" ) ;
			cntl.value = "" ;
			
			showHeaderAndFooter("none");
		}
	}
	

	
	function showHeaderAndFooter(cssStyle)
	{
		document.getElementById( "checkListHeader" ).style.display = cssStyle ;
		document.getElementById( "checkListFooter" ).style.display = cssStyle ;
	}

	function InitPage()
	{
		minPrice = 99999.99 ;
		maxPrice = -1 ;
		PriceRange( 0,Price.length ) ;
		Availability( 0, Avail.length ) ;

		if( 0 == DriveOrder.length )	// Handle No drop downs
		{
			EnablePopulateCheckboxes( 0, 0, Code.length ) ;
		}		
	}

	function Availability( offset, length )
	{
		var minAvail = 100 ;
		var maxAvail = -1 ;

		var lastIndex = offset + length ;
		for( i=offset; i<lastIndex; i++ )
		{
			var a = Avail[i] ;
			if( a < minAvail )
				minAvail = a ;
			if( a > maxAvail )
				maxAvail = a ;
		}

		if( minAvail == maxAvail )
		{
			document.ProdConfig.avail.value = AvailTxt[minAvail] ;
		}
		else
		{
			document.ProdConfig.avail.value = "" ;
		}
	}

	function PriceRange( offset, length )
	{
		var lastIndex = offset + length ;
		for(i=offset;i<lastIndex;i++)
		{
			var p = Price[i] ;
			if( p < minPrice )
				minPrice = p ;
			if( p > maxPrice )
				maxPrice = p ;
		}

		if( maxPrice - minPrice < 0.009 )
			document.ProdConfig.pricelevel.value = FormatNumber(minPrice,2) ;
		else
			document.ProdConfig.pricelevel.value = FormatNumber(minPrice,2) + " to " + FormatNumber( maxPrice, 2 ) ;
	}// PriceRange

	function FormatNumber( val, decimals )
	{
		var num = parseFloat( val ) ;
		if (num.toFixed)
			return num.toFixed( decimals ) ;
		else
			return val; //SafariHack( val, decimals );
	}
	
	function SafariHack ( val, decimals )
	{
		// default to two decimal digits
		var decDigits = ( isNaN(decimals) ) ? 2 : decimals;
		var k         = Math.pow( 10, decDigits );
		var fixedNum  = Math.round( parseFloat(val) * k ) / k;
		var sFixedNum = new String( fixedNum );
		var aFixedNum = sFixedNum.split( "." );
		var i         = ( aFixedNum[1] ) ? aFixedNum[1].length : 0;
		// append decimal point if needed
		if ( (i == 0) && (decDigits) ) { sFixedNum += "."; }

		// append zeros if needed
		while ( i < decDigits ) 
		{
			sFixedNum += "0";
			i++;
		}
		return sFixedNum;
	}

	function CBJSDSel( cntl )
	{
		if( cntl.checked )
		{
			cntl.checked = false ;	// Clear control and reduce counter
			CBSel( cntl ) ;
		}
	}

	function CBJSSel( cntl )
	{
		if( false == cntl.checked )
		{
			cntl.checked = true ;
			CBSel( cntl ) ;
		}
	}

	
	function ShowHideCustomOptions()
	{
		// hasCustomAttributesID var should be set at page level b/c clientID has a special prefix
		var hasCustomAttributes = document.getElementById(hasCustomAttributesID);
		var divCustomOptions = document.getElementById("custom_options");
		
		if (hasCustomAttributes.value == "true")
		{
			divCustomOptions.style.display = "block";
		}
		else
		{
			divCustomOptions.style.display = "none";
		}
	
	}
	
	
	function AllowCustomOptions(allow)
	{
		// ID names should be set at page level b/c clientID has a special prefix
		var allCustomOptions = document.getElementById("customEnabled");
		var disallowCustomOptions = document.getElementById("customDisabled");
		
		if ( allow == 1 )
		{
			allCustomOptions.style.display = "block" ;
			allCustomOptions.parentNode.className = "alpha_100";
			disallowCustomOptions.style.display = "none" ;
		}
		if ( allow == 0 )
		{
			allCustomOptions.style.display = "none" ;
			allCustomOptions.parentNode.className = "alpha_50";
			disallowCustomOptions.style.display = "block" ;
		}		
	}
	
	
	
	
	var cbSelected = 0 ;
	
	function CBSel( cntl )
	{
		
		if (cbSelected < 0)
		{
			cbSelected = 0;
		}
			
			
		// Determine if any CB is selected
		var qctrl = document.getElementById( cntl.id + "q" ) ;
		var qv = qctrl.value ;
		var vctrl = document.getElementById( cntl.id + "v" );
		var actrl = document.getElementById( cntl.id + "a" );
		var pctrl = document.getElementById( cntl.id + "p" );
		var tctrl = document.getElementById( cntl.id + "t" );

		if( cntl.checked )
		{
			cbSelected++ ;
			if( qv == "0" )
				qctrl.value = "1" ;
			// Change row color
			vctrl.className = "ps-row-selected";
			actrl.className = "ps-input-selected";
			pctrl.className = "ps-input-selected";
			tctrl.className = "ps-input-selected";
			//qctrl.style.backgroundColor = "#ffffff";
			//qctrl.style.borderColor = "#3767A9";
		}
		else
		{
			cbSelected-- ;
			qctrl.value = "0" ;
			// Change row color
			vctrl.className = "ps-row-unselected";
			actrl.className = "ps-input-unselected";
			pctrl.className = "ps-input-unselected";
			tctrl.className = "ps-input-unselected";
			//qctrl.style.backgroundColor = "";
			//qctrl.style.borderColor = "#CCCCCC";
		}
		
		LineTotalChange( cntl );
		
		
		if( cbSelected < 1)
			allowAddToCart( 0 );
		else
			allowAddToCart( 1 );
			
		
		var hasCustomAttributes = document.getElementById(hasCustomAttributesID);
		if (hasCustomAttributes.value == "true" && cbSelected > 0)
			AllowCustomOptions(1);
		else
			AllowCustomOptions(0);
			
	}
	
	function LineTotalChange( cntl )
	{
		var qctrl = document.getElementById( cntl.id + "q" ) ;
		var qv = qctrl.value ;
		var pctrl = document.getElementById( cntl.id + "p" ) ;
		var pv = pctrl.value ;
		var tctrl = document.getElementById( cntl.id + "t" ) ;
		tv = qv * pv;
		if( tv == 0 )
			tctrl.value = "";
		else
			tctrl.value = FormatNumber(tv,2);
		pageTotalChange();
	}
	
	function pageTotalChange()
	{
		var cntl ;
		var at = document.getElementById( "addTotal" );
		at.value = 0;
		for( var i = 0; i < CBList.length; i++ )	// Transfer quantites for selected skus
		{
			cntl = document.getElementById( CBList[i] ) ;
			if( cntl.checked )
			{
				tcntl = document.getElementById( CBList[i] + "t" ) ;
				// multiply by 1 to convert strings to numbers
				at.value = FormatNumber(( at.value * 1 ) + ( tcntl.value * 1 ),2);
			}
		}
		if( at.value == 0 )
			at.value = "";
	}

	function QNTChange( cntl )
	{

		var pattern = /^[0-9]*$/;
		if( pattern.test( cntl.value ) == false )
		{
			alert( "Only numbers allowed in quantity" ) ;
			cntl.value = "1" ;
		}

		var v = parseInt( cntl.value ) ;
		if( v > 10 )
		{
			cntl.value = "10" ;
			alert( "Quantity cannot exceed 10" ) ;
		}

		var bc = cntl.id ;
		var bctrl = document.getElementById( bc.substring( 0, bc.length - 1 ) ) ;
		if( v >= 1 )
		{
			CBJSSel( bctrl ) ;
			LineTotalChange( bctrl ) ;
		}
		else
		{
			CBJSDSel( bctrl ) ;
		}
	}
	
	function showHelp( helpID )
	{
		var help = document.getElementById( helpID );
		if ( help.style.display == "none" )
			help.style.display = "block";
		else
			help.style.display = "none";
	}


	function CanSubmit()
	{
		if (FinalUpdate() || inPreConfigMode)
		{
			return true;
		}
		
		return false;
	}


	function FinalUpdate()
	{
		var cntl ;
		var qcntl ;
		var hcntl ;
		var message ;
		var bSubmit = false ;
	
		for( var i = 0; i < CBList.length; i++ )	// Transfer quantites for selected skus
		{
			cntl = document.getElementById( CBList[i] ) ;
			if( cntl.checked )
			{
				bSubmit = true ;
			
				qcntl = document.getElementById( CBList[i] + "q" ) ;
				//acntl = document.getElementById( CBList[i] + "a" ) ;
				hcntl = document.getElementById( CBList[i] + "h" ) ; 
				
				cntl.value = cntl.value + ":" + qcntl.value + ":" + hcntl.value ;
			}
		}
		
		return bSubmit ;
	}
	
	
	// --------------------------
	// Custom Options Functions
	// --------------------------
	
	var attributeIDIndex = 0;
	var attributePriceIndex = 1;
	var variantPriceIndex = 1;
	var variantQuantityIndex = 3;
	var variantUOMIndex = 4;
	var customOptionPrice = 0;
	
	function GetCustomConfigPricing()
	{		
		// Identifiers used for getElementByID created from CustomOptions user control codebehind using ClientID
		var ddlLength = document.getElementById(ddlLengthID);
		var ddlLie = document.getElementById(ddlLieID);
		var ddlGrip = document.getElementById(ddlGripID);
		var ddlWrap = document.getElementById(ddlWrapID);
		var txtCustomOptionPrice = document.getElementById(custOptionPriceID);
		var txtTotal = document.getElementById(totalPriceID);
		
		
		var selectedLengthPrice = getAttributePrice(ddlLength, lengthInfo);
		var selectedLiePrice = getAttributePrice(ddlLie, lieInfo);
		var selectedGripPrice = getAttributePrice(ddlGrip, gripInfo);
		var selectedWrapPrice = getAttributePrice(ddlWrap, wrapInfo);
		
		
		customOptionPrice = getCustomOptionPrice(selectedLengthPrice, selectedLiePrice, selectedGripPrice, selectedWrapPrice, variantInfo);
		
		txtCustomOptionPrice.value = FormatNumber(customOptionPrice, 2);		
		txtTotal.value = FormatNumber(originalSubTotal + customOptionPrice, 2);
		
	}
	
	
	function getAttributePrice(attribute, array)
	{
		if (attribute != null && array != null)
		{
			var attributeID = attribute.value;
			var arrayLength = array.length;
			
			for (i = 0; i < arrayLength; i++)
			{
				var id = array[i][attributeIDIndex];
			
				if (id == attributeID)
				{
					return array[i][attributePriceIndex];
				}
			}
		}
		
		return 0; // return default price of 0
	}
	
	
	function getCustomOptionPrice(selectedLengthPrice, selectedLiePrice, selectedGripPrice, selectedWrapPrice, variantArray)
	{
		var arrayLength = variantArray.length;
		var totalCustomPrice = 0;
		
		for (i = 0; i < arrayLength; i++)
		{
			var currentVariantCustomPrice = 0;
			var currentVariantUOM = variantArray[i][variantUOMIndex];
			var currentVariantQuantity = variantArray[i][variantQuantityIndex];
			
			currentVariantCustomPrice += (selectedLengthPrice * currentVariantUOM) * currentVariantQuantity;
			
			currentVariantCustomPrice += (selectedLiePrice * currentVariantUOM) * currentVariantQuantity;
			
			currentVariantCustomPrice += (selectedGripPrice * currentVariantUOM) * currentVariantQuantity;
			
			currentVariantCustomPrice += (selectedWrapPrice * currentVariantUOM) * currentVariantQuantity;
			
			totalCustomPrice += currentVariantCustomPrice;
		}
		
		return totalCustomPrice;
	}
	
	// -------------------
	// BC - 1/2007
	// Pre-Config
	// -------------------
	
	var SKU_ID_Index = 0;
	var SKU_NameDescribedByAttributes_Index = 1;
	var SKU_Price_Index = 2;
	var SKU_Availability_Index = 3;
	var AvailabilityHyperLinkWithImage = "#AVAILABILITY_ID#";
	var inPreConfigMode = true;
	
	function SelectPreConfigurableSKU()
	{
		inPreConfigMode = true;
		
		var preConfigSKUDropDown = document.getElementById(ddlPreConfigSKUs);
		SetConfigMode(document.getElementById(rdoPreConfigSelectedID));
		
		if (preConfigSKUDropDown != null && preConfigSKUInfoArray != null)
		{
			var arrayLength = preConfigSKUInfoArray.length;
			var selectedSKU_ID = preConfigSKUDropDown.value;
			var selectedSKU_NameDescribedByAttributes;			
			var selectedSKU_Price;
			var selectedSKU_AvailabilityID;	
			var currentAvailabilityLinkWithImage;
			
			for (i = 0; i < arrayLength; i++)
			{
				var id = preConfigSKUInfoArray[i][SKU_ID_Index];
				
				if (id == selectedSKU_ID)
				{
					selectedSKU_NameDescribedByAttributes	= preConfigSKUInfoArray[i][SKU_NameDescribedByAttributes_Index];
					selectedSKU_Price						= preConfigSKUInfoArray[i][SKU_Price_Index];
					selectedSKU_AvailabilityID				= preConfigSKUInfoArray[i][SKU_Availability_Index];
					
					// Inject SKU's availability ID for proper image display of SKU availability
					currentAvailabilityLinkWithImage = AvailabilityHyperLinkWithImage.replace("#AVAILABILITY_ID#", selectedSKU_AvailabilityID);
					// replace 2nd instance - easier/faster than looking up how to write the proper regEX function
					currentAvailabilityLinkWithImage = currentAvailabilityLinkWithImage.replace("#AVAILABILITY_ID#", selectedSKU_AvailabilityID);
					break;
				}
			}
			
			var PreConfigSKUDescription = document.getElementById("preConfigSKU_Description");
			PreConfigSKUDescription.innerHTML = selectedSKU_NameDescribedByAttributes;
			
			var PreConfigSKUAvailability = document.getElementById("preConfigSKU_Availability");
			PreConfigSKUAvailability.innerHTML = currentAvailabilityLinkWithImage;
			
			var PreConfigSKUPrice = document.getElementById("preConfigSKU_Price");
			PreConfigSKUPrice.innerHTML = FormatNumber(selectedSKU_Price, 2);
			
			var PreConfigTotal = document.getElementById(preConfigTotalPriceID);
			PreConfigTotal.value = FormatNumber(selectedSKU_Price, 2);
			
			
		}
	}
	
	
	
	function SetConfigMode(radioClicked)
	{
		var preConfigAddEnabledDIV	= document.getElementById("preConfigAddEnabled");
		var preConfigAddDisabledDIV = document.getElementById("preConfigAddDisabled");
		var customAddEnabledDIV		= document.getElementById("addEnabled");
		var customAddDisabledDIV	= document.getElementById("addDisabled");
		var customOptionsEnabledDIV	= document.getElementById("customEnabled");
		var customOptionsDisabledDIV = document.getElementById("customDisabled");
		
		
		if (radioClicked.value == "preConfigSelected") // Pre-Config mode
		{
			inPreConfigMode = true;
			
			// Show Pre-Config elements
			preConfigAddEnabledDIV.style.display = "block";
			preConfigAddDisabledDIV.style.display = "none";
			var preConfigSKUDropDown = document.getElementById(ddlPreConfigSKUs);
			preConfigSKUDropDown.disabled = false;
			
			// Get current selected SKU price and set Pre-Config total with it
			var PreConfigSKUPrice = document.getElementById("preConfigSKU_Price");	
			
			var PreConfigTotal = document.getElementById(preConfigTotalPriceID);
			PreConfigTotal.value = PreConfigSKUPrice.innerHTML;
			
			// Disable customOptions and config addToCart buttons
			customAddEnabledDIV.style.display = "none";
			customAddDisabledDIV.style.display = "block";
			customOptionsEnabledDIV.style.display = "none";
			customOptionsDisabledDIV.style.display = "block";
			
			DisableControls(0);
			EnableFirstChooseYourOwnOption();
			
			ShowPreConfigMode();
			
		}
		else // 'Choose Your Own' mode
		{
			inPreConfigMode = false;
			EnableFirstChooseYourOwnOption();
			
			// Disable PreConfig AddToCart
			preConfigAddEnabledDIV.style.display = "none";
			preConfigAddDisabledDIV.style.display = "block";
			var preConfigSKUDropDown = document.getElementById(ddlPreConfigSKUs);
			preConfigSKUDropDown.disabled = true;
			
			// Zero out Pre-Config total price 
			var PreConfigTotal = document.getElementById(preConfigTotalPriceID);
			PreConfigTotal.value = "";
			
			ShowChooseYourOwnMode();
		}
	}
	
	
	function ShowPreConfigMode()
	{
		MM_changeProp('up','','style.opacity','1','DIV'); 
		MM_changeProp('up','','style.filter','alpha(opacity=100)','DIV');
		MM_changeProp('up','','style.MozOpacity','1','DIV');
		
		MM_changeProp('bottom','','style.opacity','.5','DIV'); 
		MM_changeProp('bottom','','style.filter','alpha(opacity=50)','DIV');
		MM_changeProp('bottom','','style.MozOpacity','.5','DIV');
	}
	
	function ShowChooseYourOwnMode()
	{
		MM_changeProp('up','','style.opacity','.5','DIV'); 
		MM_changeProp('up','','style.filter','alpha(opacity=50)','DIV');
		MM_changeProp('up','','style.MozOpacity','.5','DIV');
		
		MM_changeProp('bottom','','style.opacity','1','DIV'); 
		MM_changeProp('bottom','','style.filter','alpha(opacity=100)','DIV');
		MM_changeProp('bottom','','style.MozOpacity','1','DIV');
	}
	
	
	// The first drop down for the 'choose your own' config section was selected and changed.
	// We need to make the 'choose your own' section radio button selected and
	// do a SetConfigMode() so the rest of the UI properly indicates the mode.
	function SetConfigModeByChoosingASelection()
	{
		try
		{
			var radioButtonForChooseYourOwnSection = document.getElementById(rdoConfigureSelectedID);
			
			if (radioButtonForChooseYourOwnSection != null)
			{
				radioButtonForChooseYourOwnSection.checked = true;
				SetConfigMode(radioButtonForChooseYourOwnSection);
			}
		}
		catch(err)
		{
			// do nothing
		}
	}
	
	
	function EnableFirstChooseYourOwnOption()
	{
		var firstChooseYourOwnOption = document.getElementById(DriveOrder[0]);
		
		if (firstChooseYourOwnOption != null)
		{
			firstChooseYourOwnOption.disabled = false;
		}
	}
