
// image roll
//------------------------------------*/
function imgRoll(obj,flag) {
var pathsrc = obj.getAttribute("src");
var path = pathsrc.slice(0,pathsrc.lastIndexOf("/")+1);
var imgname = pathsrc.slice(pathsrc.lastIndexOf("/")+1,pathsrc.length);
if(flag) {
var imgname = imgname.replace(/_off/i,"_on");
} else {
var imgname = imgname.replace(/_on/i,"_off");
}
obj.setAttribute("src",path + imgname);
}

// subwin open（汎用）
//------------------------------------*/
function openWindow(strUrl,winName,winWidth,winHeight) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + winWidth + ',height=' + winHeight;
winName = window.open(strUrl,winName,features);
winName.focus();
}

// subwin open（旧コンテンツ）
//------------------------------------*/
function winpop(url)
{window.open(url, "pop", "width=640,height=700,scrollbars=1,resizable=1");}

// 「使い方」サブウィンドウを開く
//------------------------------------*/
function howtoWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=760,height=680';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「情報の見方」サブウィンドウを開く
//------------------------------------*/
function helpWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=760,height=680';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「印刷用画面」サブウィンドウを開く
//------------------------------------*/
function printWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=760,height=620';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「ムービー」サブウィンドウを開く
//------------------------------------*/
function movWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=680';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「賃料相場」サブウィンドウを開く
//------------------------------------*/
function priceWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=760,height=680';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「周辺マップ」サブウィンドウを開く
//------------------------------------*/
function mapWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=680';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「お問合せフォーム」サブウィンドウを開く(1.0次用)
//------------------------------------*/
function formWinOpen(strUrl,winName) {
var features = 'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=700';
winName = window.open(strUrl,winName,features);
winName.focus();
}
// 「お問合せフォーム」サブウィンドウを開く（1.2次用）
//------------------------------------*/
/*function formWinOpen(strUrl,winName) {
var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=700';
winName = window.open(strUrl,winName,features);
winName.focus();
}
*/

// 「資金シミュレーション」サブウィンドウを開く
//------------------------------------*/
function shikinWinOpen(strUrl,winName) {
var features = 'toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=790,height=700';
winName = window.open(strUrl,winName,features);
winName.focus();
}

// normal link clicked
//------------------------------------*/
function openLink(strUrl,winName) {
winName = window.open(strUrl,winName);
winName.focus();
}

// contents display/hidden
//------------------------------------*/
function openClose(dispID,hiddenID) {
document.getElementById(dispID).style.display = 'block';
document.getElementById(hiddenID).style.display = 'none';
}

// image roll（旧コンテンツ）
//------------------------------------*/
// PRELOAD IMAGES
function revPreloadImages(the_images_array) {
	for(var loop = 0; loop < the_images_array.length; loop++) {
		var an_image = new Image();
		an_image.src = the_images_array[loop];
	}
}


// SWAP IMAGES(MM)
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) x.src=x.oSrc;
}


// SWAP IMAGES RESTORE(MM)
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0; i<(a.length-2); i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// PRELOAD IMAGES(MM)
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


// FIND OBJECT(MM)
function MM_findObj(n, d) { //v4.01
	var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0; !x&&i<d.forms.length; i++) x=d.forms[i][n];
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}


// SWAP_IMAGES
var revStockUaObj,revStockUaSrc;
function revSetOverAction(_obj){
	revStockUaObj = _obj;
	revStockUaSrc = _obj.firstChild.src;
	var s = revStockUaSrc.indexOf(".gif");
	_obj.firstChild.src = revStockUaSrc.substring(0,s) + "_ovr.gif";
}
function revSetOutAction(){
	revStockUaObj.firstChild.src = revStockUaSrc;
}


// ブラウザバージョン情報の取得
//------------------------------------*/
function BrowserInfo(userAgent) {

	/*****************************************
	 * Geckoエンジンバージョンチェッカー
	 * (返値 int 合致しない場合は-1)
	 *****************************************/
	this.geckoVersionChecker = function(){
		var num = this.ua.match(new RegExp("Gecko/20[0-9]{6}"));
		return ( num == null ) ? -1 : parseInt(String(num).replace("Gecko/",""));
	}

	/*****************************************
	 * WebKitバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.webkitVersionChecker = function(){
		var num = this.ua.match(new RegExp("WebKit/[0-9]{1,4}(\.[0-9]{1,2})?"));
		return ( num == null ) ? -1 : parseFloat(String(num).replace("Firefox/",""));
	}

	/*****************************************
	 * IEバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.ieVersionChecker = function(){
		var ienum = this.ua.match(new RegExp("MSIE [0-9]{1,2}\.[0-9]{1,3}"));
		return ( ienum == null ) ? -1 : parseFloat(String(ienum).replace("MSIE ",""));
	}
	

	/*****************************************
	 * Firefoxバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.firefoxVersionChecker = function(){
		var num = this.ua.match(new RegExp("Firefox/[0-9]{1,2}\.[0-9]{1,2}"));
		return ( num == null ) ? -1 : parseFloat(String(num).replace("Firefox/",""));
	}

	/*****************************************
	 * Operaバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.operaVersionChecker = function(){
		var num = this.ua.match(new RegExp("Opera[/ ][0-9]{1,2}\.[0-9]{1,2}"));
		return ( num == null ) ? -1 : parseFloat(String(num).substr(6));
	}

	/*****************************************
	 * Safariバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.safariVersionChecker = function(){
		var num = this.ua.match(new RegExp("Safari/[0-9]{1,4}\.[0-9]{1,2}"));
		return ( num == null ) ? -1 : parseFloat(String(num).replace("Safari/",""));
	}

	/*****************************************
	 * Netscapeバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.netscapeVersionChecker = function(){
		var num = this.ua.match(new RegExp("Netscape[0-9]?/[0-9]{1,2}\.[0-9]{1,3}"));
		return ( num == null ) ? -1 : parseFloat(String(num).replace(new RegExp("Netscape[0-9]?/"),""));
	}

	/*****************************************
	 * Mozillaバージョンチェッカー
	 * (返値 float 合致しない場合は-1)
	 *****************************************/
	this.mozillaVersionChecker = function(){
		var num = this.ua.match(new RegExp("Mozilla/[0-9]{1,2}\.[0-9]{1,2}"));
		return ( num == null ) ? -1 : parseFloat(String(num).replace("Mozilla/",""));
	}
	// -- コンストラクタ --

	this.ua = (userAgent) ? userAgent : navigator.userAgent;

	this.geckoVersion = this.geckoVersionChecker();
	this.gecko = (this.geckoVersion > 0 );

	this.webkitVersion = this.webkitVersionChecker();
	this.webkit = (this.webkitVersion > 0 );

	this.ieVersion = this.ieVersionChecker();
	this.ieMVersion = Math.floor(this.ieVersion);
	this.ie = ( this.ieVersion >= 3 );
	this.macie = ( this.ua.match("Mac_PowerPC") != null );

	this.firefoxVersion = this.firefoxVersionChecker();
	this.firefoxMVersion = Math.floor(this.firefoxVersion);
	this.firefox = (this.firefoxVersion > 0 );

	this.safariVersion = this.safariVersionChecker();
	this.safariMVersion = Math.floor(this.safariVersion);
	this.safari = (this.safariVersion > 85 );

	this.operaVersion = this.operaVersionChecker();
	this.operaMVersion = Math.floor(this.operaVersion);
	this.opera = (this.operaVersion > 1 );
	
	this.netscapeVersion = this.netscapeVersionChecker();
	this.netscapeMVersion = Math.floor(this.netscapeVersion);
	this.netscape = (this.netscapeVersion > 1 );
	
	this.mozillaVersion = this.mozillaVersionChecker();
	this.mozilla = ( !this.firefox && !this.opera && !this.ie && !this.netscape && this.mozillaVersion > 0 ); 
	
	this.toString = function(){
		return ("[ua:"+this.ua+"  netscapeVersion:"+this.netscapeVersion+"  operaVersion:" + this.operaVersion + "  webkitVersion:"+ this.webkitVersion +"  safariVersion:"+this.safariVersion+"  ieVersion:"+ this.ieVersion +"  macie:" + this.macie  + "  geckoVersion:" +this.geckoVersion + " firefoxVersion:" +this.firefoxVersion +"]" );
	}
}

// クッキーとブラウザチェック
//------------------------------------*/
function checkTargetCookie(cookie_only_flg){
	var targetBFlg = false;
	var cookieEnabled = false;
	var bi = new BrowserInfo();
	var jsOffHtml = "";
	var targetBHtml = "";
	var jsOffHtmlMst = "";
	var targetBHtmlMst = "";

	//クッキーが利用可能かどうか判定
	if (typeof document.cookie =="string"){
		if(document.cookie.length ==0){
			document.cookie = "test";
			cookieEnabled = (document.cookie =="test");
			document.cookie = "";
		}else{
			cookieEnabled = true;
		}
	}
	
	//ブラウザのVerがIE6以上、またはFF1.5以上、またはSafari2.0以上か
	if(bi.ie){
		targetBFlg = (bi.ieVersion >= 6) ? true : false ;
	}else if(bi.firefox){
		targetBFlg = (bi.firefoxVersion >= 1.5) ? true : false ;
	}else if(bi.safari){
		targetBFlg = (bi.safariVersion >= 400) ? true : false ;
	}
	
	jsOffHtmlMst += "<p><strong>Java ScriptまたはCookieの設定がオンになっていません。お手数ですが設定を「オン」にして、ご利用ください。</strong></p>";
	jsOffHtmlMst += "<p class='notesTxt'>※設定がオフになっていますと、ご利用いただけないサービスがございます。</p>";
	
	targetBHtmlMst += "<p><strong>こちらのサービスは、下記の環境にてご利用いただけます。ご利用の環境をご確認ください。</strong></p>";
	targetBHtmlMst += "<div class='targetBox'>";
	targetBHtmlMst += "<dl>";
	targetBHtmlMst += "<dt>■Windows</dt>";
	targetBHtmlMst += "<dd><p>Windows XP（SP2）、Windows Vista｜Microsoft Internet Explorer 6.0/7.0、FireFox1.5/2.0｜Flash Player</p></dd>";
	targetBHtmlMst += "</dl>";
	targetBHtmlMst += "<div class='clear'><br></div>";
	targetBHtmlMst += "<dl>";
	targetBHtmlMst += "<dt>■Machintosh</dt>";
	targetBHtmlMst += "<dd><p class='pb10'>MacOSX｜Safari 2.0以上｜Flash Player</p></dd>";
	targetBHtmlMst += "</dl>";
	targetBHtmlMst += "<div class='clear'><br></div>";
	targetBHtmlMst += "</div>";
	targetBHtmlMst += "<p class='alignR mt10'><a href='/athome/browse.html' class='bulletR'>推奨環境についてはこちら</a></p>";
	
	if( cookie_only_flg ) targetBFlg = true;
	
	if(!cookieEnabled && !targetBFlg){
		targetBHtml += "<div class='targetArert mb10'>";
		targetBHtml += jsOffHtmlMst;
		targetBHtml += "<div style='height:10xp; background:transparent url(/special/images/common_line_dash_pnk.gif) repeat-x scroll left center; display:block;'>　</div>";
		targetBHtml += targetBHtmlMst;
		targetBHtml += "</div>";
		document.write(targetBHtml);
	}else if(!cookieEnabled){
		jsOffHtml += "<div class='targetArert mb10'>";
		jsOffHtml += jsOffHtmlMst;
		jsOffHtml += "<p class='alignR mt5'><a href='/athome/browse.html' class='bulletR'>推奨環境についてはこちら</a></p>";
		jsOffHtml += "</div>";
		document.write(jsOffHtml);
	}else if(!targetBFlg){
		targetBHtml += "<div class='targetArert mb10'>";
		targetBHtml += targetBHtmlMst;
		targetBHtml += "</div>";
		document.write(targetBHtml);
	}
	
}

// ブラウザチェックのみ
//------------------------------------*/
function checkTargetBrowser(player_view_id,non_flash){
	var targetBFlg = false;
	var bi = new BrowserInfo();
	var targetBHtml = "";
	var nonFlashHtml = "";
	var targetBHtmlMst = "";
	var nonFlashHtmlMst = "";
	var playerViewId = (player_view_id != "" && player_view_id != null && player_view_id != undefined) ? player_view_id : "" ;

	//ブラウザのVerがIE6以上、またはFF1.5以上、またはSafari2.0以上か
	if(bi.ie){
		targetBFlg = (bi.ieVersion >= 6) ? true : false ;
	}else if(bi.firefox){
		targetBFlg = (bi.firefoxVersion >= 1.5) ? true : false ;
	}else if(bi.safari){
		targetBFlg = (bi.safariVersion >= 400) ? true : false ;
	}
	//FlashPlayerダウンロードの表示が出ている場合はターゲットブラウザのアラートを出さない
	if(playerViewId != ""){
		if(document.all){
			if(document.all(playerViewId)){
				targetBFlg = true;
			}
		}else if(document.getElementById){
			if(document.getElementById(playerViewId)){
				targetBFlg = true;
			}
		}
	}
	
	nonFlashHtmlMst += "<p><strong>最新のFlash Playerがインストールされていない方は、Adobeのサイトよりプレーヤーをダウンロードしてください。</strong>";
	nonFlashHtmlMst += "<a href='http://www.adobe.com/shockwave/download/index.cgi?Lang=Japanese&P1_Prod_Version=ShockwaveFlash'><img src='/special/images/common_bnr_get_flash.gif' width='126' height='45' alt='GET ADOBE FLASH PLAYER' style='vertical-align:middle; margin-left:15px;'></a></p>";
	
	targetBHtmlMst += "<p><strong>こちらのサービスは、下記の環境にてご利用いただけます。ご利用の環境をご確認ください。</strong></p>";
	targetBHtmlMst += "<div class='targetBox'>";
	targetBHtmlMst += "<dl>";
	targetBHtmlMst += "<dt>■Windows</dt>";
	targetBHtmlMst += "<dd><p>Windows XP（SP2）、Windows Vista｜Microsoft Internet Explorer 6.0/7.0、FireFox1.5/2.0｜Flash Player</p></dd>";
	targetBHtmlMst += "</dl>";
	targetBHtmlMst += "<div class='clear'><br></div>";
	targetBHtmlMst += "<dl>";
	targetBHtmlMst += "<dt>■Machintosh</dt>";
	targetBHtmlMst += "<dd><p class='pb10'>MacOSX｜Safari 2.0以上｜Flash Player</p></dd>";
	targetBHtmlMst += "</dl>";
	targetBHtmlMst += "<div class='clear'><br></div>";
	targetBHtmlMst += "</div>";
	targetBHtmlMst += "<p class='alignR mt10'><a href='/athome/browse.html' class='bulletR'>推奨環境についてはこちら</a></p>";
	
	if(non_flash && !targetBFlg){
		targetBHtml += "<div class='targetArert mt20'>";
		targetBHtml += nonFlashHtmlMst;
		targetBHtml += "<div style='height:10xp; background:transparent url(/special/images/common_line_dash_pnk.gif) repeat-x scroll left center; display:block;'>　</div>";
		targetBHtml += targetBHtmlMst;
		targetBHtml += "</div>";
		document.write(targetBHtml);
	}else if(non_flash){
		nonFlashHtml += "<div class='targetArert mt20'>";
		nonFlashHtml += nonFlashHtmlMst;
		nonFlashHtml += "<p class='alignR mt10' style='margin-right:45px;'><a href='/athome/browse.html' class='bulletR'>推奨環境についてはこちら</a></p>";
		nonFlashHtml += "</div>";
		document.write(nonFlashHtml);
	}else if(!targetBFlg){
		targetBHtml += "<div class='targetArert mt20'>";
		targetBHtml += targetBHtmlMst;
		targetBHtml += "</div>";
		document.write(targetBHtml);
	}
}

