// Default JavaScript include file

	// Popup window spawner
	function DoPopup(sURL, sName, iWidth, iHeight, iRelation, iPosition, x, y, sFeatures) {
	
		// If the URL is empty or just an anchor, exit the function
		if (sURL == "#" || sURL.length <= 0) {
			return;
		}

		var iScreenX = 0;
		var iScreenY = 0;
		var iOffsetLeft = 0;
		var iOffsetTop = 0;
		var bIE = false;
		
		if(navigator.userAgent.indexOf("MSIE") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.body.offsetWidth;
				iScreenY = document.body.offsetHeight;
				iOffsetLeft = window.screenLeft;
				iOffsetTop = window.screenTop;
				bIE = true;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else if(navigator.userAgent.indexOf("Safari") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.width;
				iScreenY = document.height;
				iOffsetLeft = window.screenX;
				iOffsetTop = window.screenY;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else if(navigator.userAgent.indexOf("Mozilla") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.body.clientWidth;
				iScreenY = document.body.clientHeight;
				iOffsetLeft = window.screenX;
				iOffsetTop = window.screenY;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else {
			x = 10;
			y = 10;
		}
		
		if(x == 0 & y == 0) {
			switch(iPosition) {
				case 1: // topleft
					x = 0;
					y = 0;
					break;
					
				case 2: // topcenter
					x = (iScreenX - iWidth) / 2;
					y = 0;
					break;
					
				case 3: // topright
					x = iScreenX - (iWidth + 20);
					y = 0;
					break;
					
				case 4: // centerleft
					x = 0;
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 5: // center
					x = (iScreenX - iWidth) / 2;
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 6: // centerright
					x = iScreenX - (iWidth + 20);
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 7: // bottomleft
					x = 0;
					y = iScreenY - (iHeight + 20);
					break;
					
				case 8: // bottomcenter
					x = (iScreenX - iWidth) / 2;
					y = iScreenY - (iHeight + 20);
					break;
					
				case 9: // bottomright
					x = iScreenX - (iWidth + 20);
					y = iScreenY - (iHeight + 20);
					break;
					
				default:
					x = 10;
					y = 10;
					break;
			}
			
			x = x + iOffsetLeft;
			y = y + iOffsetTop;
			
		}
		
		window.open(
				sURL, 
				sName, 
				"width=" + iWidth + ",height=" + iHeight + ",left=" + x + ",top=" + y + "," + sFeatures
			);
	}