/*
--------------------------------------------------------------------------------
 JavaScript: Dynamic Event Landing Page.
--------------------------------------------------------------------------------
*/

var PromotionPage = Class.create();

PromotionPage.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,
	
	// Reference to the disclaimers.
	disclaimers : null,
	
	// Reference to the disclaimers link.
	disclaimersLink : null,
	
	// Reference to the details pane.
	details : null,
	
	// Reference to the details link.
	detailsLink : null,
	
	// Initializer.
	//
	initialize : function() {
		
		this.details = $( 'my_details' );
		this.detailsLink = $( 'my_detailsLink' );
		this.toggleDetails(); // Start with the details collapsed.
		Event.observe( this.detailsLink, 'click', this.toggleDetails.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().
	
	toggleDisclaimers : function() {
	
		if ( this.disclaimers.className == 'my_disclaimersOff' ) {
			this.disclaimers.className = 'my_disclaimersOn';
		} else {
			this.disclaimers.className = 'my_disclaimersOff';
		} // End if.
	
	}, // End toggleDisclaimers().
	
	toggleDetails : function() {
		
		if ( this.details.className == 'my_detailsOff' ) {
			this.details.className = 'my_detailsOn';
		} else {
			this.details.className = 'my_detailsOff';
		} // End if.
	
	} // End toggleDetails().

} // End class PromotionPage.
