jQuery(document).ready(function()
{
	AK.magicExpand();
});

var AK = {

	magicExpand : function () 
	{
		var i = 0;
		jQuery("div.magic-expand").each(function() 
		{
			jQuery(this).html(
				'<div class="magic-expand-container">' +
				'<a id="magic-expand-a-' + i + '" href="#" ' +
				'  onclick="return AK.magicExpandToggle(\'#magic-expand-' + i + '\', 200);">' +
				'+</a></div>' +
				'<div class="clear"></div>' + 
				'<div class="magic-expand-text" id="magic-expand-' + i + '">' +
				jQuery(this).html() + '</div>');
			jQuery(this).after('<div class="clear"></div>');

			i++;
		});

/*		
		if (0 && jQuery.browser.msie  && parseInt(jQuery.browser.version) <= 7) 
		{
			jQuery(".magic-expand-text").each(function()
			{
//				alert(jQuery(this).attr("id"));
				AK.magicExpandToggle("#" + jQuery(this).attr("id"), 100);
				AK.magicExpandToggle("#" + jQuery(this).attr("id"), 100);
			});
		}
		*/
	},
	
	magicExpandToggle : function(es, rate, plus, minus)
	{
		if (!plus || plus.length == 0)
		{
			plus = "+";
			minus = "-";
		}
		
//	jQuery(\'#magic-expand-' + i + '\').toggle(200); jQuery(\'#magic-expand-a-' + i + '\').html((jQuery(\'#magic-expand-a-' + i + '\').html() == \'+\')? \'-\':\'+\'); return false;
		var esa = es.replace("expand-", "expand-a-");
		jQuery(es).toggle(rate);
		jQuery(esa).html((jQuery(esa).html() == plus)? minus:plus);
		return false;
	}
	
}

