$(function(){
	var dialog_ops = {
		autoOpen: false,
		bgiframe: true,
		modal:true,
		width: 890,
		height: 700,
		position:["center","top"],
		closeOnEscape: true,
		resizable:true,
		title:"商品詳細情報",
		beforeClose:function(){
			$("#div_item_detail").empty();
			//jQueryUI.dialog破棄
			$("#div_item_detail").dialog("destroy");
			//jQueryUI.dialog初期化
			$("#div_item_detail").dialog(dialog_ops);
		},
		open:function(){
			$("#div_item_detail").css({"height":"700px"});
		}
	};
	//ダイアログ設定
	$("#div_item_detail").dialog(dialog_ops);
});
function remake_pager(){
	//ページャー部設定
	$("#pager").children().each(function(){
		if($(this).is("span")){
			var val = $(this).html();
//			$(this).after('<a href="javascript:void(0)" id="pager_a' + val + '" class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only" style="margin-right:5px;border-color:#000"><span class="ui-button-text font_m" style="padding: 2px 4px;font-weight:bold">' + val + '</span></a>');
			$(this).after('<a href="javascript:void(0)" id="pager_a' + val + '" class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only" style="margin-right:5px;border-color:#000"><span class="ui-button-text font_l" style="padding: 2px 4px;font-weight:bold">' + val + 'ページ</span></a>');
			$(this).remove();
		} else {
			var val = $(this).html();
			var val2 = $(this).html();
			if(isNaN(val2)){
				val2 = $(this).attr("class");
			}
			switch(val){
				case "先頭へ":
					val2 = "first"
					break;
				case "最後へ":
					val2 = "last"
					break;
			}
//			$(this).after('<a href="javascript:void(0)" id="pager_a' + val2 + '">' + val + '</a>');
			$(this).after('<a href="javascript:void(0)" id="pager_a' + val2 + '">' + val + '</a>');
			$(this).remove();
			$("#pager_a" + val2).button().css({"margin-right":"5px"}).find("span").css({"padding":"2px 4px"}).addClass("font_m");
//			$("#pager_a" + val2).css({"margin-left":"10px"}).addClass("font_m");
		}
	});
	//ページャー部２設定
	$("#pager2").children().each(function(){
		if($(this).is("span")){
			var val = $(this).html();
//			$(this).after('<a href="javascript:void(0)" id="pager2_a' + val + '" class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only" style="margin-right:5px;border-color:#000"><span class="ui-button-text font_m" style="padding: 2px 4px;font-weight:bold">' + val + '</span></a>');
			$(this).after('<a href="javascript:void(0)" id="pager2_a' + val + '" class="ui-button ui-widget ui-state-active ui-corner-all ui-button-text-only" style="margin-right:5px;border-color:#000"><span class="ui-button-text font_l" style="padding: 2px 4px;font-weight:bold">' + val + 'ページ</span></a>');
			$(this).remove();
		} else {
			var val = $(this).html();
			var val2 = $(this).html();
			if(isNaN(val2)){
				val2 = $(this).attr("class");
			}
			switch(val){
				case "先頭へ":
					val2 = "first"
					break;
				case "最後へ":
					val2 = "last"
					break;
			}
			$(this).after('<a href="javascript:void(0)" id="pager2_a' + val2 + '">' + val + '</a>');
			$(this).remove();
			$("#pager2_a" + val2).button().css({"margin-right":"5px"}).find("span").css({"padding":"2px 4px"}).addClass("font_m");
		}
	});
	init_pager();
}
function callback_item_detail(html_val){
	$("#div_item_detail").html(html_val).dialog("open");
}
function get_item_detail(cd){
	xajax_disp_item_detail(cd);
}
//商品にその他画像が登録されている場合はサムネイルクリックで表示を変える
function chg_item_img(ino){
	$("#div_item_detail_img img").css({"display":"none"});
	$("#img_item_" + ino).css({"display":"block"});
	$("img.item_img_selected").removeClass("item_img_selected").css({"border":"1px solid #aaa"});
	$("#img_item_s" + ino).addClass("item_img_selected").css({"border":"2px solid #000"});
	
}

