<!-- hide script from old browsers

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;

offsetX = 12;
offsetY = 12;

var toolTipSTYLE="";

var xx = 0;
var yy = 0;

var divWidth = 0;
var divHeight = 0;

var topPos = 0;
var leftPos = 0;

var winHeight = 0;
var winWidth = 0;

var imgX = 0;
var imgY = 0;
	
function initToolTips(){

//alert('initToolTips');

  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
		var toolTipObj = MM_findObj("toolTipLayer");
		if(toolTipObj){
			toolTipSTYLE = toolTipObj.style;
			toolTipSTYLE.visibility = "visible";
			toolTipSTYLE.display = "block";
		}
    }
    //-- NOTE this is now handled in drag_drop.js
	//-- document.onmousemove = moveToMouseLoc;
  }
}

function toolTip(imgObj, tableWidth, msg){
	
//alert('function toolTip msg='+msg);

//-- NOTE If tableWidth == 0 then the width will be determined by the contents of the msg.
//--      Ie Each line of text must end with '<br /> and the width of the twxt will determine the width of the window.

	var table_width = '';
	var td_wrap = '';
	
	if(isNaN(tableWidth)){
		tableWidth = 200;
	}
	
	if(tableWidth<0){
		tableWidth = 200;
	}
	
	if(tableWidth>0){
		table_width = 'width="'+tableWidth+'"';
	}else{
		td_wrap = 'nowrap="nowrap"';
	}
	
	if(toolTip.arguments.length < 1){ // hide
	
		if(ns4){
			toolTipSTYLE.visibility = "hidden";
		}else{
			toolTipSTYLE.display = "none";
		}
	}else{ // show
	
	msg = convert_pound(msg);

	var content =
	'<table '+table_width+' border="0" cellspacing="0" cellpadding="0" class="tooltip">' +
	  '<tr><td valign="bottom"><img id="divHeight" src="../_assets/images/1red" width="1" height="1" border="0" /></td><td '+td_wrap+'>'+
	  msg +
	  '</td><td valign="bottom"><img id="divHeightSpacer" src="../_assets/images/1red" width="1" height="1" border="0" /></td></tr>'+
	  '<tr><td height="1" colspan="3" align="right"><img id="divWidth" src="../_assets/images/1red" width="1" height="1" border="0" /></td>'+
	'</table>';
	
		if(ns4){
		  toolTipSTYLE.document.write(content);
		  toolTipSTYLE.document.close();
		  toolTipSTYLE.visibility = "visible";
		}else{
			var toolTipObj = MM_findObj('toolTipLayer');
			
//			if(!toolTipObj){
//				alert('The Tool Tip div tag is missing from your form.');
//			}else{
			if(toolTipObj){
				toolTipSTYLE.display='block';
				toolTipObj.innerHTML=content;
				
				var pos = get_image_position(imgObj, 'tips');
				
				//-------------------------------------------------------------------------------
				//-- If the cursor is inside the tool tip box then move the box.
				divSize = get_div_width_height();
				loop_buster = 0;
				var move_it = true;
				do{
					loop_buster++;
					if(loop_buster > 200){
						move_it = false;
					}
					
					var divendx = pos[1] + divSize.w + 12;
					var divstartx = pos[1] -4;
					var divendy = pos[0] + divSize.h + 12;
					var divstarty = pos[0] - 12;
					
					//-- If the cursor enters the tool tip box it will cause it to flash
					//-- on and off. To prevent this move the tool tip down.
					if(mousePos.x > divstartx && mousePos.x  < divendx){
						if(mousePos.y > divstarty && mousePos.y  < divendy){
							//alert('in the box '+mousePos.y+' '+pos[1]+' '+ divendy);
							pos[0] = pos[0] + 2;
							pos[1] = pos[1] + 2;
						}else{
							//alert('y= '+mousePos.y+' '+divstarty+' '+ divendy);
							move_it = false;
						}
					}
					
					//show_the_tooltip(pos[0], pos[1]);
					
				} while(move_it == true);
				//-------------------------------------------------------------------------------

				show_the_tooltip(pos[0], pos[1]);
			}
		}
	}
	
}

function windowSize(){
//-- Find the size of the window (including non visible portion if scrolling)
	
	if(typeof( window.innerWidth ) == 'number'){
		//Non-IE
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	}else{
		if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight)){
			//IE 6+ in 'standards compliant mode'
			winWidth = document.documentElement.clientWidth;
			winHeight = document.documentElement.clientHeight;
		}else{
			if(document.body && (document.body.clientWidth || document.body.clientHeight)){
				//IE 4 compatible
				winWidth = document.body.clientWidth;
				winHeight = document.body.clientHeight;
			}
		}
	}

	return [winWidth, winHeight];
  
}

function get_scroll_xy() {	
//-- Find out if and how much of the current window is not visible
//-- ie the window has scroll bars and a portion of the window is off screen.
	
	var scrollOffsetX = 0;
	var scrollOffsetY = 0;

	if( typeof( window.pageYOffset ) == 'number' ) {
		//-- Netscape compliant
		scrollOffsetY = window.pageYOffset;
		scrollOffsetX = window.pageXOffset;
	}else{
		if(document.body && ( document.body.scrollLeft || document.body.scrollTop)){
			//-- DOM compliant
			scrollOffsetY = document.body.scrollTop;
			scrollOffsetX = document.body.scrollLeft;
		}else{
			if(document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop)){
				//-- IE6 standards compliant mode
				scrollOffsetY = document.documentElement.scrollTop;
				scrollOffsetX = document.documentElement.scrollLeft;
			}
		}
	}
	
//alert("get_scroll_xy "+scrollOffsetX+' '+scrollOffsetY);
	
	scrollOffsetX=0;
	scrollOffsetY=0;
  
  return [scrollOffsetX, scrollOffsetY];
}

function get_image_position(imgObj, tips_or_notes){
	
	//alert('function get_image_position()');
	
	//-- Find the position on the screen of the tooltip image.
	
	if(ns4){
		//-- In Netscape 4 use the x and y properties of the image
		imgX = imgObj.x;
		imgY = imgObj.y;
	}else{
		//-- In IE and Netscape 6+ use the offsetLeft and offsetTop properties
		imgX = imgObj.offsetLeft;
		imgY = imgObj.offsetTop;
	}
	
//	imgX = imgObj.offsetLeft;
//	imgY = imgObj.offsetTop;
	
	bodyObj = document.getElementsByTagName('body');
	while(imgObj.offsetParent){
		if(imgObj==bodyObj){
		   break;
		}else{
			imgX=imgX+imgObj.offsetParent.offsetLeft;
			imgY=imgY+imgObj.offsetParent.offsetTop;
			imgObj=imgObj.offsetParent;
		}
	}
	
	//-- Find the height and width of the tooltip box
	//divWidth = tableWidth;
	
//alert(tips_or_notes);
	
	if(tips_or_notes=='tips'){
		divSize = get_div_width_height();
		divHeight = divSize.h;
		divWidth = divSize.w;
	}else{
		divHeight = 200;
		divWidth = 580;
	}

	
	divHeight = divHeight + 12;
	divWidth = divWidth + 12;

	//-- Get the total window size (including any that has scrolled off the screen)
	winSize = windowSize();
	
	//-- Get the portion of the window that is scrolled off the screen
	scrollxy = get_scroll_xy() ;
	scrollOffsetX = scrollxy[0];
	scrollOffsetY = scrollxy[1];
	
	topPos = imgY + offsetY;
	leftPos = imgX + offsetX;
	
//alert('divWidth='+divWidth+' winWidth='+winWidth);
	
	if((leftPos - scrollOffsetX + divWidth + 8) > winWidth){
		leftPos = winWidth - divWidth - offsetX;
	}
	
	if((leftPos + divWidth + 8) < imgX - offsetX){
		leftPos = imgX - divWidth - offsetX - 8;
	}
	
	if((topPos - scrollOffsetY + divHeight + 8) > winHeight){
		topPos = imgY - divHeight - offsetY - 8;
	}
	
/*tellMeObj=MM_findObj('tellMe');	
tellMeObj.innerHTML='topPos='+topPos+' imgY='+imgY+' divHeight='+divHeight+' offsetY='+offsetY+'<br />'+
                    'leftPos='+leftPos+' imgX='+imgX+' divWidth='+divWidth+' offsetX='+offsetX;*/

//alert('topPos='+topPos+' leftPos='+leftPos);

	//-- Dont want the tool tip to go behind the fixed top bar
	if(topPos < 41){
		topPos =  41;
	}

	return [topPos, leftPos];
	
}

function findPosX(obj){
	
    var curleft = 0;
    if(obj.offsetParent){
        while (1) {
			curleft+=obj.offsetLeft;
            if(!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    }else{
		if(obj.x){
			curleft+=obj.x;
		}
    }
    return curleft;
}

function findPosY(obj) {
	
    var curtop = 0;
    if(obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if(!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    }else{
		if(obj.y){
			curtop+=obj.y;
		}
	}
    return curtop;
}

function get_div_width_height(){
	
//alert('get_div_width_height');
	//-- Return the width and height of the tool-tip div.
	
	divHeightObj = MM_findObj('divHeight');
	if(divHeightObj){
		if(ns4){
			divHeight = divHeightObj.y;
		}else{
//alert('divHeightObj.offsetTop='+divHeightObj.offsetTop);
			divHeight = divHeightObj.offsetTop;
		}
	}else{
		alert("ERROR in 'get_div_width_height' no div height");
	}
	
	divWidthObj = MM_findObj('divWidth');
	if(divWidthObj){
		if(ns4){
//alert('divWidthObj.y='+divWidthObj.x);
			divWidth = divWidthObj.x;
		}else{
//alert('divWidthObj.offsetLeft='+divWidthObj.offsetLeft);
			divWidth = divWidthObj.offsetLeft;
		}
	}else{
		alert("ERROR in 'get_div_width_height' no div width");
	}

	return {h:divHeight, w:divWidth};
	
}



function show_the_tooltip(topPos, leftPos){
	
	//alert('function show_the_tooltip( topPos='+topPos+' leftPos='+leftPos+')');
	
	var isVisible = true;
	if(ns4){
		if(toolTipSTYLE.visibility == "hidden"){
			isVisible = false;
		}
	}else{
		if(toolTipSTYLE.display == "none"){
			isVisible = false;
		}
	}

	if(isVisible == true){	
		toolTipSTYLE.top = topPos+'px';
		toolTipSTYLE.left = leftPos+'px';
	}
		
}

// end hiding script from old browsers -->

