
// Due to different browser naming of certain key global variables, 
//we need to do three different tests to determine their values

// Global set timeout ID
var tss = 0;

function setOpacity(value, popUpID) 
{
    // First check to see which browser the user
    // is using and adjust the syle accordingly for the opacity.
    var browserName=navigator.appName; 
    if (browserName=="Netscape" || browserName=="Opera")
    { 
        // For our netscape, firefox, and safari users
        document.getElementById(popUpID).style.opacity = value / 10;
        //document.getElementById(popUpID).style.filter = 'alpha(opacity=' + value * 10 + ')';
    }
    else 
    { 
       if (browserName=="Microsoft Internet Explorer")
        {
            // For our IE users...
            document.getElementById(popUpID).style.filter = 'alpha(opacity=' + value * 10 + ')';
        }
        else
        {
            // I have no idea what you are using.
            document.getElementById(popUpID).style.opacity = value / 10;
        }
    }     
       
    //document.getElementById(popUpID).style.opacity = value / 10;
    //document.getElementById(popUpID).style.filter = 'alpha(opacity=' + value * 10 + ')';
    //document.getElementById(popUpID).style.MozOpacity = value / 100;
 
}

function fadeInMyPopup(popUpID) 
{
    // Set the speed, lower = faster fade, etc.
    var fadeSpeed = 6;
    
    // Clear the timeout...
    clearTimeout(tss);
    
    // Start a loop to show the popup.
    for( var i = 0 ; i <= 100 ; i++ )
    {
        setTimeout( 'setOpacity(' + (i / 10) + ', ' + popUpID + ')' , fadeSpeed * i );   
    }
}

function fadeOutMyPopup(popUpID) 
{
    if (document.getElementById(popUpID))    
    {
        // Set the speed, lower = faster fade, etc.
        var fadeSpeed = 5;
        
        //document.getElementById(popUpID).style.visibility = "hidden";
        //document.getElementById(popUpID).style.display = "none";
        
            
        // Start a looop to hide the popup.
        for( var i = 0 ; i <= 100 ; i++ ) 
        {
            setTimeout( 'setOpacity(' + (10 - i / 10) + ', ' + popUpID + ')' , fadeSpeed * i );
        } 
        
        // Now move the popup.
        tss = setTimeout('hideMyPopup(' + popUpID + ')', 1000);
    }
    else
    {
        document.getElementById(popUpID).style.display = "none";
    }   
}

function hideMyPopup(popUpID)
{
    // Set the display to none so we will no longer see the popup.    
    document.getElementById(popUpID).style.display = "none";
}

function closeMyPopup() {
 //document.getElementById("map").style.display = "none"
 
 var browserName=navigator.appName; 
if (browserName=="Netscape")
{ 
 alert("Hi Netscape User!");
}
else 
{ 
 if (browserName=="Microsoft Internet Explorer")
 {
  alert("Hi, Explorer User!");
 }
 else
  {
    alert("What ARE you browsing with here? " + browserName);
   }
}

}

function fireMyPopup(e, popUpID) {    
    // Variable Declarations
    // We want to find out where the cursor position is.
    // We will slightly offset the position a little so the popups
    // generally show up centered and below the cursor.
    if (document.getElementById(popUpID))
    {
        var leftOffset = mouseX(e) - 10;
        var topOffset = mouseY(e) + 10;
            
        // Show the popup.
        document.getElementById(popUpID).style.top = topOffset + "px";
        document.getElementById(popUpID).style.left = leftOffset + "px";
        document.getElementById(popUpID).style.display = "block";
        fadeInMyPopup(popUpID);
    }
}

function mouseX(evt) 
{
    // Grab the cursor x position.
    if (evt.pageX) return evt.pageX;
    else if (evt.clientX)
        return evt.clientX + (document.documentElement.scrollLeft ?
        document.documentElement.scrollLeft :
        document.body.scrollLeft);
    else return null;
}
function mouseY(evt) 
{
    // Grab the cursor y position.
    if (evt.pageY) return evt.pageY;
    else if (evt.clientY)
        return evt.clientY + (document.documentElement.scrollTop ?
        document.documentElement.scrollTop :
        document.body.scrollTop);
    else return null;
}








