//jQuery plugin

$(function(){
	//inputタグアクティブ時のクラス追加・削除
	$("input:text").focus(function(){$(this).addClass("input_active")});
	$("input:text").blur(function(){$(this).removeClass("input_active")});
	//input:imageのcss
	$("input:image").css("border","none");
	$("input:text").css({"backgroundColor":"#ffffff","verticalAlign":"middle"});
	$("input:radio").css({"border":"10px","verticalAlign":"middle"});
});


//gnavi
$(function(){
	if(document.body.id=="cate_def"){
		$("img#gnavi_tab_blog").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_blog_on.gif");	},
			function(){$(this).attr("src","common/images/gnavi_tab_blog.gif");}
		);
		$("img#gnavi_tab_shohin").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_shohin_on.gif");},
			function(){$(this).attr("src","common/images/gnavi_tab_shohin.gif");}
		);
		$("img#gnavi_tab_config").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_config_on.gif");},
			function(){$(this).attr("src","common/images/gnavi_tab_config.gif");}
		);
	}else{
		$("img#gnavi_tab_blog").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_blog_on.gif");	},
			function(){
				if(document.body.id=="cate_blog"){
					$(this).attr("src","common/images/gnavi_tab_blog_on.gif");
				}else{
					$(this).attr("src","common/images/gnavi_tab_blog.gif");
				}
			}
		);
		$("img#gnavi_tab_shohin").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_shohin_on.gif");},
			function(){
				if(document.body.id=="cate_shohin"){
					$(this).attr("src","common/images/gnavi_tab_shohin_on.gif");
				}else{
					$(this).attr("src","common/images/gnavi_tab_shohin.gif");
				}
			}
		);
		$("img#gnavi_tab_config").hover(
			function(){$(this).attr("src","common/images/gnavi_tab_config_on.gif");},
			function(){
				if(document.body.id=="cate_config"){
					$(this).attr("src","common/images/gnavi_tab_config_on.gif");
				}else{
					$(this).attr("src","common/images/gnavi_tab_config.gif");
				}
			}
		);
	}
});


//toggle
$(function(){
	$("#switch_toggle_show_sellsinfo").focus(function(){
		if($(".cont_toggle").css("display")=="none"){
			$(".cont_toggle").slideDown("normal");
		}
	});
	$("#switch_toggle_hide_sellsinfo").focus(function(){
		if($(".cont_toggle").css("display")=="block"){
			$(".cont_toggle").slideUp("normal");
		}
	});
	$("#switch_toggle_show_toroku").focus(function(){
		if($(".cont_toggle_toroku").css("display")=="none"){
			$(".cont_toggle_toroku").slideDown("normal");
		}
	});
	$("#switch_toggle_hide_toroku").focus(function(){
		if($(".cont_toggle_toroku").css("display")=="block"){
			$(".cont_toggle_toroku").slideUp("normal");
		}
	});

	//カレンダー
	$("#switch_toggle_show_calendar").focus(function(){
		if($(".cont_toggle_calendar").css("display")=="none"){
			$(".cont_toggle_calendar").slideDown("normal");
		}
	});
	$("#switch_toggle_hide_calendar").focus(function(){
		if($(".cont_toggle_calendar").css("display")=="block"){
			$(".cont_toggle_calendar").slideUp("normal");
		}
	});

});


//block_search_result_ori_cont :css for every 5 shohin 
$(function(){
	$("#block_search_result_ori_cont li:nth-child(5n)").css("marginRight","0");
});

/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/


//tooltip
this.tooltip = function(){
    this.xOffset = 20; // x distance from mouse
    this.yOffset = -20; // y distance from mouse
    $(".tooltip").unbind().hover(    
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            $('body').append( '<p id="tooltip">' + this.t + '</p>' );
            $('p#tooltip').css("top", this.top+"px").css("left", this.left+"px").fadeIn(400);
        },
        function() {
            this.title = this.t;
            $("p#tooltip").fadeOut(400).remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);
            $("p#tooltip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );            
    
};

jQuery(document).ready(function($){tooltip();}) 

//imgZoom
$(function(){
	$("div.imgZoom_shoplist").hover(function(){
		$(this).css({'z-index':'50'});
		$(this).find('img').stop().animate({
			marginTop:'0px',marginLeft:'0px',
			left:'-150px',top:'-150px',//画像拡大時の、起点(画像の左上)のposition
			//width:'200px',height:'200px'//拡大したい画像サイズ
			width:'150px',height:'150px'//拡大したい画像サイズ
		},200);//mouseover処理完了までの時間(1000で1秒)
	},function(){
		$(this).css({'z-index':'0'});
		$(this).find('img').stop().animate({
			marginTop:'0',marginLeft:'0',
			left:'0',top:'0',
			//width:'60px',height:'60px'
			width:'50px',height:'50px'
		},400);
	});

});

