
/*******************************************************************
	設定・定数
*******************************************************************/
var DeleteConfirmLabel = "本当に削除しますか？";


$(document).ready(function(){
	
/*******************************************************************
	JQuery : 店舗リスト
*******************************************************************/

// エリアのマウスオーバーによる画像置換
$("#Map area")
	.mouseout(function() {
		$("#map").attr("src", "img/map_all.png");
	})
	.mouseover(function() {
	switch($(this).attr("key")) {
		case 'ht':	// 北海道、東北エリア
			$("#map").attr("src", "img/map_hokkaido.png");	break;
		case 'kt':	// 北関東エリア
			$("#map").attr("src", "img/map_kitakanto.png");	break;
		case 'tk':	// 東京エリア
			$("#map").attr("src", "img/map_tokyo.png");	break;
		case 'to':	// 東京以外の関東エリア
			$("#map").attr("src", "img/map_kanto.png");	break;
		case 'sh':	// 信越、北陸エリア
			$("#map").attr("src", "img/map_shinshu.png");	break;
		case 'tu':	// 東海エリア
			$("#map").attr("src", "img/map_tokai.png");	break;
		case 'oh':	// 大阪、兵庫エリア
			$("#map").attr("src", "img/map_osaka.png");	break;
		case 'oo':	// 大阪、兵庫以外の近畿エリア
			$("#map").attr("src", "img/map_kinki.png");	break;
		case 'ts':	// 中国、四国エリア
			$("#map").attr("src", "img/map_chugoku.png");	break;
		case 'ko':	// 九州、沖縄エリア
			$("#map").attr("src", "img/map_kyushu.png");	break;
	}

});


/*******************************************************************
	JQuery : 商品検索画面
*******************************************************************/

//アイコンのマウスオーバー＆マウスアウト
$("#brand_navi img")
.mouseout(function() {
	changeimage($(this), 'search/icon', $(this).attr("brand"));
})
.mouseover(function() {
	changeimage($(this), 'search/icon', $(this).attr("brand") + "_f2");
});
$("#category_navi img")
.mouseout(function() {
	changeimage($(this), 'search/icon', $(this).attr("category"));
})
.mouseover(function() {
	changeimage($(this), 'search/icon', $(this).attr("category") + "_f2");
});




//ポップアップ : 検索結果 jak
$(".detail_popup").click(function(){
	// place : 相対パス指定
	var url;
	if ($(this).attr("place")==='index')
		url = "search/";
	if ($(this).attr("place")==='search')
		url = "";
	// ポップアップのサイズの指定
	var width, height;
	url += "detail.php?pid=" + $(this).attr("pid");
	width = 800; height = 700;

	// ポップアップを定義（ウィンドウの焦点も制御）
	var new_win = open(url, "popup", "width="+width+", height="+height+", scrollbars=yes");
	new_win.blur();
	new_win.focus();
	
	return false;
});


//ポップアップ : 検索結果 slide
$(".slide_popup").colorbox({width:"780px", height:"740px", iframe:true});
$(".slide_popup_jak").colorbox({width:"780px", height:"640px", iframe:true});


// ポップアップ : 管理画面 used_colform
$(".admin_used_colform").click(function(){
	var width, height;
	url = $(this).attr("href");
	width = 270; height = 350;
	// フォーカス制御なし null
	var new_win = open(url, null, "width="+width+", height="+height+", scrollbars=yes");
	return false;
});

/*******************************************************************
	JQuery : 汎用
*******************************************************************/

/**
 * 画像がない場合は画像を隠す
 *  注　chrome ◯  / Firefox △(関数は効かないがhideと同じ状態)  /  IE ??
 */
$("img").error(function(){
	$(this).hide();
});


});	// END : jquery ready



/*******************************************************************
	汎用
*******************************************************************/
// 画像切替え depthはルートからの深さ
function changeimage(img, abspath, name) {
	var realpath = DEPTH + abspath + '/' + name + '.png';
	img.attr("src", realpath);
}


//画像プリロード
function preLoadImages() {
  for (var i = 0, I = arguments.length; i < I; ++i) {
	  new Image().src = arguments[i];
  }
}

