var CatalogToolBar = Class.create();
CatalogToolBar.prototype = {


// Reference to the tool bar's tabs.
tabs : null,

// Default value for the ZIP code field.
DEFAULT_ZIP_FIELD_VALUE : 'ZIP Code',

// Reference to the ZIP code field.
zipField : null,


// Initializer.
//
initialize : function() {

	// Initialize the Tire Selector forms.
	var elements = {
		vehicleForm           : 'catalogToolBar_findByVehicleForm',
		vehicleYearSelect     : 'catalogToolBar_vehicleYear',
		vehicleMakeSelect     : 'catalogToolBar_vehicleMake',
		vehicleModelSelect    : 'catalogToolBar_vehicleModel',
		vehicleOptionSelect   : 'catalogToolBar_vehicleOption',
		vehicleSubmit         : 'catalogToolBar_vehicleSubmit',
		sizeForm              : 'catalogToolBar_findBySizeForm',
		sizeWidthSelect       : 'catalogToolBar_sizeWidth',
		sizeRatioSelect       : 'catalogToolBar_sizeRatio',
		sizeDiameterSelect    : 'catalogToolBar_sizeDiameter',
		sizeSubmit            : 'catalogToolBar_sizeSubmit',
		tireNameSelect        : 'catalogToolBar_tireName',
		tireNameSubmit        : 'catalogToolBar_tireNameSubmit'
	};
	new TireSelectorEntryForm( elements );

	// Initialize the tabs.
	this.tabs = new Tabs( 'catalogToolBar_tabContainer' );
	this.tabs.selectTab( 0 );


	// Initialize the Retailer Locator form.
	document.catalogToolBar_rlForm.reset();
	
	this.zipField =  $( 'catalogToolBar_rlZipField' );
	Event.observe( this.zipField, 'focus', this.onRetailerLocatorFocus.bind( this ), false );
	Event.observe( this.zipField, 'blur', this.onRetailerLocatorBlur.bind( this ), false );

}, // End initialize().

onRetailerLocatorFocus : function() {

	if ( this.zipField.value == this.DEFAULT_ZIP_FIELD_VALUE ) {
		this.zipField.value = '';
	} // End if.

}, // End onRetailerLocatorFocus().

onRetailerLocatorBlur : function() {

	if ( this.zipField.value == '' ) {
		this.zipField.value = this.DEFAULT_ZIP_FIELD_VALUE;
	} // End if.

} // End onRetailerLocatorBlur().


} // End class CatalogToolBar.

new CatalogToolBar();
