$(document).ready(function(){
	initFadeImg();
	initSideNavi();
	initCatalogDLBt();
});


function initFadeImg() {
	$(".fade").load(function(){
		$(this).fadeTo(300, 1.0);
	});
	$(".fade").hover(
		function(){
			$(this).stop();
			$(this).fadeTo(300, 0.5);
		},
		function(){
			$(this).stop();
			$(this).fadeTo(500, 1.0);
		}
	);
	$(".fadeImg").hover(
		function(){
			//$(".fadeImg img").fadeTo(300, 0.5);
			$(this).children("img").stop();
			$(this).children("img").fadeTo(300, 0.5);
		},
		function(){
			$(this).children("img").stop();
			$(this).children("img").fadeTo(500, 1.0);
		}
	);
}



/*=============================================================
	Side Navi
=============================================================*/

function initSideNavi() {
	//Open&Close speed
	ocSpeed = 300;
	
	$(".sideOCBox").css({"display":"none"});
	
	
	$(".ocBt").click(function(){
		ocBt_act($(this), $(this));
		return false;
	});
	$(".ocBt_txt").click(function(){
		var myToggleBt = $(this).prev();
		ocBt_act($(this), myToggleBt);
		return false;
	});	
}

function ocBt_act(target, myToggleBt) {
	if(target.attr("rel")) { 
		var target = $("ul#"+target.attr("rel"));
	
		if(myToggleBt.hasClass("ocBt_close")) {
			target.slideUp(ocSpeed);
		}else{
			target.slideDown(ocSpeed);
		}
		myToggleBt.toggleClass("ocBt_close");
	}
}

// open & close
function sideNavi_ctrl(target, cnd) {
	if(cnd == "open") {
		$("#"+target).css({"display":"block"});
		$("a[rel="+target+"]").addClass("ocBt_close");
	} else {
		$("#"+target).css({"display":"none"});
		$("a[rel="+target+"]").removeClass("ocBt_close");
	}
}



/*=============================================================
	Catalog download button container
=============================================================*/
function initCatalogDLBt() {
	$(".catalogDLBox a").click(function(){
		if($(this).attr("rel")) { 
			var cat_id = $(this).attr("rel").split(",");
			showCatalog(cat_id[0], cat_id[1]);
			return false;
		}
	});
}


























