
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1)? true : false;

/* begin - for top navigation drop down */

var t ; 
var g_SELECT = "";   // string containing select boxes on a form

 function turnOn(dname) {
    clearTimeout(t);
    document.getElementById(dname).style.visibility = 'visible';
    hideSelect();
  }

 function turnOff(dname) {
    unhideSelect();
    document.getElementById(dname).style.visibility = 'hidden';
}

 function turnOff_d(dname,tx) {
    t = setTimeout("turnOff('" + dname + "')",tx);
}

function findSelect() {
  if (document.forms.length > 0) {
    var t =  document.forms[0]
    for (var j=0; j < t.length; j++) {
        if (t.elements[j].type=="select-one" || t.elements[j].type=="select-multiple") {
             if(t.elements[j].id != "quickLinks")
                    g_SELECT += j + "|"
        }
    }
  }
}


/* For hiding select boxes so the top navigation does not 
   appear below the box (only for IE6) */

function hideSelect() {
  // lets roll thru the form to look for the form-select type 
  //window.status = document.forms[0].elements.length
  if (g_SELECT=="") { findSelect() }
      // do the hiding here
      if (g_SELECT!="") {
          var temp = g_SELECT.split("|")
          var t = document.forms[0]
          for(var j=0; j < temp.length-1; j++) {
             t.elements[temp[j]].style.visibility="hidden";
          }
      }
}

function unhideSelect() {
   if (g_SELECT!="") {
      var temp = g_SELECT.split("|")
      var t = document.forms[0]
       for(var j=0; j < temp.length-1; j++) {
           t.elements[temp[j]].style.visibility="visible";
       }
   }
}

/* end - for top navigation drop down */



/* Start - specific to only Home and Station Finder page */
function switchClass(idx,cls) {
  document.getElementById(idx).className = cls
}

function animateFinder() {
   var t  = setTimeout("switchClass('stationFinder','stationFinderLrg')",750);   
   t = setTimeout("switchClass('stationFinder','stationFinderSml')",1500);
}

 // window.onload = animateFinder;
/* End - specific to only Home and Station Finder page */

window.onload = function() {		
   setSideMenus();
   getDivPosition();
   getCarInCorner();
}  // done w/ windows.onload


function getDivPosition() {
  // get main container offsetTop number
  //window.status = "footer ends at: " + document.getElementById("footer").offsetTop
  
}

function getCarInCorner() {
    var t2 = (document.getElementById("footer")) ? document.getElementById("footer").offsetTop : 0;
    if (t2 == 0) {
        // exception check for homepage where ID is different
        t2 = (document.getElementById("footerHome")) ? document.getElementById("footerHome").offsetTop : 0;
        t2 += 7;
    }
  if (document.getElementById("carInCorner")) {
    var t = document.getElementById("carInCorner")

     if (isIE) {
      var tp3 = parseInt(t2-206);  
       t.style.top = tp3 
       t.style.visibility = "visible";              
     } else {       
      var tp3 = parseInt(t2-206);       
      var temp3 =  "position:absolute;left:769px;top:" + tp3 + "px;visibility:visible;"
      t.setAttribute("style",temp3)
     }   // isIE check
     if (document.getElementById("rightColContent")) {  document.getElementById("rightColContent").appendChild(t) }
      
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function openNewWindow(e) {
  var features = '';
  var start;
  var end;
  var width;
  var height;
  var thisurl = this.href;
  width = parseInt(getDimensionFrom(this, 'w'))>0 ? getDimensionFrom(this, 'w') : '';
  height = parseInt(getDimensionFrom(this, 'h'))>0 ? getDimensionFrom(this, 'h') : '';
  if (height.length>0 || width.length>0) {
    features += height.length>0 ? 'height='+height+',' : '';
    features += width.length>0 ? 'width='+width+',' : '';
    features += (thisurl.indexOf("help.aspx") > 0) ? 'scrollbars=yes,' : '';
  }
  features += getFeatures(this);
   
  if (!e) var e = window.event;
  if (features.length>0) {
    if (features.substr(features.length-1,1) == ",")
      features = features.substr(0, features.length-1);
    window.open(this.href, '_new', features);
  } else {
    window.open(this.href);
  }
  return false;
}

function getDimensionFrom(obj, attrib) {
  if (obj.className.indexOf(" "+attrib) != -1) {
    start = obj.className.indexOf(" "+attrib) + 1
    end = obj.className.indexOf(" ", start);
    end = (end == -1) ? obj.className.length - start : end - start;
    return obj.className.substr(start+1, end-1);
  } else {
    return "";
  }
}

function getFeatures(obj) {
  var features = "";
  if (obj.className.indexOf(" scrollNo") != -1) { features += "scrollbars=no,"; } else { features += "scrollbars=yes,"; }
  if (obj.className.indexOf(" locationNo") != -1) { features += "location=no,"; } else { features += "location=yes,"; }
  if (obj.className.indexOf(" historyNo") != -1) { features += "history=no,"; } else { features += "history=yes,"; }
  if (obj.className.indexOf(" toolbarNo") != -1) { features += "toolbar=no,"; } else { features += "toolbar=yes,"; }
  if (obj.className.indexOf(" menuNo") != -1) { features += "menubar=no,"; } else { features += "menubar=yes,"; }
  if (obj.className.indexOf(" resizeNo") != -1) { features += "resizable=no"; } else { features += "resizable=yes"; }
  return features;
}


function GetAnchors() {
  var elements = new Array('a', 'area');
  for (var j=0; j < elements.length; j++) {
    var x = document.getElementsByTagName(elements[j]);
	  for (var i=0;i<x.length;i++) {
	    if (x[i].className.indexOf('newWin') != -1) {
			  x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "New Window");
		  } else if (x[i].className.indexOf('popup') != -1) {
			  x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "Pop-up Window");
		 } else if (x[i].className.indexOf('word') != -1) {
			  x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "Word Document");
		} else if (x[i].className.indexOf('ppt') != -1) {
			  x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "PowerPoint Document");
		  } else if (x[i].className.indexOf('pdf') != -1) {
			  x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "Adobe PDF Document");
		  } else if (x[i].className.indexOf('printPage') != -1) {
			  x[i].onkeypress = printPage;
			  x[i].onclick = printPage;
			  x[i].setAttribute("title", "Print Page");
		  } else if (x[i].className.indexOf('external') != -1) {
		    x[i].onkeypress = openNewWindow;
			  x[i].onclick = openNewWindow;
			  x[i].setAttribute("title", "External link");
		  } else if (x[i].className.indexOf('internal') != -1) {
			  x[i].setAttribute("title", "Internal link");
		  }
	  }  
  }
}

function printPage() {
window.print();
}

addLoadEvent(GetAnchors);

  function checkCharLeft(inputTextArea,maxChar,divName) {    
    var v = inputTextArea.value;    
    var t = v.length;
    var x = parseInt(maxChar  -  t);  
     if (x < 0) { 
        x = 0;
       inputTextArea.value = v.substring(0,maxChar);
     }
      document.getElementById(divName).innerHTML = "<strong>" + x + " characters remaining</strong>";
}

  function checkGlobalBoxes(initValue) {
    var retVal = escape(initValue);
    retVal = retVal.replace(/%3C/g," ");
    retVal = retVal.replace(/%3E/g," ");
    retVal = retVal.replace(/%3D/g," ");
    retVal = retVal.replace(/%5C/g,"");
	  return unescape(retVal);
  }
  		 