<!--
// Generic window opener for fullscreen
// Copyright 2004-2006 Stefan Thomson (stefan 'at' thomson.nu)
function tmFullScreenWindow(url){
	// Get browser version
	var strAppVersion = navigator.appVersion;
	var strAppName = navigator.appName;
	var bolWin = (strAppVersion.indexOf("Win")>=0)?1:0;
	var strBrowser = "";
	var intPos = strAppVersion.indexOf("MSIE",0); 

	// Open window with different properties depending on version

	// OS > Windows
	if(bolWin){
		// Browswers in Windows
		bolIE = (strAppName.indexOf("Microsoft")>=0)?1:0;
		bolIE5 = (strAppName == "Microsoft Internet Explorer" && parseInt(strAppVersion) >= 4)?1:0;
		bolXP = (parseInt(strAppVersion.indexOf("Windows NT 5.1"),0)>0)?1:0;
		bolIE6 = (parseInt(strAppVersion.slice(intPos+5,intPos+6))>=6)?1:0;
		if(bolIE){ //  Internet Explorer
			if(bolIE5){
				popWin = window.open(url,'timWin','fullscreen=0,width='+(screen.availWidth-10)+',height='+screen.availHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=0,top=0,screenX=0,screenY=0');
				checkPopWin(url);
				popWin.focus();
			}else if(bolIE && !bolIE5){// Internet Explorer < 4
				popWin = window.open(url,'timWin','width='+screen.availwidth+',height='+screen.availHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left=0,top=0,screenX=0,screenY=0',true);
				checkPopWin(url);
			}
		}else if(strAppName.indexOf("Netscape")>=0){ // Netscape Navigator
			popWin = window.open('','timWin','scrollbars=0,resizable=0,outerWidth='+screen.availWidth+',outerHeight='+screen.availHeight+',top=p,left=0,fullscreen=yes');
			checkPopWin(url);
			popWin.moveBy(0,-10);
			popWin.location.href=url;
		}else{// Other windows browser
			popWin = window.open(url,'timWin','fullscreen=1,width='+screen.availWidth+',height='+screen.availHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
			popWin.resizeTo(Math.ceil(screen.availWidth+3),Math.ceil(screen.availWidth+1));
			checkPopWin(url);
			popWin.moveTo(0,0);
			popWin.focus();
		}
	}else if(strAppVersion.indexOf("Mac")>=0){ // Mac OS
		if(strAppVersion.indexOf("Safari")>=0){ // Safari
			popWin = window.open("","full","scrollbars=0,resizable=0,width=" + (screen.availWidth) +",height=" + (screen.availHeight-20));
			checkPopWin(url);
			popWin.moveTo(0,0);
			popWin.location.href=url;
			popWin.focus();
		}else{ // Other browsers
			if(strAppName.indexOf("Microsoft")>=0){ // IE
				popWin = window.open(url,"full","alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=1,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
				checkPopWin(url);
				popWin.resizeTo(screen.availWidth,screen.availHeight);
				popWin.focus();
			}else if(strAppName.indexOf("Netscape")>=0){ // Netscape
				popWin = window.open("","full","scrollbars=0,resizable=0,width=" + (screen.availWidth-12) +",height=" + (screen.availHeight-30));
				checkPopWin(url);
				popWin.moveTo(0,0);
				popWin.location.href=url;
				popWin.focus();			
			}else{ // Other mac browser
				popWin = window.open(url,'timWin','fullscreen=1,width='+screen.availWidth+',height='+screen.availHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
				popWin.resizeTo(Math.ceil(screen.availWidth+3),Math.ceil(screen.availWidth+1));
				checkPopWin(url);
				popWin.moveTo(0,0);
				popWin.focus();
			}
		}
	}

}

function checkPopWin(url)
{
	if(popWin == null)
	{
		self.location.href = url;
	}
}

/**
  * Opens browser window in a specific size [optional at specific placement]
  * @param url string url to be opened
  * @param w int width of window
  * @param h int height of window
  * [@param] t int top of window
  * [@param] l int left of window
  * @type void
  */
function tmSizedPopup(url,winName,w,h)
{
	// Check top & left params [optional 3 & 4 arg] or the default (centered)
	//var sw = self.screen.availWidth;
	//var sh = self.screen.availHeight;
	
	var sw = screen.width;
	var sh = screen.height;

	var defPosX = parseInt((sw-w)/2);
	var defPosY = parseInt((sh-h)/2);
	
	var t = (arguments[4]!=undefined)?arguments[4]:defPosY;
	var l = (arguments[5]!=undefined)?arguments[5]:defPosX;
	
	
	// Get browser version
	var strAppVersion = navigator.appVersion;
	var strAppName = navigator.appName;
	var bolWin = (strAppVersion.indexOf("Win")>=0)?1:0;
	var strBrowser = "";
	var intPos = strAppVersion.indexOf("MSIE",0); 

	// Open window with different properties depending on version

	// OS > Windows
	if(bolWin){
		// Browswers in Windows
		bolIE = (strAppName.indexOf("Microsoft")>=0)?1:0;
		bolIE5 = (strAppName == "Microsoft Internet Explorer" && parseInt(strAppVersion) >= 4)?1:0;
		bolXP = (parseInt(strAppVersion.indexOf("Windows NT 5.1"),0)>0)?1:0;
		bolIE6 = (parseInt(strAppVersion.slice(intPos+5,intPos+6))>=6)?1:0;
		if(bolIE){ //  Internet Explorer
			if(bolIE5){
				popWin = window.open(url,winName,'fullscreen=0,width='+w+',height='+h+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left='+(l)+',top='+(t)+',screenX=0,screenY=0');
				checkPopWin(url);
				popWin.focus();
			}else if(bolIE && !bolIE5){// Internet Explorer < 4
				popWin = window.open(url,winName,'width='+w+',height='+h+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left=0,top=0,screenX=0,screenY=0',true);
				checkPopWin(url);
			}
		}else if(strAppName.indexOf("Netscape")>=0){ // Netscape Navigator
			popWin = window.open('',winName,'scrollbars=0,resizable=0,outerWidth='+w+',outerHeight='+(h+54)+',top='+t+',left='+l+',fullscreen=yes');
			checkPopWin(url);
			popWin.moveBy(0,-10);
			popWin.location.href=url;
		}else{// Other windows browser
			popWin = window.open(url,winName,'fullscreen=1,width='+w+',height='+h+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
			checkPopWin(url);
			popWin.resizeTo(Math.ceil(screen.availWidth+3),Math.ceil(screen.availWidth+1));
			popWin.moveTo(0,0);
			popWin.focus();
		}
	}
	else if(strAppVersion.indexOf("Mac")>=0){ // Mac OS
		if(strAppVersion.indexOf("Safari")>=0){ // Safari
			popWin = window.open("",winName,"scrollbars=0,resizable=0,width=" + w +",height=" + h);
			checkPopWin(url);
			popWin.moveTo(0,0);
			popWin.location.href=url;
			popWin.focus();
		}else{ // Other browsers
			if(strAppName.indexOf("Microsoft")>=0){ // IE
				popWin = window.open(url,winName,"alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=1,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
				checkPopWin(url);
				popWin.resizeTo(screen.availWidth,screen.availHeight);
				popWin.focus();
			}else if(strAppName.indexOf("Netscape")>=0){ // Netscape
				popWin = window.open("",winName,"scrollbars=0,resizable=0,width=" + (screen.availWidth-12) +",height=" + (screen.availHeight-30));
				checkPopWin(url);
				popWin.moveTo(0,0);
				popWin.location.href=url;
				popWin.focus();			
			}else{ // Other mac browser
				popWin = window.open(url,winName,'fullscreen=1,width='+screen.availWidth+',height='+screen.availHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
				checkPopWin();
				popWin.resizeTo(Math.ceil(screen.availWidth+3),Math.ceil(screen.availWidth+1));
				popWin.moveTo(0,0);
				popWin.focus();
			}
		}
	}
}