/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 Wednesday, January 16, 2008 2:01:49 PM
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */
 var t;
 var e;
 var delayid;
 
    function hidetip(id)
    {
      if (id==null) id=""
      document.getElementById("tooltip"+id).style.display = "none"
      if (document.getElementById("iframe_"+id)) {
          document.getElementById("iframe_"+id).style.display = "none"
          document.getElementById("iframe_"+id+"_tip").style.display = "none"
          }
      clearTimeout(t);
    }  
 
    function showtip(tipwindow,message,id,delayms)
    {
      var posx=0,posy=0;
      var topgif="";
      var bottomgif="";
      var sety=-1;
      var iftop=0, ifheight=0, ifloc=0;
 
      var flatbottom="/images/tip-bottom.gif";
      var flattop="/images/tip-top.gif";
      var thisimage="";
      var delaydisplay;
 
      if (id==null) id=""
 
      if (delayms==null) {
            delaydisplay="block"
        } else {
            delaydisplay="none"
        }
 
      if (message=="")
            {
            message = document.getElementById("tip_parent"+id).innerHTML
            }
 

      if (!tipwindow && window.event)
        {
          tipwindow = window.event;
        }
 
      if(tipwindow.pageX || tipwindow.pageY)
        {
          posx=tipwindow.pageX; posy=tipwindow.pageY;
        }
      else 
        if(tipwindow.clientX || tipwindow.clientY)
          {
            if(document.documentElement.scrollTop)
              {
                posx = tipwindow.clientX + document.documentElement.scrollLeft;
                posy = tipwindow.clientY + document.documentElement.scrollTop;
              }
            else
              {
                posx = tipwindow.clientX + document.body.scrollLeft;
                posy = tipwindow.clientY + document.body.scrollTop;
              }
          }
      
 
        document.getElementById("tip_parent"+id).innerHTML = message
        if (message==undefined) {
            document.getElementById("tooltip"+id).style.display="none"
        } else {
            document.getElementById("tooltip"+id).style.display="block" //delaydisplay //
        }
 

      var divh=document.getElementById("tooltip"+id).offsetHeight
      var divw=document.getElementById("tooltip"+id).offsetWidth
 
      //alert (document.images["tip-bottom"+id].src);
      // Adjust the Div Height In Case we are flat bottom top and flat bottom bottom
      if (document.images["tip-bottom"+id].src.indexOf(flatbottom)>=0) {
            if (document.images["tip-top"+id].src.indexOf(flattop)>=0) {
                divh += 19;
            }
       }
 
      if (divh+10<tipwindow.clientY) {  //if the height of the tooltip is less then the cursor, we should fit above
          //position the tool tip above the desired position
          sety = posy-divh-10
 
          if (sety<0) alert(sety+"\n"+divh+"\n"+tipwindow.clientY)
 
          topgif=flattop;
          iftop=12;
          ifheight=30;
 
          //The bottom right and left pointer gifs are 29 pixels in height
          //The flat bottom gif is 11 pixels in height
          // if the sety is within 18 pixels of the top, we could end up with the image flopping back and forth
 
          if (posx+divw+10>pageWidth()) {
                bottomgif="/images/tip-bottom-right.gif";
                var setx=posx-divw-10;
          } else {
                bottomgif="/images/tip-bottom-left.gif";
                var setx=posx+10;
          }
 
          ifloc=sety+divh-ifheight;
 
      } else {
          //position the tool tip below the desired position
 
          bottomgif=flatbottom;
          iftop=29;
          ifheight=12;
 
          var right="-right"
          var left="-left"
          sety=posy;
 
          //alert(sety+divh);
 
          //document.body.offsetHeight
          //document.body.clientHeight
          //pageHeight()
 
          if (sety+divh >visibleHeight()) {
                //sety=visibleHeight()-divh-10
                sety=document.body.scrollTop+10
                right=""
                left=""
          } else {
                sety=posy+10
          }
          if (posx+divw+10>pageWidth()) {
              topgif="/images/tip-top"+right+".gif";
              var setx=posx-divw-10;
          } else {
              topgif="/images/tip-top"+left+".gif";
              var setx=posx+10;
          }
          ifloc=sety+iftop-ifheight;
      }
 
      if (sety<0) {//This would indicate that the size of the window could not fit above or below the element
            sety=(pageHeight()-divh)/2
            topgif=flattop
            bottomgif=flatbottom
            //var setx=0;
            iftop=12;
            ifloc=sety+iftop;
        }
      document.getElementById("tooltip"+id).style.top=(sety)+"px";
      document.getElementById("tooltip"+id).style.left=(setx)+"px";
 
      if (document.images["tip-top"+id].src.indexOf(topgif)==-1) {
        document.images["tip-top"+id].src=topgif
        }
 
      if (document.images["tip-bottom"+id].src.indexOf(bottomgif)==-1) {
        document.images["tip-bottom"+id].src=bottomgif
        }
 
      //The iframe_ element is only present on browers that don't support DropDownList Zindex like ie6
      if (document.getElementById("iframe_"+id)) {
          document.getElementById("iframe_"+id).style.display=document.getElementById("tooltip"+id).style.display
          document.getElementById("iframe_"+id).style.top=(sety+iftop)+"px";
          document.getElementById("iframe_"+id).style.left=document.getElementById("tooltip"+id).style.left
          if (divh-iftop-ifheight>0) {
              document.getElementById("iframe_"+id).style.height=(divh-iftop-ifheight)+"px"
          } else {
              document.getElementById("iframe_"+id).style.height="0px"
          }
          document.getElementById("iframe_"+id).style.width=divw+"px"
 
          document.getElementById("iframe_"+id+"_tip").style.display=document.getElementById("tooltip"+id).style.display
          document.getElementById("iframe_"+id+"_tip").style.top=ifloc+"px"
          document.getElementById("iframe_"+id+"_tip").style.left=(setx+8)+"px"
          document.getElementById("iframe_"+id+"_tip").style.height="12px"
          document.getElementById("iframe_"+id+"_tip").style.width=(divw-16)+"px"
          }
 
    //document.getElementById("tip_parent"+id).innerHTML = message+"<br>Sety: "+sety+"  Client Y: "+tipwindow.clientY+" Divh: "+divh+" Scroll: "+document.body.scrollTop;
    //document.getElementById("tooltip"+id).style.top="10px";
    //document.getElementById("tooltip"+id).style.left="10px";
        if (delayms) {
            delayid=id
            document.getElementById("tooltip"+delayid).style.display="none"
            t=setTimeout('showblock()',delayms)
            }
          //The iframe_ element is only present on browers that don't support DropDownList Zindex like ie6
          if (document.getElementById("iframe_"+delayid)) {
              document.getElementById("iframe_"+delayid).style.display=document.getElementById("tooltip"+delayid).style.display
              document.getElementById("iframe_"+delayid+"_tip").style.display=document.getElementById("tooltip"+delayid).style.display
              }
    }
 
    function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;}
    function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
    function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;}
    function posTop() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}
//        })
 
    function showblock() {
         document.getElementById("tooltip"+delayid).style.display="block"
    }
 
    function visibleHeight() {
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        //myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        //myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        //myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        return myHeight;
      }
      //window.alert( 'Width = ' + myWidth );
      //window.alert( 'Height = ' + myHeight );
    }
 

