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');
	});

	
// 
$(".clickable").each(function()
	{
	$(this)
	.bind("click",function()
		{
		// Find the current "toggle" div under the clicked element
		currentElement = $(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') != currentElement.attr('id') )
				{
				$(this)
				.removeClass('hidden')
				.slideUp('slow')
				.parent()
				.removeClass('ieShowBlock');
				}
			else
				{
				// Toggle the currently clicked "toggle"
				currentElement
				.slideToggle('slow')
				.parent()
				.removeClass('ieShowBlock');
				}
			});
		});
	});