/**
 * Class for creating plans section.
 * @class This is the Plans class.  
 *
 * @param {Array} conf
 *
 * @param {String} conf.id The id div of plans element
 * @param {Function} conf.callback The callback function on click event
 *
 */
esyndicat.plans = function(conf)
{
	var id = conf.id;
	var callback = (typeof conf.callback == 'function') ? conf.callback : function(){};
	var idPlan = (typeof conf.idPlan == 'undefined') ? false : conf.idPlan;

	this.init = function()
	{
		if(idPlan)
		{
			setPlan();
		}

		$("#" + id + "> p > input[@type=radio]").click(callback).each(function()
		{
			if($(this).attr('checked'))
			{
				$(this).click();
			}
		});
	};

	var setPlan = function()
	{
		$("#" + id + "> p > input[@type=radio]").each(function()
		{
			if($(this).val() == idPlan)
			{
				$(this).attr('checked', 'checked');
			}
		});
	};
}
