// JavaScript Document
var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, intWidth, intHeight){
	closeWin();
	var h=0;
	var w=0;
	if(screen.availHeight<=intHeight){intHeight = screen.availHeight;}
	else{h = Math.floor( (screen.availHeight-intHeight)/2 );}
	if(screen.availWidth<=intWidth) intWidth = screen.availWidth;
	else{w = Math.floor( (screen.availWidth-intWidth)/2 );}
	var str="screenX=0,screenY=0";
	str = ",top="+h+",left="+w;
	var tools="";
	if (screen.availHeight<=720){
		newWindow = window.open(url,'newWin','fullscreen=yes');
	}else{
		tools = "resizable=no,toolbar=no,location=no,status=no,scrollbars=no,width="+intWidth+",height="+intHeight+str;
		newWindow = window.open(url, 'newWin', tools);
	}
	newWindow.focus();
}

function Full(){	
	var arg1 = 1280;
	var arg2 = 720;
	var arg3 = '/HybridWorld/ORIGAMI/index.html';
	var arg4 = '/HybridWorld/ORIGAMI/index.html';

	switch (arguments.length) {
		default:
		case 4: arg4 = arguments[3];
		case 3: arg3 = arguments[2];
		case 2: arg2 = arguments[1];
		case 1: arg1 = arguments[0];
		case 0:
	}

	popUpWin(arg3,arg1,arg2);
}

function commentWin(){
	var url = "/HybridWorld/ORIGAMI/questionnaire/";
	commentWindow = window.open(url, 'commentWin', "resizable=yes,toolbar=yes,location=yes,status=yes,scrollbars=yes,width=740,height=480");
	commentWindow.focus();
}

function commentListWin(){
	var url = "/HybridWorld/ORIGAMI/comments/index.html";
	commentWindow = window.open(url, 'commentWin', "resizable=yes,toolbar=yes,location=yes,status=yes,scrollbars=yes,width=740,height=480");
	commentWindow.focus();
}
