var newwindow = null;

function popUp(URL, widthval, heightval, id, winprops) {
 var fromleft=(screen.width - widthval)/2;
 var fromtop=((screen.height - heightval)/2)-30;
// if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null) {
 if (jsrsBrowserSniff() == "NS") { winprops += ',width='+widthval+',height='+heightval+',screenX='+fromleft+',screenY='+fromtop; }
 else { winprops += ',width='+widthval+',height='+heightval+',left='+fromleft+',top='+fromtop; }
 newwindow = window.open(URL, 'mywindow', winprops);
}

function popUpService(URL, widthval, heightval, id, offset) {
 if (id) {
 	day = new Date();
 	id = day.getTime();
 } else { id = 'service'; }

 if (!widthval) { widthval=800; }
 if (!heightval) { heightval=600; }

 var fromleft=(screen.width - widthval)/2 + (offset ? offset : 0);
 var fromtop=((screen.height - heightval)/2)-30 + (offset ? offset : 0);

 var browser_type = jsrsBrowserSniff();
 // if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null) {
 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; }
 if (browser_type == "IE" || browser_type == "MOZ") {
 	newwindow = window.open(URL + '&_gb_browser=' + jsrsBrowserSniff(),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 DPOA.\n\nIf you would like to proceed anyway click \'OK\'')) { newwindow = window.open(URL + '&_gb_browser=' + browser_type,id,winprops); }
 }

}

function popUpImage(URL, widthval, heightval, id) {
 if (id) {
 	day = new Date();
 	id = day.getTime();
 } else { id = 'service'; }

 if (!widthval) { widthval=800; }
 if (!heightval) { heightval=600; }

 var fromleft=(screen.width - widthval)/2;
 var fromtop=((screen.height - heightval)/2)-30;

 var browser_type = jsrsBrowserSniff();
 // if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null) {
 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; }
 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 DPOA.\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) {
	var winprops;
	if (screen.width < 1024) { winprops = 'resizable=yes, status=yes, scrollbars=yes, width=' + screen.availWidth + 4 + ', height=' + screen.availHeight + 4 + ', left=0 ,top=0'; }
	else { winprops = 'resizable=yes, status=yes, scrollbars=no, width=' + screen.availWidth + 4 + ', height=' + screen.availHeight + 4 + ', left=0 ,top=0'; }
	win = window.open(url, handle, winprops);
}

// 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";
}
function AllowOnlyNumeric()
{
    // Get the ASCII value of the key that the user entered
    var key = window.event.keyCode;

    // Verify if the key entered was a numeric character (0-9) or a decimal (.) or space
    if ( (key > 47 && key < 58) || key == 46 || key == 47 || key == 37 || key == 32)
        // If it was, then allow the entry to continue
        return;
    else
        // If it was not, then dispose the key and continue with entry
        window.event.returnValue = null;
}
