// Pop up window
function popUp(URL, widthval, heightval, id) {
 // Create unique id if not defined
 if (!id) {
 	day = new Date();
 	id = day.getTime();
 }
 // Set default width and height if not defined
 if (!widthval) { widthval=800; }
 if (!heightval) { heightval=600; }
 // Calculate coordinates for centered window
 var fromleft=(screen.width - widthval)/2;
 var fromtop=((screen.height - heightval)/2)-30;
 // Determine the browser type (not exhaustive)
 var browser_type = jsrsBrowserSniff();
 // If a 'service' window then append browser type to URL
 if (id == 'service') { URL += '&_gb_browser=' + browser_type; }
 // Set window properties depending on browser type
 if (browser_type == "NS") { winprops='toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width='+widthval+',height='+heightval+',screenX='+fromleft+',screenY='+fromtop; }
 else{ winprops='toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width='+widthval+',height='+heightval+',left='+fromleft+',top='+fromtop; }
 // Open the window if IE, or Firefox, otherwise issue a warning first
 if (browser_type == "IE" || browser_type == "MOZ") {
 	newwindow = window.open(URL, id, winprops);
 } else {
 	if (confirm('This feature is known to work with the following browsers:\n\nInternet Explorer v5, 6\nFirefox\n\nSupport for other browsers is under development. For the latest details please contact DSPack.\n\nIf you would like to proceed anyway click \'OK\'')) { newwindow = window.open(URL + '&_gb_browser=' + browser_type,id,winprops); }
 }
}

var win=null;
function login(url, handle) {
	if (screen.width < 1024) { features = 'resizable=yes, status=yes, scrollbars=yes, width=' + screen.availWidth + 4 + ', height=' + screen.availHeight + 4 + ', left=0 ,top=0'; }
	else { features = 'resizable=yes, status=yes, scrollbars=no, width=' + screen.availWidth + 4 + ', height=' + screen.availHeight + 4 + ', left=0 ,top=0'; }
	win = window.open(url, handle, features);
}

// This function originated from jsrsClient.js (2.4)
function jsrsBrowserSniff(){
  if (document.layers) return "NS";
  if (document.all) {
		// But is it really IE?
		// convert all characters to lowercase to simplify testing
		var agt=navigator.userAgent.toLowerCase();
		var is_opera = (agt.indexOf("opera") != -1);
		var is_konq = (agt.indexOf("konqueror") != -1);
		if(is_opera) {
			return "OPR";
		} else {
			if(is_konq) {
				return "KONQ";
			} else {
				// Really is IE
				return "IE";
			}
		}
  }
  if (document.getElementById) return "MOZ";
  return "OTHER";
}