var PromoBar = {

	toggleBtnClass: 'toggleBtn',
	expandedClass: 'expanded',
	expandableBodyClass: 'expandableBody',
	clickable: 'promoBar',
	
	init: function() {
		// set defaults
		this.setDefaults();
	
		// add events
		//this.addEvents();
		
		// if on the homepage
		/*if($(document.body).hasClass('dc_frontpage')) {
			var hdr = $('#headerWrapper').addClass('pinned');
		}*/
	},
	
	setDefaults: function() {
		var widget = $('#promoWrap');
	
		this.toggleBtn = widget.find('.' + this.clickable);
		this.expandableItems = widget.find('.' + this.expandableBodyClass);
		this.contractBtnText = this.toggleBtn.find('.' + this.toggleBtnClass).data('contracted-text');
		this.expandBtnText = this.toggleBtn.find('.' + this.toggleBtnClass).data('expanded-text');
	
		this.expandableItems.css('opacity', 0.7);
	},
	
	addEvents: function() {
		/*
		this.toggleBtn.click(function() {
			var toggleBtn = $(this);
	
			if (toggleBtn.hasClass(PromoBar.expandedClass)) {
				PromoBar.contract();
			}
			else {
				PromoBar.expand();
			}
			
			Cufon.refresh('.helvetica');
		
			return false;
		});
		*/
	},

	expand: function() {
		if (this.expandableItems) {
			this.expandableItems.slideDown(400, function() {
				$(window).trigger('resize');
			});
		}
		if (this.toggleBtn) {
			this.toggleBtn
				.addClass(this.expandedClass)
				.find('.helvetica');
				
			$('.' + this.toggleBtnClass).html('<span class="helvetica">' + this.contractBtnText + '</span>');
		}
		

	},

	contract: function() {
		if (this.expandableItems) {
			this.expandableItems.slideUp(400, function() {
				$(window).trigger('resize');
			});
		}
		
		if (this.toggleBtn) {
			this.toggleBtn
				.removeClass(this.expandedClass)
				.find('.helvetica');
			$('.' + this.toggleBtnClass).html('<span class="helvetica">' + this.expandBtnText + '</span>');
		}
	}
};
