$(document).ready(function(){
	var onimg;
	var offimg;
	
	$('a[href*=#]').click(function() {  
		var target = $(this.hash);  
		target = target.length && target;  
		if (target.length) {  
			var sclpos = 30;  
			var scldurat = 1200;  
			var targetOffset = target.offset().top - sclpos;  
			$('html,body')  
				.animate({scrollTop: targetOffset},'slow');  
			return false;  
		}  
	});
	$('area[href*=#]').click(function() {  
		var target = $(this.hash);  
		target = target.length && target;  
		if (target.length) {  
			var sclpos = 30;  
			var scldurat = 1200;  
			var targetOffset = target.offset().top - sclpos;  
			$('html,body')  
				.animate({scrollTop: targetOffset},'slow');  
			return false;  
		}  
	});
	
	function imgRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("__roll."))
			{
				images[i].onmouseover = function() {
					if(this.getAttribute("className")!="noroll" && this.getAttribute("class")!="noroll"){
						this.setAttribute("src", this.getAttribute("src").replace("__roll.", "__rollon."));
					}
				}
				images[i].onmouseout = function() {
					if(this.getAttribute("className")!="onactive" && this.getAttribute("class")!="onactive"){
						this.setAttribute("src", this.getAttribute("src").replace("__rollon.", "__roll."));
					}
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", imgRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", imgRollover);
}
$(document).ready(function(){
	$("a img").hover(function(){
		if(!$(this).attr('src').match("__roll.")){
			$(this).parent().addClass('a_hover');
			$(this).animate({opacity:0.7},100);
		}
	},
	function(){
		$(this).animate({opacity:1.0},100,function(){$(this).parent().removeClass('a_hover');});
	}
	);
});

function imgActiveChg_with_Category(activeCategory) {
	if(activeCategory == ""){return;}
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match(activeCategory+"__roll."))
			{	
				images[i].setAttribute("src", images[i].getAttribute("src").replace("__roll.", "__rollon."));
				images[i].setAttribute("class", "onactive");
			}
		}
	}
}
	
	$('ul.navigation li a img').each(function(){
		$(this).hover(function(){
			var btID = $(this).attr('id').replace('bt_','');
			$('div#overLay img').attr('src','images/top/bton_overlay_'+btID+'.jpg');
			$('div#overLay').slideDown();
		},
		function(){
			$('div#overLay').hide();
		});
	 });
	
	
});


