﻿var ecImg = new Array();
ecImg[0] = new Image();
ecImg[0].src = "/products/images/forms_buttons/mrgas_collapse_category.gif";
ecImg[1] = new Image();
ecImg[1].src = "/products/images/forms_buttons/mrgas_expand_category.gif";

ecImg[2] = new Image();
ecImg[2].src = "/products/images/forms_buttons/collapse_region.gif";
ecImg[3] = new Image();
ecImg[3].src = "/products/images/forms_buttons/expand_region.gif";

function adjustCarPosition() {
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1)? true : false;
    var t = document.getElementById("carInCorner")  
  if (t) {
    // move to where the new footer location is
     var t3 = document.getElementById("footer").offsetTop
     var tp3 = parseInt(t3-206)
    
    if(isIE) {
       document.getElementById("carInCorner").style.top = tp3 ;
    } else {       
      var temp3 =  "position:absolute;left:769px;top:" + tp3 + "px;visibility:visible;"
      t.setAttribute("style",temp3)
     }   // isIE check
  }
}
  function toggleTopic(idn) {
    var t = document.getElementById(idn);
    t.className = (t.className=="mrgOnCat")?  "" : "mrgOnCat";
    // now grab its children <ol> and turn on & off
    if(t.getElementsByTagName("ol").length > 0) {
      var v = t.getElementsByTagName("ol").item(0);
      t.getElementsByTagName("ol").item(0).style.display = (v.style.display=="none")?  "block" : "none";
    }   
     adjustCarPosition(); 
  }
  
  
  function toggleCategory(idn,inImgIdx,outImgIdx) {
    if(inImgIdx==null) inImgIdx = 0;
    if(outImgIdx==null) outImgIdx = 1;
    var t = document.getElementById(idn);
    if(t.style.display=="none")  {
      t.style.display = "block";  
      document.getElementById('i' + idn+'_EC').src = ecImg[inImgIdx].src;
    } else {
     t.style.display = "none";  
     document.getElementById('i' + idn+'_EC').src = ecImg[outImgIdx].src;
   }
     adjustCarPosition(); 
  }

  function toggleAllCats(onOff) {
    var t = (onOff==1)? "block" : "none";
    var x = document.getElementsByTagName("DIV");
    var z
    for (var j=0; j < x.length; j++) {
      if (x.item(j).className=="ltBluBox") {
          z = x.item(j);
        if(onOff==1)
          document.getElementById('i' + z.id + '_EC').src = ecImg[0].src;
        else
          document.getElementById('i' + z.id + '_EC').src = ecImg[1].src;
        x.item(j).style.display = t;
      }
    }
    adjustCarPosition() ;
  }

