$(function(){		
	// If IE6 then show message to upgrade
	if($.browser.msie && ($.browser.version <= 6)){
	 	$('div.loading_quote').before("<div class='loading_quote' id='ie6-'><table><tr><td><blockquote>Oops, we don't support Internet Explorer 6 and below! Please update your browser before viewing our site!</blockquote></td></tr></div>");
	 	$('div#ie6-').css({
			'z-index': 200, 
			'display': 'block', 
			'width': $(window).width(),
			'height': $(window).height()
		});
		Cufon.replace('div#ie6-');
	} else {
		$('div.loading_quote').show();
		// For each div with mask enabled
//		$('div.mask').each(function(){
//			var this_img = $(this).find('img');
//			$(this).prepend("<div class='mask_inner'></div>");
//			$('div.mask_inner', this).css({height: $('img', this).height()});
//		});		
//		$('div.mask img').each(function(){
//			$(this).bind('load readystatechange', function(){
//				$(this).closest('div.mask').find('div.mask_inner').fadeOut(1000);
//			}).bind('error', function(){
//				$(this).closest('div.mask').find('div.mask_inner').fadeOut(1000);
//			});
//			this.src = this.src; // <-----
//		});
	}
	
	// For sliding bars
	$('#toggle').click(function(){
		$('#sd_content').slideToggle(1000, function(){
			adjust_page();
		});
		return false;
	});
	
	// Adjust page
	adjust_page();
});
$(window).load(function(){
	$('div.loading_quote:not(#ie6-)').delay(3000).fadeOut(1000);
});
// If window is resized
var resizeTimer; // To prevent it firing too often
$(window).resize(function(){
    clearTimeout(resizeTimer);
    resizeTimer = setTimeout(adjust_page, 500);
});

// Adjust page
function adjust_page(){
	// Resize bars that extend the width to prevent overlap with scrollbar
	$('.full_width').width(document.getElementById ("content-wrapper").clientWidth);
}
