/********************menu sliding**************************/

function SEP(){
  this.xpos = null;
  this.SSpeed = 1;
  this.DEF = DEF;
  this.DEF.CR = this.CR;
  this.incr = 10;
  this.stim = false;
  this.ftim = false;
  this.dlay = 750;
  this.CR = {
  xpos:this.xpos,
  pot:this.pot,
  DEF:this.DEF,
  foc_top:this.foc_top,
  items:this.items,
  oarray:this.oarray,
  buttons:this.buttons,
  SSpeed:this.SSpeed,
  incr:this.incr,
  ftim:this.ftim,
  stim:this.stim,
  dlay:this.dlay,
           FD:function(T){
              if(typeof(T) == "object"){
              var id = T.id;
              id = Number(id.slice(1,id.length));
              link[0] = "li";
              link[1] = id;
              }
              else{
                var id = T;
              }
              window.clearTimeout(ftim);
                 ftim = false;
              //ftim = window.setTimeout('hell.CR.Find_Top()',1000)
              ftim = window.setTimeout('hell.CR.REGU('+id+')',750);
              //DEF.STO('hell.CR.Slide_Clock',1000,id);
              //DEF.STO('hell.CR.Find_Top',1000);
              //this.Slide_Clock(id);
              //this.Find_Top();

           },

           FU:function(){
           var fmenu = DEF.GEBI("fmenu");
           if(fmenu){
              fmenu.style.position = "absolute";
              fmenu.style.top = ( pot + 0)+"px";
              for(x=0;x<buttons.length;x++){
                this.Clear_Opt((x+1));
              }
           }
           link[0] = "li";
           link[1] = "false";
           },

           REGU:function(id){
           var pelm = DEF.GEBI(("m"+id));
              //if(pelm.event == "mouseover"){
                this.Slide_Clock(id);
                this.Find_Top();
              //}
           },

           Find_Top:function(){
           var fmenu = DEF.GEBI("fmenu");
           var lmenu = DEF.GEBI("leftmenu");
           if(fmenu && fmenu.style.top != ((100 + xpos)+"px")){
           lmenu.style.top = "110px";
           //lmenu.style.height = "475px";
           if((link[1] - ""))
            this.Move_Menu();
           }
              return true;;
           },

           Clear_Opt:function(id){

               var objc = DEF.GEBI("menu"+id);
                var OH = objc.style.height;
                OH = Number(OH.slice(0,OH.indexOf("px")));
                if(OH > 0 && (OH - incr) > 0){
                    objc.style.height = (OH - incr) + "px";
                    DEF.STO('hell.CR.Clear_Opt',SSpeed,id);
                    }
                else{
                    DEF.CTO(id);
                    objc.style.height = "0px";
                    }
           },

           Slide_Clock:function(id){
           if(!bfocus){
                bfocus = id;
           }
           if(bfocus && bfocus != id){
            if(DEF.CTO(bfocus))
                DEF.STO('hell.CR.Clear_Opt',SSpeed,bfocus);
            }

           var objc = DEF.GEBI("menu"+id);
           if(objc){
             var OH = objc.style.height;
             OH = Number(OH.slice(0,OH.indexOf("px")));
             var OG = (id == 1)? 113:150 ;
                if(OH < OG){
                  objc.style.height = (OH + incr) + "px";
                  DEF.STO('hell.CR.Slide_Clock',SSpeed,id);
                  }
                else{
                  DEF.CTO(id);
                  bfocus = id;
                  }
            }
           },

           Move_Menu:function(){
             var fmenu = DEF.GEBI("fmenu");
             var fhe = fmenu.offsetTop;
             if(Number(fhe) > Number(xpos)){
                fmenu.style.position = "absolute";
                fmenu.style.top = (fhe - incr)+"px";
                //fmenu.style.position = "none";
                DEF.STO("hell.CR.Move_Menu",SSpeed,100);
             }
             else{
                fmenu.style.position = "absolute";
                fmenu.style.top = ( xpos)+"px";
                //fmenu.style.position = "none";
                DEF.CTO(100);
             }
           },

           Restore_Menu:function(){
             var loc = window.location.href;
             if(loc.indexOf("?") > 0){
                loc = loc.slice((loc.indexOf("?") + 1),loc.length);
                link = loc.split("=");
                if((link[1]- "" )){
                    this.Slide_Clock(Number(link[1]));
                    this.Find_Top();
                }
                else
                  this.FD(1);

             }
             else{
               this.FD(1);
             }
           },

           Add_Link:function(){
              if(this.href.indexOf("?") < 0 && this.href.indexOf("()") < 0)
                this.href = this.href + ("?"+link[0]+"=" + link[1]);
           }
     }

     this.constructor = function(){
        xpos = DEF.GEBI("mentop").offsetTop;
        var fmenu = DEF.GEBI("fmenu");
        if(fmenu)
            fmenu.style.top = (xpos - 0)+"px";
        foc_top;
        incr = this.incr;
        ftim = this.ftim;
        stim = this.stim;
        link = new Array(false,"false");;
        pot = DEF.GEBI("m1").offsetTop;
        items = DEF.GETN("div");
        buttons = this.sort_buttons(items,oarray);
        if(buttons)
            this.CR.Restore_Menu();
        bfocus = false;
        var lm = DEF.GEBI("menu");
        if(lm){
            var lv = lm.style.height;
            var lh = lv.slice(0,lv.indexOf("px"));
            lm.style.height = (lh + 0)+"px";
            //lm.style.visibility = "hidden";
        }
        SSpeed = this.SSpeed;
        dlay = this.dlay;
        var a = document.getElementsByTagName('A');
        var ploc = window.location.href;
        var ploc2 = ploc.slice((ploc.lastIndexOf("/") + 1),ploc.lastIndexOf("."));
        for (var i=0;i<a.length;i++){
            a[i].onclick = this.CR.Add_Link;
            if(a[i].href.indexOf(ploc2) > 0 && a[i].id != "lt"){
                if(a[i].parentNode.parentNode.id.indexOf("menu") >= 0)
                  a[i].style.color = "#f0a61f";
                else
                  a[i].style.color = "#2cadda";
            }

        }
     }

     this.sort_buttons = function(obj,arr){
       for(i in obj){
        if(obj[i].id == ("m" + idd)){
            arr[arr.length] = new Array(obj[i],obj[i].offsetTop,obj[i].style.height);
            obj[i].style.top = (Number(pot) + (35 * idd))+"px";
            idd++;
        }
       }

       return arr;
     }

      //constants
  var pot;
  var xpos;
  var buttons;
  var oarray = new Array();
  var foc_top;
  var idd = 1;
  var bfocus;
  var items;
  var SSpeed;
  var link;
  var incr;
  var ftim;
  var stim;
   return this;
  }

  function Color_Links(){
    var plinks = document.getElementsByTagName("A");
    var ploc = window.location.href;
    var ploc2 = ploc.slice((ploc.lastIndexOf("/") + 1),ploc.lastIndexOf("."));
    for(x=0;x<plinks.length;x++){
       if(plinks[x].href.indexOf(ploc2) > 0 && plinks[x].id != "lt")
        plinks[x].parentNode.style.color = "#2cadda";
    }
  }

  function ftm(){
   var ftm = '<td class="tmenu2" >  <a href="/index.php"  class="menu" >&nbsp;    &nbsp;  Home  &nbsp;    &nbsp;</a>  </div>   </td>    <td class="tmenu2" >    <a href="/aboutus.htm" class="menu">&nbsp;  About Us  &nbsp;</a>  </div>  </td>     <td class="tmenu2" >  <a href="/Newsletter.htm" class="menu">&nbsp;Newsletter&nbsp;</a>  </div>   </td> <td class="tmenu2" > <a href="http://www.optimumforums.org/" class="menu">&nbsp;    &nbsp;Forum&nbsp;    &nbsp;</a>       </div>   </td>   <td class="tmenu2" > <a href="/detailtips.htm" class="menu">Detailing Tips</a> </div>   </td>  <td class="tmenu2" >  <a href="javascript:Kart.View_Cart()" class="menu">Shopping Cart</a></div> </td>   <td class="tmenu2" > <a href="/distributers.htm" class="menu">Distributors</a></div></td><td class="tmenu2" width="94"><a href="/waxfaqs.htm" class="menu">&nbsp;    &nbsp;&nbsp;FAQs&nbsp;&nbsp;    &nbsp;</a></td><td class="tmenu2" ><a href="/contactus.htm" class="menu">&nbsp;Contact Us&nbsp;</a></div></td>';
  var tm = false;
  if(tm = document.getElementById("m_t"))
    tm.innerHTML = ftm;

  }