function PreLoadImgs() {
  preimg = new Image();
  preimg.src = "/img/tb_button_cykler_h.gif";
  preimg = new Image();
  preimg.src = "/img/tb_button_reservedele_h.gif";
  preimg = new Image();
  preimg.src = "/img/tb_button_sog_h.gif";
  preimg = new Image();
  preimg.src = "/img/tb_button_print_h.gif";
  preimg = new Image();
  preimg.src = "/img/tb_button_kurv_h.gif";
}

setTimeout("PreLoadImgs()", 2000);

function AddToCart(productid) {
  amount = 1;
  editbox = document.getElementById("addamount"+productid);
  if (editbox) amount = editbox.value;
  url = 'cart.php?mode=add&product='+productid+'&amount='+amount;
  for (i = 97; i < 122; i++) {
    obj = document.getElementById('productchoice'+String.fromCharCode(i));
    if (obj != null)
      url = url+'&productchoice'+String.fromCharCode(i)+'='+obj.options[obj.selectedIndex].value;
    else break;
  }
  url = url+'&back='+encodeURIComponent(encodeURIComponent(window.location));
  window.location = url;
}

function ExtraMenuSearch() {
  document.getElementById('netcykel_formsearch').submit();
}

function ShowProductPic(obj, imgfile) {
  window.open('/showpic.php?obj='+obj+'&filename='+imgfile,'ProductImg','height=700,width=960,resizable=1,scrollbars=1,status=1');
}

function ShowBikeSizes() {
  wnd = window.open('/pages.php?obj=8&_print=1','BikeSizes','height=700,width=400,resizable=1,scrollbars=1,status=1');
  wnd.focus();
}

function CompareProductsAdd(obj) {
  wnd = window.open('/compare.php?mode=add&conf=1&obj='+obj,'CompareWnd','height=700,width=960,resizable=1,scrollbars=1,status=1');
  wnd.focus();
}

function GotoMainPage() {
  document.location = '/';
}

function WrapMenu(obj) {
  if (document.getElementById(obj).style.display == "none") {
    document.getElementById(obj).style.display = "";
  } else {
    document.getElementById(obj).style.display = "none";
  }
}

function ShowMakerPopup(obj) {
  wnd = window.open('/showmakerpopup.php?obj='+obj,'ShowMaker','height=300,width=500,resizable=0,scrollbars=1,status=1');
  wnd.focus();
}

function ToggleElement(id) {
  obj = document.getElementById(id);
  if (obj.style.display == 'block')
    obj.style.display = 'none';
  else
    obj.style.display = 'block';
}

