/* 行動履歴のリセット処理 */
function resetLatestBukken(contextRoot, ar, bs) {
	var url = contextRoot + "/common/parts/JJ901FI302/";

	var param;
	if(bs == null || bs =="" ){
    	param = "ar=" + ar;
	} else {
    	param = "ar=" + ar + "&bs=" + bs;
	}

	$.post(url, param, function() {
			$("#latestBukken").html("&nbsp;");
			$("#latestBukkenGobal").html("");
		}
	);
	return false;
}

//ヘッダー部レコメンドパーツ仕様変更　ajaxでデータ取得を行う
function getResetLatestList(contextRoot, ar, bs, dispmode ) {

	$("#poplistBukken").html("<div >データを読み込み中・・・</div >");

	$.ajax({
		type:"POST",
		url :contextRoot + "/common/parts/JJ901FI311/",
		data: "ar="+ ar + "&bs="+ bs + "&dispmode=" + dispmode,
		success: function (msg) {
			$("#poplistSearch").html( msg );
    	}
    });

    $.ajax({
		type:"POST",
		url :contextRoot + "/common/parts/JJ901FI301/",
		data: "ar="+ ar + "&bs="+ bs + "&dispmode=" + dispmode,
		success: function (msg) {
			$("#poplistBukken").html( msg );
    	}
    });
	return false;
}

var submitted = false;

function overfunc(){
	if(submitted){
		return false;
	}else{
		submitted = true;
		return true;
	}
}
function resizeRecommendImg(photo,pWidth,pHeight){

	var _self = $(photo);
	_self.hide();
	var imgDem = {};
	imgDem.width  = 0;
	imgDem.height  = 0;
	//画像自分のサイズ小を取得
	var image = new Image();

	$(image).load(function(){
	if(image.width>0 && image.height>0){
		//縦なりゆき
		if(pHeight == null || pHeight == undefined || pHeight == ""){
			//画像サイズ小:元サイズ生きで表示。天地左右センタリング
			if(image.width <= pWidth){
				imgDem.height = image.height;
				imgDem.width = image.width;
			}else{
				imgDem.width = pWidth;
				imgDem.height = (image.height*pWidth)/image.width;
			}
		}else{
			if(image.width/image.height>= pWidth/pHeight){
	             if(image.width>pWidth){
	                 imgDem.width=pWidth;
	                 imgDem.height=(image.height*pWidth)/image.width;
	             }else{
	                 imgDem.width=image.width;
	                 imgDem.height=image.height;
	             }
	         } else{
	             if(image.height>pHeight){
	                 imgDem.height=pHeight;
	                 imgDem.width=(image.width*pHeight)/image.height;
	             }else{
	                 imgDem.width=image.width;
	                 imgDem.height=image.height;
	             }
	        }
		}
	}
	photo.width = imgDem.width;
	photo.height = imgDem.height;
	$(photo).parent().css("align","center");
	$(photo).parent().css("vertical-align","top");
	if(imgDem.height > 0 && imgDem.height <= pHeight){
		$(photo).css("margin-top",(pHeight - imgDem.height)*0.5);
	}
	if(imgDem.width > 0 && imgDem.width <= pWidth){
		$(photo).css("margin-left",(pWidth - imgDem.width)*0.5);
	}
	}).attr("src",photo.src+"?"+new Date().getTime());
	_self.show();
}

