/**
 * DrPepper.PromoBox
 *	
 * Multi-row box with expand/collapse button, for modules/items.
 *
 * Author:	Silvan Reinhold
 * Date:	2009-02-12
 * See:		PromoBox.php
 **/

var DrPepper = DrPepper || {};


/**
 * Constructor
 *
 * @param	domElement		DOM element representing this PromoBox in the document (may also be an ID)
 **/ 
DrPepper.PromoBox = function(p_xDomElement)
{
	this._xDomElement = $(p_xDomElement);
	this.setupBehavior();
}


/**
 * Instance attributes
 */
DrPepper.PromoBox.prototype = {
	_xDomElement		:	null	// DOM element representing this PromoBox
}


/**
 * Initializes the dynamic behavior of this PromoBox.
 */
DrPepper.PromoBox.prototype.setupBehavior = function()
{
	// Set up click behavior for all items
	//
	$(".item", this._xDomElement).click(function() {
		// Fetch item metadata
		var l_xMetaData = $(".meta-data", this);
		var l_sActionUrl = $(".action-url", l_xMetaData).text();
		var l_nLinkType = parseInt($(".link-type", l_xMetaData).text());

		DrPepper.Site.performLinkAction({ linkType: l_nLinkType, url: l_sActionUrl });
	});
}