jQuery(document).ready(function(){
	//jQuery("ul.nav").superfish({
	//	animation	: {height:'show', width:'show'}
		//animation	: {width:'show'}
	//});
	jQuery('ul.nav li ul').hide();
	jQuery('ul.nav li.current_page_ancestor').addClass('isOpenParent').children('ul').addClass('isOpen').show();
	jQuery('ul.nav li a').click(function () {
		if (jQuery(this).parent().children('ul').length) {
			if (!jQuery(this).parent().hasClass('isOpenParent')) {
				jQuery(this).parent().parent().children('li').removeClass('isOpenParent');
				jQuery(this).parent().parent().children('li').children('ul.isOpen').slideUp().removeClass('isOpen');
				jQuery(this).parent().addClass('isOpenParent').children('ul').addClass('isOpen').slideDown();
			}
			return false;
		} else {
			return true;	
		}
	});
	// detect screen resolution. If 1024 wide then shave 100 px off the left nav
	var screenwidth = jQuery("html").width();
	/*if(screenwidth < '1024'){
		jQuery('div#menu').css("width","198px");
		jQuery('div#content').css("margin-left","198px");
	}*/
	
	jQuery(window).bind('resize', function() {
										   	
		if(jQuery('#menu').css('position') == 'fixed') {
			var content_offset =jQuery('#content_limiter').offset();
			
			jQuery('#menu').css('left',content_offset.left);
			jQuery('#sidebar').css('right',content_offset.left);
		}
	}).resize();	
		
});


/*
// cusomisation options listed here, if you need them
jQuery(document).ready(function(){
	jQuery("ul.nav").superfish({
		hoverClass	: "sfHover",
		pathClass	: "overideThisToUse",
		delay		: 800,
		animation	: {opacity:"show"},
		speed		: "normal",
		oldJquery	: false, // set to true if using jQuery version below 1.2 
		disableHI	: false, // set to true to disable hoverIntent detection 
		onInit		: function(){},
		onBeforeShow	: function(){},
		onShow		: function(){},
		onHide		: function(){}
	});
});
*/
