// JavaScript Document

//Alert
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//PopUp
function MM_openBrWindow(theURL,winName,w,h,features) { //From HTML
	var leftPos = (screen.width) ? (screen.availWidth - w) / 2 : 0;
	var topPos = (screen.height) ? (screen.availHeight - h) / 2 : 0;
	var prop = 'width='+w+',height='+h+',left='+leftPos+',top='+topPos+features;
	var win = window.open(theURL,winName,prop);
	if(window.focus){
		win.focus();
	}
}

//OpenSample
function xWindowOpen (strURL) { //From Flash
	var strName = "image";
	//var strFeatures = 'status=1,menubars=1,scrollbars='+scrollability+',resizable='+resizability;
	var winName = window.open(strURL,strName);
	if(window.focus){
		win.focus();
	}
}

//OpenFullScreen
function xOpenFullScreen(url,name){
	var platForm = xPlatformDetect();
	if(document.all && platForm =="Windows") {
		var win = window.open(url,name,"fullscreen=yes");
		if(window.focus){
			win.focus();
		}
		return;
	}
	var strFeatures = 'top=0,left=0,screenX=0,screenY=0,menubars=0,scrollbars=0,resizable=0';
	var numScreenWidth = xGetScreenWidth("avail");
	var numScreenHeight = xGetScreenHeight("avail");
	if(numScreenWidth>0 && numScreenHeight>0) {
		strFeatures += ',outerWidth=' + numScreenWidth;
		strFeatures +=',outerHeight='+ numScreenHeight;
	}
	var win = window.open(url,name,strFeatures);
	if(numScreenWidth>0 && numScreenHeight>0){
		win.resizeTo(numScreenWidth,numScreenHeight);
	}
	if(win.moveTo) {
		win.moveTo(0,0);
	}
	if(window.focus){
		win.focus();
	}
	return;
}

//GetWidth
function xGetScreenWidth(avail) {
	if(!self["screen"]) {
		return 0;
	}
	if(avail) {
		return (screen.availWidth ? screen.availWidth : 0);
	}
	return screen.width ? screen.width : 0;
}

//GetHeight
function xGetScreenHeight(avail){
	if(!self["screen"]) {
		return 0;
	}
	if(avail) {
		return (screen.availHeight ? screen.availHeight : 0);
	}
	return screen.height ? screen.height : 0;
}

//DetectPlatForm
function xPlatformDetect() {
	var strPlatForm = "";
	if(navigator.appVersion.indexOf("Win") != -1) {
		strPlatForm = "Windows";
	} else if (navigator.appVersion.indexOf("Mac") != -1) {
		strPlatForm = "Macintosh";
	} else {
		strPlatForm = "Other";
	}
	return strPlatForm;
}


