
  CartArray = new Array()
  _CurVis  = "Front"
  RunShow = false;
  ShowStock = false;
  _DefImg = "./Show/Show_11.JPG"

  src = ["./Show/Show_1.JPG", "./Show/Show_2.JPG", "./Show/Show_3.JPG",  "./Show/Show_4.JPG", "./Show/Show_5.JPG", "./Show/Show_6.JPG", "./Show/Show_7.JPG", "./Show/Show_8.JPG",  "./Show/Show_9.JPG", "./Show/Show_10.JPG", "./Show/Show_11.JPG", "./Show/Show_12.JPG", "./Show/Show_13.JPG", "./Show/Show_14.JPG", "./Show/Show_15.JPG", "./Show/Show_16.JPG", "./Show/Show_17.JPG", "./Show/Show_18.JPG", "./Show/Show_19.JPG", "./Show/Show_20.JPG", "./Show/Show_21.JPG", "./Show/Show_22.JPG", "./Show/Show_23.JPG", "./Show/Show_24.JPG"]

  duration = 4;
  ads=[]; ct=0;

  M_Payment    = "";
  M_OrderID    = "0000-00000000000000";
  M_Email      = "";
  M_Navn       = "";
  M_Adresse    = "";
  M_Postnummer = "";
  M_By         = "";
  M_Land       = "";
  M_Telefon    = "";
  M_Besked     = "";
  M_Hvor       = "";
  M_Nyhedsbrev = "";
  M_Kundetype  = "";
  M_Transid    = "0";
  M_Kundenummer= "0000";
  M_Status     = "";
  M_Ship       = "0,00";
  M_Tax        = "0,00";
  M_Amount     = "0,00";
  M_Gavekort   = "0,00";
  M_GavekortId = "";

// ---------------------------------------------------------------------------------------- //
function GetCart(ArrNum) {
  return CartArray[ArrNum];
}

function SetCart(ArrNum,CartVal) {
  CartArray[ArrNum] = CartVal
}

function NumCart() {
  return CartArray.length
}

function DelCart(ArrNum) {
  CartArray.splice(ArrNum,1)
}

function ZeroCart() {
  CartArray.splice(0,CartArray.length)
}

function SortCart() {
  CartArray.sort()
}

// ---------------------------------------------------------------------------------------- //
function Reload() {
 if (NumCart() == 0) {
   window.location.reload();
   }
}
// ---------------------------------------------------------------------------------------- //
function MyInit(Run) {

      obj = "Menu"
      elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","visible")
      elm.setAttribute("class","visible")

      obj = "Wait"
      elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","hidden")
      elm.setAttribute("class","hidden")

    if (self.location.search)  {

      if      (self.location.search == "?Butik"){openButik()}
      else if (self.location.search == "?Kunder"){openKunde()}
      else if (self.location.search == "?Nyhedsbreve"){openNyhed()}
      else if (self.location.search == "?Betingelser"){openBetingelser('#')}
      else if (self.location.search == "?Link"){openLink()}
      else if (self.location.search == "?link"){openLink()}
      else if (self.location.search == "?Profil"){openProfil()}
      else if (self.location.search == "?Kontakt"){openKontakt()}
      else if (self.location.search == "?Galleri"){openGalleri()}
      else if (self.location.search == "?Domicil"){openDomicil()}
      else if (self.location.search == "?Domicil2"){openDomicil2()}
      else    {openButik(self.location.search) }
    }
    else {
      if (Run == "Message")  setTimeout('position_at_top()',4000)

      obj = "Front"
      elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","visible")
      elm.setAttribute("class","visible")
      _CurVis = "Front"

      document.getElementById("Ad_Image").src= _DefImg

      RunShow = true;
      switchAd();
    }

} 

// ---------------------------------------------------------------------------------------- //
function switchAd() {

var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
if (RunShow) setTimeout("switchAd()",duration*1000);
}

// ---------------------------------------------------------------------------------------- //
function hidePower() {
  obj = "Power";
  elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","hidden")
      elm.setAttribute("class","hidden")

  obj = "Power2";
  elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","hidden")
      elm.setAttribute("class","hidden")
}
// ---------------------------------------------------------------------------------------- //
function openKunde() {
    hidePower();
    showDiv('Kunder');

    obj = "Kun"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "./I_Kunde.html"
}
// ---------------------------------------------------------------------------------------- //
function openNyhed() {
    hidePower();
    showDiv('Nyhed')

    obj = "Nyh"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "./I_Nyhedsbreve.html"
}
// ---------------------------------------------------------------------------------------- //
function openBetingelser(Hash) {
    hidePower();
    showDiv('Betingelser')

    obj = "Bet"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 
   elm.src = "./I_Betingelser.html"+ Hash
}

// ---------------------------------------------------------------------------------------- //
function openLink() {
    hidePower();
    showDiv('Link')

    obj = "Lnk"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "./I_Link.html"
}
// ---------------------------------------------------------------------------------------- //
function openProfil() {
    hidePower();
    showDiv('Profil')
    obj = "Pro"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "I_Profil.html"
}
// ---------------------------------------------------------------------------------------- //
function openKontakt() {
    hidePower();
    showDiv('Kontakt')
    obj = "Kon"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "I_Kontakt.html"
}
// ---------------------------------------------------------------------------------------- //
function openGalleri() {
    hidePower();
    showDiv('Galleri')
    obj = "Gal"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "I_Galleri.html"
}
// ---------------------------------------------------------------------------------------- //
function openDomicil() {
    hidePower();
    showDiv('Domicil')
    obj = "Dom"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "I_Domicil.html"
}
function openDomicil2() {
    hidePower();
    showDiv('Domicil')
    obj = "Dom"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 

    elm.src = "I_Domicil_2.html"
}
// ---------------------------------------------------------------------------------------- //
function openFront() {
    hidePower();
    hideDiv('Chain')
    hideDiv('Domicil')
    if (_CurVis == "Butik")
    {
      showDiv('Front')
      document.getElementById("Ad_Image").src= _DefImg
      RunShow = true;
      switchAd();
    }

    showDivSimple('Dir')

      tree1.collapseAll();
      tree1.expandNode(0);
      tree1.expandNode(1);
      tree1.draw();

//    if (_CurVis != "Front") 
//    {
//      showDiv('Front')
//      document.getElementById("Ad_Image").src= _DefImg
//      RunShow = true;
//      switchAd();
//    }
}
// ---------------------------------------------------------------------------------------- //
function openButik(append) {
    hidePower();
    hideDiv(_CurVis)
    if (append == undefined) append = ""


    obj = "But"
    elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 
    elm.src = "Butik/Shop.html" + append

    showDiv('Butik')
}
// ---------------------------------------------------------------------------------------- //
function bwcheck(){               // Browser check
  this.ver=navigator.appVersion
  this.agent=navigator.userAgent
  this.dom=document.getElementById?1:0
  this.opera5=(navigator.userAgent.indexOf("Opera")>-1 & document.getElementById)?1:0
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom & !this.opera5)?1:0; 
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom & !this.opera5)?1:0;
  this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom & !this.opera5)?1:0;
  this.ie4=(!this.dom & !this.opera5)?1:0;
  this.ie=this.ie4||this.ie5||this.ie6||this.ie7
  this.mac=this.agent.indexOf("Mac")>-1
  this.ns6=(this.dom & parseInt(this.ver) >= 5) ?1:0; 
  if (this.opera5) this.ns6 = 0
  this.ns4=(document.layers & !this.dom)?1:0;
  this.win = (this.agent.indexOf("windows")>-1);
  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
  return this
}
// ---------------------------------------------------------------------------------------- //
function showDiv(obj) {
    RunShow = false;
      hideDiv(_CurVis)
      elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","visible")
      elm.setAttribute("class","visible")
     // elm.focus();
      _CurVis = obj
}
// ---------------------------------------------------------------------------------------- //
function showDivSimple(obj) {
      elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","visible")
      elm.setAttribute("class","visible")
}
// ---------------------------------------------------------------------------------------- //
function hideDiv(obj) {
  if (obj != "") {
  elm = document.getElementById? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
      elm.setAttribute("className","hidden")
      elm.setAttribute("class","hidden")
  } 
}
// ---------------------------------------------------------------------------------------- //
