function setClassBtn() {
	$("ul#subNav li a img").each(function() {
		$(this).addClass("btn");
	});
}

function initRollOverImages() {
	var image_cache = new Object();
	$("a img.btn,input[type=image].btn").not("[@src*='_o.'],[@src*='_d.']").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_o' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; }
		);
	});
}

function pageScroll() {
	$('a[href*=#]').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}, 500);
				return false;
			}
		}
	});
}


$(document).ready(function(){
    setClassBtn();
    initRollOverImages();
    pageScroll();
});


