// border for block (main page)
(function($) {
	$.fn.blact=function(options) {
		var set=$.extend({nClass:"on"},options);
		return this.each(function() {
			$(this).hover(function() { $(this).addClass(set.nClass); },function() { $(this).removeClass(set.nClass); })
		});
	};
})(jQuery);

// ver. menu
(function($) {
	$.fn.vm=function(options) {
		options=jQuery.extend({speedIn:500,speedOut:200},options);
		var $obj=$(this).find("ul"); var flag="none";
		return this.each(function() {
			var x=0;
			$obj.each(function() {
				if ($(this).attr("class")) {
					n=$(this).attr("class");
					$(this).after('<img src="i/vmenu/'+n+'.png" width="290" height="8" class="bl">');
					$(this).find("> li > a").bind("click",function() {
						if ($(this).next().is("ul")) {
							if ($(this).next()!=flag&&flag!="none") {
								$(flag).slideUp(options.speedIn); $(this).next().slideDown(options.speedIn);
								flag=$(this).next();
							} else if ($(this).next()==flag&&flag!="none"&&!$(this).attr("status")) {
								$(flag).slideUp(options.speedOut); flag="none";
							} else if (flag=="none") {
								$(this).next().slideDown(options.speedIn); flag=$(this).next();
							}
						}
					});
					if ($(this).find("> li").attr("status")) {
						$(this).find("> li > ul").show(); flag=$(this).find("> li > ul");
					}
				}
			});
		});
	};
})(jQuery);

(function($) {
	$.fn.video=function() {
		var $obj=$(this); var $oScr=$obj.find("#video-block");
		var $btnL=$obj.find(".scrollingHotSpotLeft"); var $btnR=$obj.find(".scrollingHotSpotRight");
		return this.each(function() {
			var posX=0; var sWidth=($oScr.width()-$obj.width())*-1; var step=$oScr.find("td").innerWidth();
			$btnL.bind("click",function() {
				if (posX<step) {
					posX=posX+step;
					$oScr.animate({left:posX},500,function() { (posX>=step)?$btnL.removeClass("bon"):null; });
				} else { posX=step; $btnL.removeClass("bon"); }
			});
			$btnL.bind("mouseenter mouseleave",function() { (posX<step)?$(this).toggleClass("bon"):null; });
			$btnR.bind("click",function() {
				if (posX>(sWidth+16-step)) {
					posX=posX-step;
					$oScr.animate({left:posX},500,function() { (posX<=(sWidth+16-step))?$btnR.removeClass("bon"):null; }); }
				else { posX=sWidth+16-step; $btnR.removeClass("bon"); }
			});
			$btnR.bind("mouseenter mouseleave",function() { (posX>(sWidth+16-step))?$(this).toggleClass("bon"):null; });
		});
	};
})(jQuery);

$j(function($) {
	Cufon.replace(".title");
	$(".left-block").blact({nClass:"l-on"});
	$(".center-block").blact({nClass:"c-on"});
	$(".right-block").blact({nClass:"r-on"});
	$(".scroll").is("div")?$(".scroll").jScrollPane({showArrows:true,scrollbarWidth:15}):null;
	$("#vmenu").vm();
	Cufon.replace("h1,h2,h3,h4");
	$("#video-scroll").video();
});