

//drop down menu function
function GoUrl(s)
{       var d = s.options[s.selectedIndex].value
        window.top.location.href = d
        s.selectedIndex=0
}


//preload nav rollovers
for(q=0;q<10;q++)
{
eval("n"+q+"On = new Image()")
eval("n"+q+"On.src = '/menu/nav"+q+"_on.gif'")
eval("n"+q+"Off = new Image()")
eval("n"+q+"Off.src = '/menu/nav"+q+".gif'")
}

//rollover function
        function roll(sec,num,state,layer)
{
if (layer=="") eval("document.images['"+ sec + num + "'].src =" + sec + num + state + ".src;");
else 
 {
  if (document.all) eval("document.images['"+ sec + num + "'].src =" + sec + num + state + ".src;");
  if (document.layers)  eval("document.layers."+layer+".document.images['" + sec + num + "'].src = " + sec + num + state + ".src;");
  if (!document.all && document.getElementById) eval("document.getElementById('" + sec + num + "').src = " + sec + num + state + ".src;");
 }
}

//set up layer call
var isIE, isNS, isNS6, isDOM, lR, sR, vis, invis, myTimeOut, goName;
        if (document.all) {isIE= true;lR="document.all.";sR=".style";vis="visible";invis="hidden";}
        if (document.layers){isNS = true;lR="document.layers.";sR="";vis="show";invis="hide";}
        if (document.getElementById &&!isIE) {isDOM=true;lR = "document.getElementById('";sR = "').style";invis ="hidden";vis = "visible"}
        if (isDOM == true && navigator.appName =="Netscape") isNS6 = true;
        
var oldwhich = 0;
var x=0;
var layerTimer;
        
//turn on layer and rollover
        function layOver(which)
        {
        x=0;
        l = eval(lR + "l" + which + sR);
        eval("roll('n',"+which+",'On','lN')")
        if (oldwhich != which)
        {
                ol = eval(lR + "l" + oldwhich + sR);
                eval("roll('n',"+oldwhich+",'Off','lN')")
                ol.visibility = invis;
        }
        l.visibility = vis;
        oldwhich = which;
        clearTimeout(layerTimer);
        return;
        }
        
//turn off layer and rollover if user is completely off nav 
        function stopOver()
        {
                if (x<5) x++;
                else
                {
                ol = eval(lR + "l" + oldwhich + sR);
                ol.visibility = invis;
                eval("roll('n',"+oldwhich+",'Off','lN')")
                x=0;
                }
        layerTimer = setTimeout("stopOver()",150)
        }
        
//reset the timer
        function startOver()
        {
        x=0
        clearTimeout(layerTimer);
        }
        
//change subnav background color (ie5+ ns6+)
        function changebg(item, color)
{
        if (document.getElementById)
        {
        theone = eval("document.getElementById('"+item+"')")
        theone.style.background = color
        }       

}


//netscape resize bug fix
function NSresize() {
  if (document.FIX.NSfix.initWindowWidth != window.innerWidth || document.FIX.NSfix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function NSCheck() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.FIX == 'undefined'){
      document.FIX = new Object;
    }
    if (typeof document.FIX.FIX_scaleFont == 'undefined') {
      document.FIX.NSfix = new Object;
      document.FIX.NSfix.initWindowWidth = window.innerWidth;
      document.FIX.NSfix.initWindowHeight = window.innerHeight;
    }
    window.onresize = NSresize;
  }
}

NSCheck()

//load promo layers/rollovers after the rest of the page

function postLoad()
{
big1On = new Image();
big1On.src = "promos/bigpic_on.gif"
big1Off = new Image();
big1Off.src = "promos/bigpic.gif"

        for(q=0;q<4;q++)
        {
        eval("sm"+q+"On = new Image()")
        eval("sm"+q+"On.src = 'promos/smallpic"+q+"_on.gif'")
        eval("sm"+q+"Off = new Image()")
        eval("sm"+q+"Off.src = 'promos/smallpic"+q+".gif'")
        }
        
        for(q=1;q<6;q++)
        {
        l = eval(lR+"p"+q+sR)
        l.visibility = vis
        }
        
        textAnimate()
}


var goTimer = 0;
var goNum = 1;
var animLayerCount = 5;
var pauseCount = 100;

function setUp()
        {
                for (i=1; i < animLayerCount; i++){
                layer = eval(lR + "z" + i + sR);
                if (isIE) layer.pixelLeft = -320;
                else layer.left = -320;
                layer.visibility = vis;
                }
        }
        
var timer;


function moveIt(whichLayer, toWhere, speed)
{
layer = eval(lR + whichLayer + sR);

if (isIE) theleft = parseInt(layer.pixelLeft)
else theleft = parseInt(layer.left)

// calculate the distance remaining
rDistance = toWhere - theleft;
// set the speed to a fraction of the remaining distance
speed = rDistance * .05;
// create a pocket buffer just a short distance before destination
toWhereBuffer = toWhere - 6;
// if object has not reached the buffer zone
if ( theleft <= 152) 
{
        if(isIE) layer.pixelLeft = parseInt(layer.pixelLeft) + speed
        else layer.left = parseInt(layer.left) + speed
}
else
{
        // if object has reached buffer zone, set object to destination
        return;
}
//loop
harold = "\"moveIt('" + whichLayer + "', 172, 2)\"";
eval ("timer= setTimeout(" + harold + ", 1)")

}

function textAnimate (){
        if (goNum >= animLayerCount){
        clearTimeout (myTimeOut);
        return;
        } else {
        goName = "z" + goNum;
        moveIt(goName, 152, 2);
        pauseCount=pauseCount+300;
        
        
        if (goName=="z3") pauseCount = 300
        goNum++;
        }
        myTimeOut = setTimeout("textAnimate()", pauseCount);
}


function pickBrowser()
{
if (isIE) moveLayers()
else {location.reload()}
}       

var width
function moveLayers()
{
if (isNS || isNS6) width= window.innerWidth
if (isIE) width= document.body.clientWidth

        for (q=1;q<6;q++)
        {
        l = eval(lR + "p" +q+ sR);
        if (q > 1) lOld = eval(lR + "p" + (q-1) + sR)
                if(width > 745)
                {
                        if (q==1)
                        {
                                if (isIE) l.pixelLeft = width-267
                                else if (isNS6)l.left = width-267
                                else l.left = width-282
                        }
                        if (q>2)
                        {
                        if(isIE || isNS6) end = width - 5 
                        else end = width-20
                        start = 312
                        middle = end-start
                                if(isIE) l.pixelLeft = parseInt(lOld.pixelLeft) + middle/3
                                else l.left = parseInt(lOld.left) + middle/3 
                        }
                }
                else if (width <745)
                {
                        if (q==1)
                        {
                        if(isIE) l.pixelLeft = 476
                        else l.left = 476
                        }
                        if (q>2)
                        {
                        if(isIE) l.pixelLeft = parseInt(lOld.pixelLeft) + 142
                        else l.left = parseInt(lOld.left) + 142
                        }
                }
        }
}
        


