/**
 * DrPepper.PromoBoxList
 *
 * List representation of PromoBox; used on the site map
 *
 * Author:	Silvan Reinhold
 * Date:	2009-03-03
 * See:		PromoBox.php
 **/

var DrPepper = DrPepper || {};


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


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


/**
 * Initializes the dynamic behavior of this PromoBox. This includes buttons and animations.
 */
DrPepper.PromoBoxList.prototype.setupBehavior = function()
{
	/* Link hover behavior for IE6 */
	$("a", this._xDomElement).hover(
		function() { $(this).addClass("hover"); },
		function() { $(this).removeClass("hover"); }
	);
	
	/* Set up click behavior */
	$(".item", this._xDomElement).each(function() {
		var l_xMetaData = $(".meta-data", this);
		var l_nLinkType = parseInt($(".link-type", l_xMetaData).text());		
		var l_sActionUrl = $(".action-url", l_xMetaData).text();

		$(this).click(function() { DrPepper.Site.performLinkAction({ linkType: l_nLinkType, url: l_sActionUrl }); });
	});
}
