function SmoothScroll() {
	$('.scroll').click(function() {
	  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	  && location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target
		|| $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
		  var targetOffset = $target.offset().top;
		  $('html,body')
		  .animate({scrollTop: targetOffset}, 1000);
		 return false;
		}
	  }
	});
}

//Main nav drop down
function DropDownMenu () {
	
	var display_timeout = 0;
	$("li.has-subnav").hover(function () {
		$("li.has-subnav").removeClass('subnav-active');							   
		if(display_timeout != 0) { clearTimeout(display_timeout); }
		var this_element = this;
		$(this_element).addClass('subnav-active');
	},
	function () {
		if(display_timeout != 0) { clearTimeout(display_timeout); }
		var this_element = this;
		display_timeout = setTimeout(function() {
			display_timeout = 0;
			$(this_element).removeClass('subnav-active');
		}, 500); }
	);	
}

$(document).ready(function(){
	
	$(document).pngFix();
	Shadowbox.init();
	SmoothScroll();
	DropDownMenu();
	
    $("a[rel*='external']").attr({ target: "_blank" });

	var volatile = $(".field input")
	volatile.focus(function(event){
        if ($(this).val() == $(this).attr("title") ){        
            $(this).val("");
        }}, volatile.blur(function(event){
            if ($(this).val() == "" ){        
                $(this).val($(this).attr("title"));
            }
        }
    ));
	
	// Now get the font changed: http://cufon.shoqolate.com/generate/
	Cufon.replace('h1, #homeContent h2, .sideCol h2, #nav .top', { fontFamily: 'BankGothic', hover: true });


	$('#bannerSlider').codaSlider({
		autoSlide: true,
		autoSlideInterval: 5000,
		dynamicArrows: false,
		dynamicTabs: false
	});
	
	










});

