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=='email')
	{
		popupWin = window.open(theUrl, name, config='height=630,width=555,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
	else if(name=='probsugg')
	{
		popupWin = window.open(theUrl, name, config='height=570,width=650,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
	else if(name=='ticklist')
	{
		popupWin = window.open(theUrl, name, config='height=400,width=250,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 if(name=='reassign')
	{
		popupWin = window.open(theUrl, name, config='height=450,width=490,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');
	}
	event.cancelBubble = true;
	event.returnValue = false;
}
window.name = 'opener';

function printPage()
{
	if (pr) // NS4, IE5
		window.print()
	else if (da && !mac) // IE4 (Windows)
		vbPrintPage()
	else // other browsers
		alert("Sorry, your browser doesn't support this feature.");
	return;htm
}
if (da && !pr && !mac) with (document)
{
	writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
	writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
	writeln('Sub window_onunload');
	writeln('  On Error Resume Next');
	writeln('  Set WB = nothing');
	writeln('End Sub');
	writeln('Sub vbPrintPage');
	writeln('  OLECMDID_PRINT = 6');
	writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
	writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
	writeln('  On Error Resume Next');
	writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
	writeln('End Sub');
	writeln('<' + '/SCRIPT>');
}

// 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";
 }
}
	
function ShowBubble(fArg)
{
 var bubbleOBJ = (document.getElementById) ? document.getElementById('bub' + fArg) : eval("document.all['bub" + fArg + "']");

 if(bubbleOBJ)
 {
  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 = bubbleOBJ.offsetHeight;
  var OBJwidth = 5;

  if(navigator.appName != 'Netscape')
  {
   bubbleOBJ.style.pixelLeft = xmouse+10+xScrollOffset-OBJwidth;
   bubbleOBJ.style.pixelTop = ymouse+10+yScrollOffset-OBJheight;
  }else{
   bubbleOBJ.style.left = xmouse+10+xScrollOffset-OBJwidth+"px";
   bubbleOBJ.style.top = ymouse+10+yScrollOffset-OBJheight+"px";
  }
  bubbleOBJ.style.visibility = "visible";
 }
}

function HideBubble(fArg)
{
 var bubbleOBJ = (document.getElementById) ? document.getElementById('bub' + fArg) : eval("document.all['bub" + fArg + "']");
 if (bubbleOBJ != null)
 {
  if(navigator.appName != 'Netscape')
  {
   bubbleOBJ.style.pixelLeft = 0;
   bubbleOBJ.style.pixelTop = 0;
  }else{
   bubbleOBJ.style.left = 0+"px";
   bubbleOBJ.style.top = 0+"px";
  }
  bubbleOBJ.style.visibility = "hidden";
 }
}

function clearRates(boxIndex)
	{
		 switch(boxIndex)
			{
			 case 1:
			document.getElementById("txtMinHourly").disabled = true;
			document.getElementById("txtMinHourly").value = "0.00";
			document.getElementById("txtMaxHourly").disabled = true;
			document.getElementById("txtMaxHourly").value = "0.00";
			document.getElementById("txtMinDaily").disabled = true;
			document.getElementById("txtMinDaily").value = "0.00";
			document.getElementById("txtMaxDaily").disabled = true;
			document.getElementById("txtMaxDaily").value = "0.00";
			break
			 case 2:
			if (document.getElementById("txtMinHourly").disabled == true)
			{
			document.getElementById("txtMinHourly").disabled = false;
			}
			if (document.getElementById("txtMaxHourly").disabled == true)
			{
			document.getElementById("txtMaxHourly").disabled = false;
			}
			if (document.getElementById("txtMinDaily").disabled == true)
			{
			document.getElementById("txtMinDaily").disabled = false;
			}
			if (document.getElementById("txtMaxDaily").disabled == true)
			{
			document.getElementById("txtMaxDaily").disabled = false;
			}
			break
			}	
	}

function confirmBoxWithBubbleCancel(text,e)
{
 if (!confirm(text))
 {
  cancelBubble(e);
 }
}	
function cancelBubble(e)
	{
	if(e.stopPropagation)
		 {
			e.stopPropagation();
		 } else 
		 {
			e.cancelBubble=true;
		 }
	if(e.preventDefault)
		 {
			e.preventDefault();
		 } 
		 else 
		 {
			e.returnValue=false;
		 }	
	}			

	
function show(element)
{
 document.getElementById(element).style.display='block'
}

function showInline(element)
{
 document.getElementById(element).style.display='inline'
}

function showRow(element) {
    if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1)
    { document.getElementById(element).style.display = 'block'; }
    else
    { document.getElementById(element).style.display = 'table-row'; }
}

function hide(element)
{
 document.getElementById(element).style.display='none'
}
function Reveal (it, box) 
{ 
	var vis = (box.checked) ? "block" : "none"; 
	document.getElementById(it).style.display = vis;
} 
	