/**
 * Last Edit
 * By	:	Jason
 * When	:	23 May 08
 * What	:	Initial setup
 */
$(document).ready(function(){
	$("ul.nav").superfish();
	
	function h1stringlength() {
		var stringlength = $("#content h1").html().length;
		if(stringlength >= 28) {
			$("#content h1").addClass('wrapping');
		};
	}
	
	h1stringlength();
	
	if (jQuery.browser.version !== '6.0') {
		$(window).resize(function(){
			if ((window.innerWidth >= 1584) || (document.documentElement.clientWidth >= 1584)) {
				$("body").addClass('large');
			}
			else {
				$("body").removeClass('large');
			}
		}).resize();
		
		$(window).resize(function(){
			if ((window.innerWidth <= 1100) || (document.documentElement.clientWidth <= 1100)) {
				$("body").addClass('small');
			}
			else {
				$("body").removeClass('small');
			}
		}).resize();
	}
	
	Cufon.replace('.nav>li>a, #footer p', {
		color: '-linear-gradient(#fff, #c9c9c9)',
		fontFamily: 'Futura Lt BT'
	});
	
	/*
	 * Submenu font sizes are too small to justify Cufon
	 * 
	 *  Cufon.replace('.nav>li>ul>li:not(.current_page_item)>a', {
		color: '-linear-gradient(#fff, #c9c9c9)',
		hover: {
			color: '#000'
		},
		fontFamily: 'Futura Lt BT'
	}); */

	
	Cufon.replace('.nav>li.current_page_item>a, .nav>li.current_page_ancestor>a, #content h1, th, strong, legend, label', {
		color: '-linear-gradient(#fff, #c9c9c9)',
		fontFamily: 'Futura Hv BT'
	});
	
	Cufon.replace('.nav>li.current_page_ancestor>ul>li.current_page_item>a', {
		color: '-linear-gradient(#fff, #c9c9c9)',
		fontFamily: 'Futura Hv BT',
		color:'#000'
	});
	
	Cufon.replace('#content h1', {
		color: '-linear-gradient(#fff, #d4d4d4)',
		fontFamily: 'Futura Hv BT',
		textShadow: '#333 2px 2px'
	});
	
	Cufon.replace('#content h2, #content h3, #content h4', {
		color: '-linear-gradient(#fff, #d4d4d4)',
		fontFamily: 'Futura Hv BT'
});
	
	$('.nav li a').hover(
		function(){},
		function() {
			Cufon.refresh('.nav>li>ul>li:not(.current_page_item)>a');
		}
	)
	
});
/*
// cusomisation options listed here, if you need them
$(document).ready(function(){
	$("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(){}
	});
});
*/

