/*
 *
 * 画面の移動
 * object
 *
 */
	function move_to(object){
		window.scrollTo(0, document.getElementById(object).offsetTop);
	}


/*
 *
 * 画像拡大縮小処理
 * height
 * width
 *
 */
	function resizeImg(photo,pWidth,pHeight,flg){
		//2009/7/27  Mantis12807の対応　STA
		//2009/7/27  Mantis12518の対応　STA
		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;
		if(flg == null || flg == undefined || flg == ""){
			$(photo).parent().css("align","center");
			$(photo).parent().css("vertical-align","top");
			//2009/7/29  Mantis12518の対応　START
			if(imgDem.height > 0 && imgDem.height <= pHeight){
			//2009/7/29  Mantis12518の対応　END
			    $(photo).css("margin-top",(pHeight - imgDem.height)*0.5);
			}
		}


		}).attr("src",photo.src+"?"+new Date().getTime());
		_self.show();
		//2009/7/27  Mantis12518の対応　END
		//2009/7/27  Mantis12807の対応　END
	}

/*
 *
 * 画像表示位置調整(調整対象はY軸のみ)
 * image - imgタグ
 * borderH - 画像を表示する枠の高さ
 * imageH - 画像の高さ(表示するサイズの高さ)
 */
	function adjustPos(image, borderH, imageH){
		// ※ロジックはresizeImgからコピー
		$(image).parent().css("align","center");
		$(image).parent().css("vertical-align","top");
		if(imageH > 0 && imageH <= borderH){
		    $(image).css("margin-top",(borderH - imageH) * 0.5);
		}
	}

/*
 *
 * 画像表示位置調整
 * image - imgタグ
 * borderW - 画像を表示する枠の幅
 * borderH - 画像を表示する枠の高さ
 * imageW - 画像の高さ(表示するサイズの高さ)
 * imageH - 画像の幅(表示するサイズの幅)
 */
	function adjustPosEx(image, borderW, borderH, imageW, imageH){
		// ※ロジックはresizeRecommendImgからコピー
		$(image).parent().css("align","center");
		$(image).parent().css("vertical-align","top");
		if(imageH > 0 && imageH <= borderH){
		    $(image).css("margin-top",(borderH - imageH) * 0.5);
		}
		if(imageW > 0 && imageW <= borderW){
		    $(image).css("margin-left",(borderW - imageW) * 0.5);
		}
	}

/*
 *
 * POP UP
 *
 */
	function popUpMap(action,popWidth,popHeight)
	{
		//2009/9/16 メニューバーは表示させない の対応 BJBMOUZG start
		SubWindow=window.open(action,"isizejjmap","width="+popWidth+",height="+popHeight+",toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1");
		//2009/9/16 メニューバーは表示させない の対応 BJBMOUZG end
		SubWindow.focus();
	}

	function showTips(nm){
	  var style=document.getElementById?
	              document.getElementById(nm).style:(
	                document.all?document.all(nm).style:(
	                  document.layers?document.layers[nm]:null
	                  )
	              );
	  if(style) style.visibility='inherit';
	}

	function hideTips(nm){
	  var style=document.getElementById?
	              document.getElementById(nm).style:(
	                document.all?document.all(nm).style:(
	                  document.layers?document.layers[nm]:null
	                  )
	              );
	  if(style) style.visibility='hidden';
	}
/*
 *
 * PULLDOWN LINK
 *
 */
	function pullDownLink(){

    var index = document.windowChenge.propertypage.selectedIndex;
    var url = document.windowChenge.propertypage.options[index].value;

    if (url!="-"){
		SubWindow = window.open(url, "");
		SubWindow.focus();
    }
}
function norikaePop(formName) {
		var SubWindow=window.open("about:blank", "compinfo", "width=600, height=550, toolbar=1, location=0, status=0, menubar=1, scrollbars=1, resizable=1");
		SubWindow.focus();
		document.forms[formName].submit();
	}
var request = {
  QueryString : function(val) {
  	var uri = window.location.search;
 	var re = new RegExp("" +val+ "\=([^\&\?]*)", "ig");
 	return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
 },
 QueryStrings : function() {
	 var uri = window.location.search;
	 var re = /\w*\=([^\&\?]*)/ig;
	 var retval=[];
	 while ((arr = re.exec(uri)) != null)
	 retval.push(arr[0]);
	 return retval;
 }
 }
$(function(){
	var fmn=request.QueryString("fmn");
	var previewUrl=request.QueryString("previewUrl");
	if(fmn==null){
		fmn="f";
	}else if(fmn.length==0){
		fmn="f";
	}
	if(previewUrl!=null){
	   var fmn_n=previewUrl.search("fmn%3Dn");
	   var fmn_m=previewUrl.search("fmn%3Dm");
	  if(fmn_n>0){
    	 fmn="n";
       }
       if(fmn_m>0){
    	 fmn="m";
       }
	}

	if(fmn.toLowerCase() !="f"){
		var elements=document.getElementsByTagName('A');
		for (var i = 0, len = elements.length; i < len; ++i) {
			var strIndex=elements[i].href;
			var reIndex=strIndex.search("bukken/shosai/JJ010FJ100");
			var redummy=strIndex.search("dummy");
			var strherfId=strIndex.search("#");
			var strKaiSha=strIndex.search("kaisha/shosai/JJ05");
			var strKaiShaPrint=strIndex.search("kaisha/shosai/JJ051FD002");
			var strMail = strIndex.search("#mobileContent");
			if(strMail > 0){
				elements[i].hideFocus="true";
				elements[i].href = "#";
				//elements[i].className="editcss";
			}
			else if(strKaiSha > 0 && redummy < 0 && strKaiShaPrint < 0){
				elements[i].hideFocus="false";
				elements[i].style.cursor="pointer";
			}
			else if((reIndex<0 && elements[i].id!="pagetop" && strherfId<0)||redummy>0||elements[i].id=="killedLink"){
				//elements[i].className="editcss";
			    elements[i].onclick = function(){return false;};
	            elements[i].href = "#";
				elements[i].hideFocus="true";
			}else{
				elements[i].hideFocus="false";
				elements[i].style.cursor="pointer";
			}
		}
		var selects=document.getElementsByTagName('SELECT');
		for (var i = 0, len = selects.length; i < len; ++i) {
			var strselectId=selects[i].id;
			if(strselectId!="nokilled"){
				selects[i].disabled="true";
			}

		}
		var imgs=document.getElementsByTagName('IMG');
		for (var i = 0, len = imgs.length; i < len; ++i) {
			var strIndex=imgs[i].src;
			var reIndex=strIndex.search("tel=");
			if(reIndex>0){
				imgs[i].src="/jj/jjcommon/img/img_qr_001.gif";
			}
		}
	}
$('a[id=singleShiryou]').click(function() {
			if(fmn.toLowerCase() == "f"){
				var href = $(this).attr("href");
				var turHtml= $('<input type="hidden" name="turnbackinfo" value ="'+$(".turnbackinfo :input").val()+'"/>');
				var shiryouForm = $('<form action='+href+' method="post"></form>');
				shiryouForm.appendTo("body");
				turHtml.appendTo(shiryouForm);
				shiryouForm[0].submit();
			}
			return false;
		})
//2009/07/27 Mantis:0011359 王維亮 start
$('a[id=kuchikomiButton]').click(function() {
			if(fmn.toLowerCase() == "f"){
				var href = $(this).attr("href");
				var turHtml= $('<input type="hidden" name="turnbackinfo" value ="'+$(".turnbackinfo :input").val()+'"/>');
				var shiryouForm = $('<form action='+href+' method="post"></form>');
				shiryouForm.appendTo("body");
				turHtml.appendTo(shiryouForm);
				shiryouForm[0].submit();
			}
			return false;
		})
//2009/07/27 Mantis:0011359 王維亮 end
$('a[id^=kaishaBukkenshiryou]').click(function(){
		if(fmn.toLowerCase() == "f"){
		//2009/08/15 資料請求修正 BJBfengtao Start
			var href = $(this).attr("href");
			var turHtml= $('<input type="hidden" name="turnbackinfo" value ="'+$(".turnbackinfo :input").val()+'"/>');
			var bsncHtml = "";
			$(".data_table input:checkbox").each(function(){
				if($(this).attr("checked")){
					bsncHtml += '<input type="hidden" name="bsnc" value ="'+ $(this).val() +'"/>'
				}
			});
			var shiryouForm = $('<form action='+href+' method="post"></form>');
			shiryouForm.appendTo("body");
			$(turHtml).appendTo(shiryouForm);
			$(bsncHtml).appendTo(shiryouForm);
			shiryouForm[0].submit();
		//2009/08/15 資料請求修正 BJBfengtao End
		}
		return false;
		})
}
);



