//This js file handles the extranet/intranet navigation for internal users
var slidemenu_width='1025px';
var slidemenu_top='0px';
var rightboundary=(parseInt(slidemenu_width));
var leftboundary=0;
var themenu;
var themenuEXT;

function topChannelNavResize() {
   document.all.menucontainer.style.height = document.all.slidemenubar.offsetHeight;
}
function resizeTopNav() {
    rightboundary=!browser.ns4 ? document.all.menucontainer.offsetWidth : document.all.menucontainer.clip.width;
   if (browser.ns4) {
      var sliderEXT = document.all.slidemenubarEXT;
      var slider = document.all.slidemenubar;
      var height = sliderEXT.clip.height;
      if (slider != null)
         if (height < slider.clip.height) {
            height = slider.clip.height;
            sliderEXT.clip.height = height;
         } else {
            slider.clip.height = height;
         }
      document.all.x.clip.bottom = height;
   } else {
      var x = document.all.menucontainer;
      var sliderEXT = document.all.slidemenubarEXT;
      var slider = document.all.slidemenubar;
      var height = sliderEXT.offsetHeight;
      if (slider != null)
         if (height < slider.offsetHeight) {
            height = slider.offsetHeight;
            sliderEXT.style.height = height;
         } else {
            slider.style.height = height;
         }
      x.style.height = height;
   }
}
function buildSlider() {
    //resieTopNav is called in checkWidth which is called onLoad and resize
    //window.onload = resizeTopNav;
    //window.onresize = resizeTopNav;
    document.all.topChannelNav.onresize=topChannelNavResize;
    themenu=document.all.slidemenubar.style;
    themenuEXT=document.all.slidemenubarEXT.style;
}

function pull() {
   resizeTopNav();
themenu.left=0;
themenuEXT.left=-rightboundary;
themenuEXT.visibility='visible';
    if (window.drawit)
        clearInterval(drawit);
    pullit=setInterval("pullengine()",10);
    if(pullit == 0 ){
     	clearInterval(pullit);
	pullit=setInterval("pullengine()",10);
    }

}
function draw(){
   resizeTopNav();
themenu.left=rightboundary;
themenuEXT.left=0;
themenu.visibility='visible';
    if (window.pullit)
        clearInterval(pullit);
    drawit=setInterval("drawengine()",10);
    if(drawit == 0 ){
     	clearInterval(drawit);
     	drawit=setInterval("drawengine()",10);
    }
}
function pullengine(){

   var pos = parseInt(themenu.left)+15;
    if (pos<rightboundary) {
        themenu.left=pos+"px";
        themenuEXT.left=(parseInt(themenuEXT.left)+15)+"px";
    }
    else if (window.pullit) {
        clearInterval(pullit);
        themenu.left=rightboundary;
        themenuEXT.left=leftboundary;
        themenu.visibility='hidden';
    }
}
function drawengine() {
   var pos = parseInt(themenu.left)-15;
    if (pos>leftboundary) {
        themenu.left=pos+"px";
        themenuEXT.left=(parseInt(themenuEXT.left)-15)+"px";
    }
    else if (window.drawit) {
        clearInterval(drawit);
        themenu.left=leftboundary;
        themenuEXT.left=rightboundary;//parseInt(themenuEXT.width)*-1;
        themenuEXT.visibility='hidden';
    }
}

