$(document).ready(function(){

	// main navigation/dropdowns
    $('#nav').superfish({
        hoverClass: 'sfHover',          				// the class applied to hovered list items 
        delay: 500,                						// the delay in milliseconds that the mouse can remain outside a submenu without it closing 
        animation: { opacity: 'show', height: 'show' },  	// fade-in and slide-down animation 
        speed: 'fast',           						// speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
        autoArrows: true               					// if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
    }).find('ul').bgIframe({ opacity: false }); 		// bgIframe plugin to fix IE6 bug overlapping <select> elements
	
	// focus/blur search form field
	$("#search input").focus(
		function() {
			if(this.value == this.defaultValue) {
			this.value = "";
			}
		}
	).blur(
		function() {
			if(!this.value.length) {
			this.value = this.defaultValue;
			}
		}
	);

	// image search button hover
	$('input.searchbttn').hover(function() {
			$(this).css('background-position','0 -33px');
		},
		function() {
			$(this).css('background-position','0 0');
		}
	);
	
	// image button hover
	$('input.bttn').hover(function() {
			$(this).css('background-position','0 -35px');
		},
		function() {
			$(this).css('background-position','0 0');
		}
	);
	
	$('.printpage').append('<a href="#print">Printable Version</a>');
	$('.printpage a').click(function() {
		window.print();
		return false;
	});
	
	// Load Cufon fonts when @FontFace is not available
	isFontFaceSupported.ready(function(bool){
		if (!bool)
		// console.log("no fontface");
		$.getScript('/js/cufon-yui.js', function(){
        $.getScript('/js/Avenir85Heavy.font.js', function() {
				Cufon.replace('.subcat');
				Cufon.replace('h2.avenir');
		        Cufon.now();
	    	});
		});
	});
	
});
