
function handleOutTool(elname) {
// hides all popups, parameter is the div name
// function called on onmouseout of hyperlink parameter

d = document.getElementById(elname) ;
d.style.left = "-650px";


}
function setLyrTool(obj1,lyr, whichobject, alignment)
{
	
    // control  popups
    /*
    parameters:
    obj1 - the element to reference location from, generally the hyperlink
    lyr - the DIV to position - the divs are positioned off the page to start, the html is at the top of each page for each div
    help - a flag for the help div
    
    requires the browser.js script for browser detection
    as well as findPosX and findPosY, which find the referenced object's position
     
     function is called on the on mouse over of the hyperlink element
    */
    
    if ( alignment == undefined ) {
      alignment = 'left';
    }

	obj = document.getElementById (obj1) ;
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	
	var x = document.getElementById(lyr);
	
	// get the width of the screen
	var winWidth = (typeof(window.innerWidth) != 'undefined') ? window.innerWidth + self.pageXOffset - 20 : document.documentElement.clientWidth + document.documentElement.scrollLeft;
	// get the top
	var winTop =  document.documentElement.scrollTop;
    
    // variables for final resting place
    var finY ;
    var finX ;
    // change final resting places based on whether working with the top popup or bottom (help) popup
	// adjust finY and finX for tooltip placement on rollover ***********************
   
   
   var Xoffset = 0;
   if (alignment == 'right')
   {
        Xoffset = -400;
   }
   
	var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
   
	// set the default x
	if (whichobject == "drivers50")
	{
	finX = (newX - 150 + Xoffset) ;
	 finY = (newY + 25) ;  
	 
	}
	else if (whichobject == "drivers50sidebar")
	{
	finX = (newX - 200 + Xoffset) ;
	 finY = (newY + 55) ;  

	}	
	else if (whichobject == "quoteform")
	{
	finX = (newX + 115 + Xoffset) ;
	 finY = (newY -65) ;  
	}
	else if (whichobject == "quoteformdrivers50")
	{
	finX = (newX + 110 + Xoffset) ;
	 finY = (newY - 95) ;  
   	 	if ((isIE6)  && (alignment != 'right'))
   	 	{
   	 		finX = finX + 60;
   	 	}
	}
	else
	{
	finX = (newX - 135 + Xoffset) ;
	finY = (newY + 25) ; 
	}
	
	// Safari section
	if (BrowserDetect.browser == "Safari")
	{
	    //safari uses the below property for getting the distance to the top of the page
	   winTop = self.pageYOffset ;
	   
	}
            
            if ( (whichobject == "drivers50") || (whichobject == "quoteform") || (whichobject == "quoteformdrivers50") )
            {
                if (winTop > 200)
                {
                finY = (newY + 20) ; 
                }
            }
            else
            { // push further to left in small window
            
             if (winWidth < 960) // flip to the other side
	         {
                finX = (newX -250 + Xoffset) ;
            
	            }          
             
            }
           
         
	 
         
		
	//set final position
	 x.style.top =  finY + 'px';
	 x.style.left = finX + 'px';

}
