jQuery.noConflict();

jQuery(function() {

	// Write screen resolution to cookies
	jQuery.cookie('screen_x',screen.width,{path:'/',expires:'-1'});
	jQuery.cookie('screen_y',screen.height,{path:'/',expires:'-1'});
	
	// Supersize images
	jQuery.fn.supersized.options = {  
		startwidth: size_x,  
		startheight: size_y,
		slideshow: 0,
		width_reduction: 230
	};
	jQuery('#supersize').supersized();
	jQuery('#supersize .activeslide').fadeIn();
	
	// Initial state
	jQuery('#toggle_element:hidden').parent().hide();
	
	// Open subnavigation
	jQuery('#header>ul.nav ul.current>li.current').parent().show();
	jQuery('#header>ul.nav ul.current>li.probono_current').parent().show();
	jQuery('#header>ul.nav ul.current:hidden').slideDown();
	/*jQuery('#header>ul>li>a').click(
		function() {
			if (jQuery(this).parent().children('ul').length > 0) {
				jQuery('#header>ul>li>ul:visible').slideUp();
				jQuery(this).parent().children('ul:hidden').slideDown();
				return false;
			}
		}
	);*/
	
	// Toggle element
	jQuery('.toggle_link').click(
		function() {
			if (jQuery('#toggle_element').css('display') == 'none') {
				// Slide other content aside if necessary
				jQuery('#toggle_element:hidden').parent().parent().children('.slideable').animate({
					marginLeft: "280px"
				},1000);
				// Fade in element
				jQuery('#toggle_element:hidden').parent().fadeIn('1000');
				jQuery('#toggle_element:hidden').fadeIn('1000');
			}
			else {
				// Fade out element
				jQuery('#toggle_element:visible').fadeOut('1000');
				jQuery('#toggle_element:visible').parent().fadeOut('1000');
				// Slide other content aside if necessary
				jQuery('#toggle_element:visible').parent().parent().children('.slideable').animate({
					marginLeft: "0"
				},1000);
			}
			return false;
		}
	);
	jQuery('#toggle_close').click(
		function() {
			// Fade out element
			jQuery('#toggle_element').fadeOut('1000');
			jQuery('#toggle_element').parent().fadeOut('1000');
			// Slide other content aside if necessary
			jQuery('#toggle_element:visible').parent().parent().children('.slideable').animate({
				marginLeft: "0"
			},1000);
		}
	);
	
	// Preload images (must come after all other jQuery functionality)
	jQuery.preloadCssImages();
	
});
