var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 
var ie = (navigator.userAgent.indexOf("IE") != -1); 

var popupWin = null;

function openWindow(theUrl, name)
{
	if(name=='contactHistory')
	{
		popupWin = window.open(theUrl, name, config='height=450,width=550,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
	else if(name=='report')
	{
		popupWin = window.open(theUrl, name, config='height=460,width=650,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
	else
	{
		popupWin = window.open(theUrl, name, config='height=600,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
	if(event!=null)
	{
		event.cancelBubble = true;
		event.returnValue = false;
	}
}

function show(element) {document.getElementById(element).style.display='block';}
function showInline(element) {document.getElementById(element).style.display='inline';}
function hide(element) {document.getElementById(element).style.display='none';}

function scram() {
	if (popupWin != null && popupWin.open) popupWin.close();
}

window.name = 'opener';
window.onfocus=scram;


// Side menu script

function menu(action) {
 document.getElementById('ctlSideMenu_divExpanded').style.display='none';
 document.getElementById('ctlSideMenu_divExpanded').style.zIndex='10';
 document.getElementById('ctlSideMenu_divExpanded').style.position='absolute';
 document.getElementById('ctlSideMenu_divCollapsed').style.display='none';
 document.getElementById('divCollapseMenu').style.display='block';
 document.getElementById('ctlSideMenu_' + action).style.display='block';
}

// Tool tips
document.onmousemove = Move;
if (document.layers) document.captureEvents(Event.MOUSEMOVE);

var ymouse=0;
var xmouse=0;
function Move(evt)
{
 var e=evt?evt:event;
 xmouse=e.clientX?e.clientX:e.x;
 ymouse=e.clientY?e.clientY:e.y;
 //window.status = xmouse + ':' + ymouse;
}

function ShowTooltip(fArg, vertAlign, horiAlign)
{
 //vertAlign params: n= north of mouse cursor; s = to south of mouse cursor, c = centre of cursor, nc = half-north
 //horiAlign params: e= to east of mouse cursor; w = to west of mouse cursor
 //usual default would be s,e (like a windows tooltip).
 var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");

 if(tooltipOBJ)
 {
  if(!(vertAlign=="n"||vertAlign=="s"||vertAlign=="c"||vertAlign=="nc")){vertAlign="s";}
  if(!(horiAlign=="w"||horiAlign=="e")){horiAlign="e";}

  var xScrollOffset = document.body.scrollLeft;
  var yScrollOffset = document.body.scrollTop;
  if(xScrollOffset==0){xScrollOffset = document.documentElement.scrollLeft;}
  if(yScrollOffset==0){yScrollOffset = document.documentElement.scrollTop;}
  
  var OBJheight = 0;
  var OBJwidth = 5;

  if(vertAlign=="n"){OBJheight=tooltipOBJ.offsetHeight;}
  if(vertAlign=="nc"){OBJheight=tooltipOBJ.offsetHeight*0.75;}
  if(vertAlign=="c"){OBJheight=tooltipOBJ.offsetHeight*0.5;}
  if(horiAlign=="w"){OBJwidth=tooltipOBJ.offsetWidth+20;}

  if(navigator.appName != 'Netscape')
  {
   tooltipOBJ.style.pixelLeft = xmouse+10+xScrollOffset-OBJwidth;
   tooltipOBJ.style.pixelTop = ymouse+10+yScrollOffset-OBJheight;
  }else{
   tooltipOBJ.style.left = xmouse+10+xScrollOffset-OBJwidth+"px";
   tooltipOBJ.style.top = ymouse+10+yScrollOffset-OBJheight+"px";
  }
  tooltipOBJ.style.visibility = "visible";
 }
}

function HideTooltip(fArg)
{
 var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
 if (tooltipOBJ != null)
 {
  if(navigator.appName != 'Netscape')
  {
   tooltipOBJ.style.pixelLeft = 0;
   tooltipOBJ.style.pixelTop = 0;
  }else{
   tooltipOBJ.style.left = 0+"px";
   tooltipOBJ.style.top = 0+"px";
  }
  tooltipOBJ.style.visibility = "hidden";
 }
}
