function ga_TrackEvents(vars) {
    gainfo(vars[0],vars[1],vars[2], vars[3]) ;
} 

function gainfo(category,action,label, number) {
    var pageTracker = _gat._getTracker("UA-2315330-2");
    var thisSlide="slide" + action;
    pageTracker._trackEvent(category, thisSlide, label, number);
}

sfHover = function() {
    if (document.getElementById("nav"))
    {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            className = this.className;
            this.className+=" sfhover";
            //alert (this.className);
            switchImage('topnav-' + className,'on');
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
            switchImage('topnav-' + this.className,'off');
        }
    }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


var imageWithPath = "/topnav-mediacenter-on.gif";
var start = imageWithPath.lastIndexOf("/");
var imgDir = imageWithPath .substring(0,start+1);
//document.write(imgDir);
//var imgDir = "/Structural_Images/";

function simplePreload()
{
    var args = simplePreload.arguments;
    document.imageArray = new Array(args.length);
    for(var i=0; i<args.length; i++)
    {
        document.imageArray[i] = new Image;
        document.imageArray[i].src = imgDir + args[i];
    }
}

function switchImage(imgName, onOff) {
    if (document.images) {
        try{
        if (onOff == "on") document.images[imgName].src = imgDir + imgName + "-on.gif";
        else document.images[imgName].src = imgDir + imgName + "-off.gif";
        }
        catch(err)
        {
        //alert(imgDir + imgName + "-on.gif");
        }
    }
}    
    
    
/* *************** FUNCTIONS FOR DHTML POPOVERS *********** */
function getOSName()
{
    var OSName="Unknown OS";
    if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
    if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
    if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
    if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
    return OSName;
}


function showSplash(suffix) 
{
    document.getElementById('overlaySplash' + suffix).style.visibility='visible';
    document.getElementById('overlaySplashinner' + suffix).style.visibility='visible';    
    document.getElementById('overlaySplash' + suffix).style.display='block';
    document.getElementById('overlaySplashinner' + suffix).style.display='block';
}

function hideSplash(suffix) 
{
    document.getElementById('overlaySplash' + suffix).style.visibility='hidden';
    document.getElementById('overlaySplashinner' + suffix).style.visibility='hidden';    
    document.getElementById('overlaySplash' + suffix).style.display='none';
    document.getElementById('overlaySplashinner' + suffix).style.display='none';
}
 

/* ******************* FUNCTIONS FOR SUPERNOTE REPLACEMENT ROLLOVERS ************ */

// pass in event e, prefix like 'supernote' or 'mydoc', id is a guid
function showNote(e, prefix, id) 
{
 if (document.getElementById(prefix + "-note-window" + id))
 {
    // swap html 
    var html = document.getElementById(prefix + "-note-window" + id).innerHTML;
    var main = document.getElementById(prefix + "-note-main");
    main.innerHTML = html;
    
    // reattach this element directly to the body so we can REALLY postion absolutely on screen
    document.body.appendChild(main);
    
    // find pos 
    x = mouseX(e);
    y = mouseY(e);
    /*
    // adjust for screen size
    var xadjust = 0;
    if(document.layers) {
        width = window.innerWidth;
        height = window.innerHeight;
    } else {
        width = document.body.clientWidth;
        height = document.body.clientHeight;
    } 
    
    
    var screenwidth = width;
    if (screenwidth > 1024)
    {
     xadjust = 1024 - screenwidth;
     //alert(xadjust);
    }
    */
    main.style.left = (x + 30) + 'px';
    main.style.top = (y + 10) + 'px';
    main.style.visibility = "visible";
 }
}

function hideNote(prefix)
{
    var main = document.getElementById(prefix + "-note-main");
    main.style.visibility = "";
}
 
// get mouse x position - pass in event
function mouseX(evt) {
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;
}
// get mouse y position - pass in event
function mouseY(evt) {
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;
}
