// JavaScript Document
$(document).ready(function(){
	$("div.glovalNavi ul li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function(){ $("ul", this).fadeOut("fast");  } 
	);

	$("a img").hover(function(){
		$(this).parent().addClass('imgHover');
		$(this).animate({opacity:0.6},100);
	},
	function(){
		if(!$(this).parent().attr("class").match(/onActive/)){
			$(this).animate({opacity:1.0},100,function(){$(this).parent().removeClass('imgHover');});
		}
	}
	);
});

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("gnavi_bt_"+activeCategory)){
				$(images[i]).parent().addClass('imgHover');
				$(images[i]).parent().addClass('onActive');
				$(images[i]).animate({opacity:0.6},100);
			}
		}
	}
}

function imgActiveChg_with_Page(activePage) {
	if(activePage == ""){return;}
	$("ul.catMenu li a").each(function(i, elem){
		//alert(GetBaseName($(this).attr("href")));
	   if(GetBaseName($(this).attr("href")).match(activePage+".html")){
		   $(this).addClass('onActive');
	   }else if(GetBaseName($(this).attr("href"))=='' && $(this).attr("href").match("/"+activePage+"/")){
		   $(this).addClass('onActive');
	   }
	})
}


function GetBaseName(str){
	if(str == ""){return;}
	var Parts = str.split('\\');
	if( Parts.length < 2 )
	Parts = str.split('/');
	return Parts[ Parts.length -1 ];
} 
