var flashVersion=false;
var nn=(navigator.appName.charAt(0)=="N");
var n6=(document.getElementById && nn) || false;
var ie=(document.all && !nn) || false;
var mac=(navigator.userAgent.indexOf("Mac")!=-1) || false;
var ver=""+navigator.appVersion;
var fno=ver.indexOf(" ");
var macChecked=0;
var chk_macIE=false;
ver=eval(ver.substring(0,fno));

if (window.opera || mac) {
	if (navigator.userAgent.indexOf("MSIE") > 0 && mac) {
		chk_macIE = true;
	} else {
		for (i = 0; i < navigator.plugins.length; i++) {
			pName = navigator.plugins[i].description;
			if (pName.indexOf("Flash", 0) != -1) {
				flashVersion = pName.substr(pName.indexOf("Flash", 0)+6);
				flashVersion = flashVersion.substr(0, flashVersion.indexOf("."));
			}
		}
	}
} else {
	if (ie && !mac) {
		var flashVersion=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").FlashVersion();
		flashVersion=Math.floor(flashVersion / 0x10000);
	}
}

if (!flashVersion) {
	if (nn && !document.plugins) {
		flashVersion=false;
	} else if ((nn || n6) && navigator.plugins) {
		var pos = navigator.plugins["Shockwave Flash"].description.indexOf(".");
		flashVersion=navigator.plugins["Shockwave Flash"].description.substring(0, pos).replace("Shockwave Flash ", "");

	} else { 
		flashVersion=false;
	}
}
/*
if (ie && mac) window.onload=chkMac;
	
function chkMac() {
	if (window["sample"]) flashVersion=((window["sample"].FlashVersion() & 0xffff0000) >> 16);
	macChecked=1;
	result();
}
*/


//********************************************************
// Flash Version Check
//********************************************************
function chkflash() {
//	if (mac && ie && macChecked==0) return "NG";
	if (chk_macIE == true) {
		return "MacIE";
	}
	
	if (!flashVersion) {
		return "NG";
	}

	if (flashVersion >= 7) {
		return "OK";
	} else {
		return "NG";
	}
}

//********************************************************
// Child Window Open
//********************************************************
function openwin() {
	window.open("main.htm", "child_win", "width=" + screen.availWidth + ",height=" + screen.availHeight + ",resizable=yes,scrollbars=no,left=0,top=0");
}

//********************************************************
// Parent Window Operation
//********************************************************
function parent_operation(goto_page) {
	var home_url = "http://www.nikon.co.jp/main/eng/index.htm";
	var cate_url = "http://www.nikon.co.jp/main/eng/feelnikon/nature/visual-sketch/index.htm";
	var nn=(navigator.appName.charAt(0)=="N");
	var n6=(document.getElementById && nn) || false;
	var ie=(document.all && !nn) || false;

	if (goto_page == "home") {
		parent_url = home_url;
	} else if (goto_page == "cate_top") {
		parent_url = cate_url;
	}
	
	if (window.opener == null || window.opener == "" | window.opener.closed == true) {
		// Not Parent Window Operation
		window.open(parent_url, "parent");
	} else {
		// Parent Window Operation
		window.opener.location.href = parent_url;
		window.opener.focus();
	}
}

function win_close() {
	window.close();
}
