// JavaScript Document


var param = {
	quality: 'high',
	bgcolor: '#000000',
	menu: 'false',
	allowFullScreen: 'true',
	allowScriptAccess: 'sameDomain'
};

var attributes = {
  id: 'nikonnext',
  name: 'nikonnext'
};


//onLoad フルスクリーン body 100%, 100% で開かれる
function init()
{
	//開きたい幅・高さ
	var contentW = 1280;
	var contentH = 800;
	
	var ua = navigator.userAgent;       // ユーザーエージェント
	var nWidth, nHeight;                   // Window内のサイズ
	var nHit = ua.indexOf("MSIE");     // 合致した部分の先頭文字の添え字
	var bIE = (nHit >=  0);                 // IE かどうか
	var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");  // バージョンが 6 かどうか
	var bStd = (document.compatMode && document.compatMode == "CSS1Compat"); // 標準モードかどうか
	
	if(bIE)
	{
		if (bVer6 && bStd)
		{
			nWidth = document.documentElement.clientWidth;
			nHeight = document.documentElement.clientHeight;
		}
		else
		{
			nWidth = document.body.clientWidth;
			nHeight = document.body.clientHeight;
		}
	}
	else
	{
		nWidth = window.innerWidth;
		nHeight = window.innerHeight;
	}
	
	
	var marginW = screen.availWidth - nWidth;
	var marginH = screen.availHeight - nHeight;
	
	//ウィンドウの幅と高さ
	var winW, winH;
	
	//開きたい幅にマージンを足した幅がスクリーンより大きければ、
	//コンテンツを縮小、ブラウザはそれにマージンを足した大きさ
	if(contentW + marginW > screen.availWidth)
	{
		winW = screen.availWidth;
		contentW = screen.availWidth - marginW;
	}
	else
	{
		winW = contentW + marginW;
	}
	
	if(contentH + marginH > screen.availHeight)
	{
		winH = screen.availHeight;
		contentH = screen.availHeight - marginH;
	}
	else
	{
		winH = contentH + marginH;
	}
	
	
	//Flashのひとつ外側のdivのプロパティを更新
	document.getElementById('flash_content').style.width = contentW + 'px';
	document.getElementById('flash_content').style.height = contentH + 'px';
	document.getElementById('flash_content').style.marginLeft = String(-contentW / 2) + 'px';
	document.getElementById('flash_content').style.marginTop = String(-contentH / 2) + 'px';
	
	//
	/*
	if(bIE && bVer6)
	{
		var min_max_width = function(){
    	var w = document.body.clientWidth;
			var h = document.body.clientHeight;
			document.getElementById('wrapper').style.width = (w < contentW) ?  (contentW + 'px')  : '100%';
			document.getElementById('wrapper').style.height = (h < contentH) ?  (contentH + 'px')  : '100%';
		};

  	attachEvent('onresize', min_max_width);
	}
	else
	{
		document.getElementById('wrapper').style.minWidth = contentW + 'px';
		document.getElementById('wrapper').style.minHeight = contentH + 'px';
	}
	*/
	
	var x = (screen.availWidth - winW) / 2;
	var y = (screen.availHeight - winH) / 2;
	
	//ウィンドウのリサイズ・移動
	self.resizeTo(winW, winH);
	self.moveTo(x, y);
	self.focus();
	
	if (swfobject.hasFlashPlayerVersion("9.0.45")) {
		// has Flash
		swfobject.embedSWF('nikonnext.swf', 'nikonnext', contentW, contentH, '9.0.45', 'js/expressinstall.swf', flashvars, param, attributes);
	}
	else {
		// no Flash
		var iHTML = '';
		iHTML += '<p>In order to view this page you need Flash Player 9+ support!</p>';
		iHTML += '<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>';
		
		document.getElementById('nikonnext').innerHTML = iHTML;
	}
}




