ActiveTipVar = 0; // Sets up the variable that counts the pictures.
var ActiveTipArray = new Array(); // Sets up the active array.
for (loop=0; loop < TipVar; loop++) {
  ActiveTipArray[ActiveTipVar++] = new FixTip(TipArray[loop].TipIDVal, TipArray[loop].TipTxtVal);
}
	function customToolTip(target, e, itemTip)
		{
			//itemTip is the ID of the tip to display eg: PET1
			tipBefore='<table width=200 border="1" cellspacing="0" cellpadding="5" bgcolor="AACCFF" bordercolor="#000000"><tr><td><ilayer id="tt2" class="tooltip">';
            tipAfter='</ilayer></td></tr></table>';
			//PET = Pet Obedience Classes
			//ABD = Additional Breeding Decision
			//PEM = Pre-Breeding Exam and Medical
			//PIM = Pre-Breeding Insemination Method
			//PBE = Post Breeding Expenses
			//WE = Whelping Expenses
			//PWE = Post Whelping Expenses
			//APE = Additional Puppy Expenses
			//MIS = Miscelleneous Expenses
			//OPE = Other possible Expenses   case "a": case "b":
			//alert ("theTip = " + theTip);  //For Testing
			var theTip = FindTip(itemTip);  //THis retrieves the actual Tip Text for the item.
			
			if(e==null) {
				e = window.event;
			}
                  cH= window.innerHeight;
                  cW= window.innerWidth;
                  cX= e.pageX;
                  cY= e.pageY;
                  sL= window.pageXOffset;
                  sT= window.pageYOffset;
						
			var myTip = document.createElement('div');
			myTip.style.backgroundColor = 'blue';
			myTip.style.color = 'white';
			myTip.style.padding = '2px';
			myTip.style.width= '200px';
			myTip.style.position='absolute';
			myTip.style.zIndex='5';
			//myTip.style.top= (e.pageY ? e.pageY : e.clientY)+'px';
			//myTip.style.left=(e.pageX ? e.pageX : e.clientX)+'px';
			if(cX+sL>cW/2)
                myTip.left=cX+sL-210;
            else
                myTip.left=cX+sL+10;

            if(cY+sT>cH/2)
                myTip.style.Top=cY+sT-40;
            else
                myTip.style.Top=cY+sT+10;
			// myTip.style.Top = (target.offsetTop - 80)+'px';
            // myTip.style.left = target.offsetWidth/2 + 'px';
			myTip.setAttribute('id', 'myToolTip');
			//myTip.innerHTML = theTip;
            myTip.innerHTML=tipBefore+theTip+tipAfter;
			target.appendChild(myTip);
		}

	function hideToolTip(target)
	{
		try
		{
		var myTool = document.getElementById('myToolTip');
		target.removeChild(myTool);
		}
		catch(err){}
	}
	
	function FindTip(itemTip) { // Searches for the correct ToolTip.
	  //itemTip is the ID of the tip to be displayed eg: BBD1
	  TotalFound = 0;
	  SearchString = itemTip;
	  for (loop=0; loop < TipVar ; loop++) {
		TipID = ActiveTipArray[loop].TipIDVal;
		TipDesc = ActiveTipArray[loop].TipTxtVal;
		SearchResult = TipID.indexOf(SearchString);
		if (SearchResult != "-1") {
		  //WHen tip is found break out of loop and return the TipDesc value of the TipID.
		  if (TipID == SearchString) {
		  	return TipDesc;
		  }
		//} else {
		//	TipDesc = "Sorry there is No Additional Information on this item.";
		//	return TipDesc;
		}
	  }
	}
	
