function lightOn() {
//	document.getElementsByTagName("body")[0].style.backgroundColor = '#fff887';
	document.getElementById("light").style.backgroundColor = "#fff887";
	document.getElementById("est").style.backgroundColor = "#fff887";
}

function lightOff() {
//	document.getElementsByTagName("body")[0].style.backgroundColor = '#666666';
	document.getElementById("est").style.backgroundColor = "#E6E6E6";
	document.getElementById("light").style.backgroundColor = "#E6E6E6";
}

function showProdukt(prodImg, prodName) {
	document.getElementById("product").src = '/images/products/' + prodImg;
	document.getElementById("productName").innerHTML = prodName;
}

bh = {
  triggerClass:'shown',
  init : function() {
    var listitems, i, content;
    bh.headings = document.getElementById('menu');
    if(!bh.headings) {
      return;
    }
    listitems = bh.headings.getElementsByTagName('b');
    for(i=0; i<listitems.length; i++) {
      content = listitems[i].parentNode.getElementsByTagName('ul')[0];
      content.defaultHeight = content.offsetHeight;
      listitems[i].content=content;
      YAHOO.util.Event.addListener(listitems[i], 'click', bh.toggle);
      // Show active menu
      contenta = content.getElementsByTagName('a');
      showa = false;
      for(ia=0; ia<contenta.length; ia++) {
        if (contenta[ia].className == "selected subsubmenutab") {
          showa = true;
          break;
        }
      }
      if (showa) {
        var attributes, anim;
        YAHOO.util.Dom.addClass(content, 'shown');
        attributes = {
          height: {from:0, to:content.defaultHeight},
          opacity: {from:0, to:1}
        };
        anim = new YAHOO.util.Anim(content, attributes, .6, YAHOO.util.Easing.backOut);
        anim.animate();
        anim.onComplete.subscribe(bh.toggleCustom);
      }
    }
  },
  toggle : function() {
    var attributes, anim;
    var c = this.content;
    if(!c.shown) {
      YAHOO.util.Dom.addClass(c, 'shown');
      attributes = {
        height: {from:0, to:c.defaultHeight},
        opacity: {from:0, to:1}
      };
      anim = new YAHOO.util.Anim(c, attributes, .6, YAHOO.util.Easing.backOut);
      anim.animate();
      anim.onComplete.subscribe(bh.toggleCustom);
    } else {
      attributes = {
        height: {from:c.defaultHeight, to:0},
        opacity: {from:1, to:0}
      };
      anim = new YAHOO.util.Anim(c, attributes, .6, YAHOO.util.Easing.easeBoth);
      anim.animate();
      anim.onComplete.subscribe(bh.toggleCustom);
    }
  },
  toggleCustom:function() {
    var c=this.getEl();
    c.shown = c.shown ? false : true;
  },
  hideContents : function() {
    YAHOO.util.Dom.addClass('menu', 'dynamic');
    bh.init();
  }
}
YAHOO.util.Event.onAvailable('menu', bh.hideContents);
