var currentElement = null;

if( window.location.href.indexOf('content-browser') == -1)
	{
	// initialize all "toggle" divs
	$('div[rel=toggle]')
	.css({display: 'none', float: 'left'})
	.removeClass('hidden');
	}
else
	$('div[rel=toggle]').css({float: 'left', position: 'relative'});

//	Apply Initial State
$('div[rel=toggle]').each(function()
	{
	if ( $(this).hasClass('visible') )
		{
		currentElement = $(this);
		}
		
	if ( currentElement != null && $(this).attr('id') == currentElement.attr('id') )
		$(this).slideDown('slow');

	$(this)
		.removeClass('hidden')
		.removeClass('visible')
		.parent().removeClass('ieShowBlock');
	});

//	Toggle Clicks
$(".clickable").each(function()
	{
	var  elementIndex = null;
	$(this)
	.bind("click",function()
		{
		// Find the current "toggle" div under the clicked element
		elementIndex = $(this).parent().find('div[rel=toggle]');	
		
		// Now Loop through all "toggle" divs and close all except the current
		$('div[rel=toggle]').each(function()
			{
			if( $(this).attr('id') != elementIndex.attr('id') )
				$(this).removeClass('hidden').slideUp('slow');
			else
				elementIndex.slideToggle('slow');
			});
		});
	});

