//ブラウザ判定
function isWin () { return (navigator.appVersion.indexOf ("Win") != -1); }
function isMac () { return (navigator.appVersion.indexOf ("Mac") != -1); }
function isIE () { return (navigator.appName.indexOf ("Explorer") != -1); }
function isNS () { return (navigator.appName.indexOf ("Netscape") != -1); }
function isWinIE () { return (isWin () && isIE ()); }
function isWinNS () { return (isWin () && isNS ()); }
function isMacIE () { return (isMac () && isIE ()); }
function isMacNS () { return (isMac () && isNS ()); }
function isW3CDOM () { return (document.getElementById ? true : false); }
function isMSDOM () { return (document.all ? true : false); }
function isNCDOM () { return (document.layers ? true : false); }
function isDOM () { return (isW3CDOM () || isMSDOM () || isNCDOM ()); }

//Flashプラグイン判定
function getFlashPlayerVersion() {
	if (navigator.plugins) with (navigator) {
		var s = "application/x-shockwave-flash";
		if (mimeTypes && mimeTypes [s] && mimeTypes [s].enabledPlugin){
			nFlashPlayerVersion = navigator.plugins ["Shockwave Flash"].description.match (/\d+/);
		}
	}
	return parseInt (nFlashPlayerVersion);
}

var nFlashPlayerVersion = 0;
if (isWinIE ()){
	document.write ('<scr' + 'ipt type="text/vbscript" language="VBScript"\>\nPrivate i, b\nOn Error Resume Next\nFor i = 8 To 1 Step -1\nb = (IsObject (CreateObject ("ShockwaveFlash.ShockwaveFlash." & i)))\nIf b Then \nnFlashPlayerVersion = i\nExit For\nEnd If\nNext\n</scr' + 'ipt\>');
}

//Flash描画
function printMovie(id,src,base,width,height,flashvars){
	var http_https = window.location.protocol;
	if(http_https != "https:"){
		http_https="http:";
	}
	var content = "";
	content += '<object id="' + id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	content += ' codebase="' + http_https +'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
	content += ' width="' + width + '" height="' + height + '">';
	content += '<param name="movie" value="'+ src + '">';
	if(base) content += '<param name="base" value="'+ base + '">';
	content += '<param name="quality" value="high">';
	content += '<param name="wmode" value="opaque">';
	if(flashvars) content += '<param name="flashvars" value="' + flashvars + '">';
	content += '<param name="menu"	value="false"><param name="allowScriptAccess" value="sameDomain"><param name="WMOD" value="window">'
	content += '<embed id="' + id +'"';
	content += ' src="' + src +'"';
	content += ' width="' + width + '" height="' + height + '"';
	if(base) content += ' base="' + base +'"';
	content += ' quality="high"';
	if(flashvars) content += ' flashvars="' + flashvars + '"';
	content += ' menu="false" swLiveConnect="true" wmode="opaque"';
	content += ' allowScriptAccess="sameDomain" ';
	content += ' type="application/x-shockwave-flash"';
	content += ' pluginspage="' + http_https +'//www.macromedia.com/go/getflashplayer">';
	content += '</embed></object>';
	document.write(content);
}

//一貫体制が生み出す安心、ポラスグループのご案内　詳細ウィンドウ

//TYPE-A ウィンドウサイズ固定で開く--------------------------------------------------
function openWindow01(theURL,height) {
	MM_openBrWindow(theURL,'window','resizable=yes,width=390,height='+height+',scrollbars=no,status=no');
}

//TYPE-B 閉じているか調べてリサイズする--------------------------------------------------
/*
function openWindow01(theURL,height) {
	if(!win_closed(window.helpwin)){
		resizeToWIN(395,Number(height)+20,window.helpwin);
		window.helpwin.location = theURL;
	}else{
		openHELPWIN(event,theURL,'',-420,-1*height,390,height);
	}
}
*/

//ウィンドウのリサイズ２
function fitToContent(oj){

	if(!arguments[0])oj=self

	//--内寸取得
	if(document.layers){       //n4用
		var w = oj.document.width 
		var h = oj.document.height 
	} else if(document.all || document.getElementById || window.opera){      //e用,o6,n6,n7,m1用
		var w = oj.document.body.scrollWidth
		var h = oj.document.body.scrollHeight
	}
	
	oj.resizeTo(390,h+60)

	oj.focus()               //フォーカスする
}

//ウィンドウのリサイズ
function resizeToWIN(width,height,oj){

	if(!arguments[2])oj=self

	//--内寸取得
	if(window.opera||document.layers){       //n4 o6用
		var w = oj.innerWidth  
		var h = oj.innerHeight  
	} else if(document.all){                 //e用
		var w = oj.document.body.clientWidth 
		var h = oj.document.body.clientHeight
	} else if(document.getElementById){      //n6,n7,m1用
		var w = oj.innerWidth   
		var h = oj.innerHeight 
	}

	oj.resizeTo(width,height)

	//resizeToの結果内寸が 正しければ、そのまま。
	//                     違うなら、差分を加算。
	if(width!=w||height!=h){
		//oj.resizeBy((width-w),(height-h))		//加算オフ
		if(document.layers)
			oj.location.reload(0) //n4はreloadでresizeバグ回避 
	}

	oj.focus()               //フォーカスする
}

/*
//サブウインドウの相対位置とサイズを決めて
//openHELPWIN(url,offsetx,offsety,width,height)を起動する
function openHELPWIN(e,url,targetName,offsetx,offsety,width,height){

	//マウスの現在位置
	var mouseXonScreen = null
	var mouseYonScreen = null

	//マウスの現在位置取得
	if(document.all){                                       //e4,e5,e6
		 mouseXonScreen = window.event.screenX 
		 mouseYonScreen = window.event.screenY
	} else if(document.layers || document.getElementById ){ //n4,n6,n7,m1,o6
		 mouseXonScreen = e.screenX
		 mouseYonScreen = e.screenY
	}

	//マウスの現在位置から何ピクセル離すかをセット
	var setx = mouseXonScreen + offsetx
	var sety = mouseYonScreen + offsety

	//サブウインドウ開く(引数以外のパラメータも下記でセットできます)
	var para =""
					 +" left="        +setx
					 +",screenX="     +setx
					 +",top="         +sety
					 +",screenY="     +sety
					 +",toolbar="     +0
					 +",location="    +0
					 +",directories=" +0
					 +",status="      +0
					 +",menubar="     +0
					 +",scrollbars="  +0
					 +",resizable="   +1
					 +",innerWidth="  +width
					 +",innerHeight=" +height
					 +",width="       +width
					 +",height="      +height

		helpwin=window.open(url,targetName,para)
		helpwin.focus()
}

//--ウインドウ有無確認関数
function win_closed(winVar) {
	var ua = navigator.userAgent
	if( !!winVar )
			if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 )
					 && ua.indexOf('Win')!=-1 ) 
					 return winVar.closed
			else return typeof winVar.document  != 'object'
	else return true
}
*/

//以下DreamWeaver標準ビルトイン-----------------------------------------------------------

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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];}}
}

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;
}

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;
}

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];}
}


// 以下 MTechno 追加 ---------------------------------------------------------------------

( function () {
	if (arguments.callee.done) return;


	function insertBanner() {
		var e = document.getElementById('menu_link'); if (!e) return;
/*
		e.innerHTML = [
			'<table width="645" border="0" cellpadding="3" cellspacing="0">',
				'<tr>',
					'<td><img src="/images/title_link.gif" alt="Link" width="76" height="22"></td>',
					'<td><a href="/blog/"><img src="/images/link_blog.gif" alt="プラザブログ" width="111" height="30" border="0"></a></td>',
					'<td><a href="/recommend/line_up.php"><img src="/images/link_line_up.gif" alt="販売物件一覧" width="111" height="30" border="0"></a></td>',
//					'<td><a href="http://itot1.jp/higashi-urawa/" target="_blank"><img src="/images/link_area_guide5.gif" alt="さいたま市緑区 東浦和エリアガイド" width="111" height="30" border="0"></a></td>',
					'<td><a href="/recommend/new_arrival.php"><img src="/images/link_new_arrival.gif" alt="新着情報" width="111" height="30" border="0"></a></td>',
					'<td><a href="/customercenter/" target="_blank"><img src="/images/link_customercenter.gif" alt="お客様とのきずな広場" width="111" height="30" border="0"></a></td>',
					'<td><a href="http://www.polus-home.jp/yochi/yochi.php"><img src="/images/link_yochi.gif" alt="用地募集" width="111" height="30" border="0"></a></td>',
					'<td><a href="/setup/needs.php"><img src="/images/link_needs.gif" alt="友の会会員募集" width="111" height="30" border="0"></a></td>',
				'</tr>',
			'</table>'
		].join('');
		e.style.visibility = 'visible';
*/

		if ( e = document.getElementById('wrap_plaza') ) {
			var a = e.getElementsByTagName('a'), i = -1, n = a.length;
			while ( ++i < n ) {
				e = a[i];
				if ( typeof e.href === 'string' && e.href.indexOf('contest.php') !== -1 ) {
					e.href = 'https://www.polus-home.jp/inquiry/various/polus-home.jp/contest.php?fmid=OTx68rAt0KH13a901S03qj9aoCi24L';
					break;
				}
			}
		}
		if ( e = document.getElementsByTagName('a') ) {
			var i = e.length, a;
			while (i--) {
				a = e[i];
				if ( typeof a.href === 'string' && a.href.indexOf('contest.php') !== -1 ) {
					a.href = 'https://www.polus-home.jp/inquiry/various/polus-home.jp/contest.php?fmid=OTx68rAt0KH13a901S03qj9aoCi24L';
					break;
				}
			}
		}
		if ( !( e = document.getElementById('plaza_best_choice_menu') ) || !( e = e.getElementsByTagName('a')[5] ) ) return;
		if ( typeof e.href === 'string' && e.href.indexOf('form_contact.php') !== -1 ) {
			e.href = 'https://www.polus-home.jp/inquiry/various/polus-home.jp/form_request2.php?fmid=30XTasBtDMcC328I8yn4SVIS0vsf0n&bkid=1608';
		}
		if ( !( e = document.getElementById('plaza_best_choice_material') ) || !( e = e.getElementsByTagName('a')[0] ) ) return;
		if ( typeof e.href === 'string' && e.href.indexOf('form_contact.php') !== -1 ) {
			e.href = 'https://www.polus-home.jp/inquiry/various/polus-home.jp/form_request2.php?fmid=30XTasBtDMcC328I8yn4SVIS0vsf0n&bkid=1608';
		}
	}
	function scrollCheckMT() {
		if (arguments.callee.done) return;
		try { document.documentElement.doScroll('left'); } catch(e) { setTimeout(scrollCheckMT,1); return; }
		arguments.callee.done = true; runfnMT();
	}
	function runfnMT() {
		if (arguments.callee.done) return;
		if (!document.body) return setTimeout(runfnMT,13);
		arguments.callee.done = true; insertBanner();
	}
	arguments.callee.done = true;
	if ( document.readyState === 'complete' ) {
		return runfnMT();
	}
	if (document.addEventListener) {
		document.addEventListener( 'DOMContentLoaded', function () {
			document.removeEventListener( 'DOMContentLoaded', arguments.callee, false );
			runfnMT();
		}, false );
		window.addEventListener('load',runfnMT,false);
	} else if (document.attachEvent) {
		document.attachEvent( 'onreadystatechange', function () {
			if ( document.readyState === 'complete' ) {
				document.detachEvent('onreadystatechange',arguments.callee);
				runfnMT();
			}
		} );
		window.attachEvent('onload',runfnMT);
		var toplevel = false;
		try { toplevel = window.frameElement == null; } catch(e) {}
		if ( document.documentElement.doScroll && toplevel ) scrollCheckMT();
	}
} )();

