QUANTUM=(typeof QUANTUM=='undefined'?{}:QUANTUM);
QUANTUM.classes=(typeof QUANTUM.classes=='undefined'?{}:QUANTUM.classes);
QUANTUM.classes.brochure = function()
{
	var brochure, content;
	if(!(brochure = $('#brochure'))) return;
	if(!(content = $('#content'))) return;

	if((intro = $('#content div.intro'))) $('#main-content').append(intro);

	var inner = $('<div id="inner-content"></div>');
	var pageBody = $('#page-body');
	var h1 = $('h1');
	
	pageBody.append(inner);
	$(inner).append(content, brochure);
	
	$('#title').css({'overflow': 'hidden'});
	$(brochure).toggle();
	$(brochure).addClass('js');
	$(pageBody).css({'overflow': 'hidden'});
	var margin = 20;
	var width = $(pageBody).width()
	$(inner).width(width * 2 + margin);
	$(content).width(width);
	$(brochure).width(width);
	$(inner).css({'position': 'relative', 'left': '0px'});
	$(h1).css({'position': 'relative', 'left': '0px'});
	$(content).css({'float': 'left', 'margin-right': margin + 'px'});
	$(brochure).css({'float': 'right'});

	$('#toggle-brochure').bind('click', function(e)
	{
		var duration = 500;
		if($(inner).css('left') == '0px')
		{
			$(brochure).toggle();
			$(inner).animate({left: '-438px'}, {duration: 500, queue: false, complete: function(){ $(content).toggle(); }});
			$(h1).animate({left: '-438px'}, {duration: 500, queue: false});
			$('#toggle-brochure a').toggle();
		}
		else if($(inner).css('left') == '-438px')
		{
			$(content).toggle();
			$(inner).animate({left: '0px'}, {duration: 500, queue: false, complete: function(){ $(brochure).toggle(); }});
			$(h1).animate({left: '0px'}, {duration: 500, queue: false});
			$('#toggle-brochure a').toggle();
		}
		return false;
	});
}
$(document).ready(function(){new QUANTUM.classes.brochure();});
