// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults



//Check if we're in IE 6
var agt       = navigator.userAgent.toLowerCase();
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie6    = (is_ie && agt.indexOf("msie 6.")!=-1 );    


// Activate background image caching on IE6 to prevent image flicker
if (is_ie6) {
  document.execCommand('BackgroundImageCache', false, true);
}

function dropDown(){
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("first_level_nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover=function() {
          this.className+=" over";
        }
        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
        }
      }
    }
  }
}

function slideSwitch() {
  try {
    last_active = $$('#flash_header img.last_active').first()
    if (last_active){
      last_active.removeClassName('last_active')
    }
    var active = $$('#flash_header img.active').first()
    var next = (active.next() == null) ? $$('#flash_header img').first() : active.next()
    next.hide()
    active.addClassName('last_active')
    active.removeClassName('active')
    next.addClassName('active')
    new Effect.Appear(next, {duration: 3.0})
  }catch(e){}
}

window.onload = function(){
  dropDown();
  setInterval("slideSwitch()", 6000)
}