//added by cp on 6/26/04 to capture the x,y position of the mouse
var posx=0;
var posy=0;
//var e= window.event;


// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouse;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

function getMouse(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  posx = tempX
  posy = tempY
  return true
}



//document.onmousemove=mousemove;

function mousemove(e) {

	var mouseX=event.x; 
	var mouseY=event.y
	status="x= "+mouseX+", y= "+mouseY;
}


function printList() {

	var printOutPage='../common/printout.htm';
	win = window.open(printOutPage, 'printout', '')

	checkReadyState(win,arguments);
}

function checkReadyState(win,divIds) {

	printDivs=divIds;

	if (win.document.readyState != 'complete')
	      setTimeout('checkReadyState(win,printDivs)', 500);
	else
	      for (i=0;i<printDivs.length;i++) {
	     		win.document.all.printbody.innerHTML=win.document.all.printbody.innerHTML+document.getElementById(printDivs[i]).innerHTML;
	     	}
}
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function roundDollar(amount)
{
		var s = "";
		var decimal;

		amount = parseFloat(amount);
		if (!(isNaN(amount)))
		{
			amount = Math.round(amount * 100);
			amount = amount / 100;
		s = new String(amount);
		decimal = s.indexOf(".");
		if (decimal == -1){
			s+=".00";
			}else{
				if (decimal == (s.length - 2)){
				s+="0";}
				}
				}else{
				s= "0.00";
				}


				return s;
}

function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}
