function openWindow(url, height, width, name, scrollbars) {
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);   
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   winParms += ",status=no,toolbar=no,menubar=no,location=no,scrollbars=" + scrollbars;   
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}


markW = 90;       // pixels wide
markH = 40;       // pixels high
markX = 1;      // percent right
markY = 75;      // percent down
markRefresh = 50; // milliseconds
tufhLeft = 0;

// set common object reference
if (!document.all) document.all = document;
if (!document.all.back_to_top.style) document.all.back_to_top.style = document.all.back_to_top;

wMark = document.all.back_to_top.style;
wMark.width = markW;
wMark.height = markH;
navDOM = window.innerHeight; // Nav DOM flag
wMark.visibility = 'hidden';

function setVals() {
 barW = 0; // scrollbar compensation for PC Nav
 barH = 0;
 if (navDOM) {
  if (document.height > innerHeight) barW = 20;
  if (document.width > innerWidth) barH = 20;
  } else {
  innerWidth = document.body.clientWidth;  
  innerHeight = document.body.clientHeight;
  }
 
 // Totaalnet : define left
 tufhLeft = (innerWidth - 765) / 2;
 // Totaalnet : update margin
 tufhLeft = tufhLeft + 20
 
 posX = ((innerWidth - markW)-barW) * (markX/100);
 posY = ((innerHeight - markH)-barH) * (markY/100); 
 }

function wRefresh() {
 //wMark.left = posX + (navDOM?pageXOffset:document.body.scrollLeft);
 // Totaalnet update, TUFH custom
 wMark.left = tufhLeft;
 wMark.top = posY + (navDOM?pageYOffset:document.body.scrollTop);
 
 if (navDOM?pageYOffset:document.body.scrollTop == 0) {
	wMark.visibility = 'hidden';
 }
 else
 {
	// Totaalnet update, TUFH custom
	if (posY + (navDOM?pageYOffset:document.body.scrollTop) < 540 ) {
		wMark.visibility = 'hidden';
	}
	else { 
		wMark.visibility = 'visible';
	}
  }
}

function markMe() {
 setVals();
 window.onresize=setVals;
 markID = setInterval ("wRefresh()",markRefresh);
 }
 
 
// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

// Call the following with your function as the argument
SafeAddOnload(markMe);

//window.onload=markMe; // safety for Mac IE4.5



