$(function() {
	// 連携キット、local時はexit
	if ($.LiVE.bdkit && location.protocol=="file:") return;
	
	var $navi = $.LiVE.Elements.WIDGETS.navi.find(".default_prev");
	$navi.each(function() {
		var $this = $(this),
			_id = $this.parent().attr("id"),
			_conf = $.LiVE.widget[_id];
		
		$this.find("a")
			.css({ width: $this.width(), height: $this.height() })
			.click(function(e) {
				$.LiVE.navi.prev();
			});
		
		var animEffect = _conf.data.effect || "0";
		if (animEffect == "2") {
			$this.naviStartAnimate();
		}
		
		function onNavigate(id) {
			// animate
			if (animEffect == "1") {
				if ($.LiVE.getPanelIndex(id) > 0) {	// 最初のスライドのみ
					$this.naviStopAnimate();
				} else {
					$this.naviStartAnimate();
				}
			}
			
			if ($.LiVE.mode.name=="edit") return;
			
			// disp
			var target = 0;
			if ($.LiVE.body.scroll=="vertical" && $.LiVE.Elements.SIDES.siteheader.length > 0
				&& $.LiVE.side['siteheader'].option.float == false) {
				target = -1;
			}
			if ($.LiVE.currentpanelorder <= target) {
				$this.stop().hide();
			} else {
				$this.stop().show();
			}
		}
		
		// 表示コールバック
		$.LiVE.navicontrol.callbacks.push(
			onNavigate
		);
		onNavigate(location.hash);
	});
});