//---------------------------------

var SisteSok = "Ingen";

var SettVisKunInfo = 0;

//---------------------------------

function hovedside() {

  document.sok.se.value = "";
  document.KategoriSok.se.selectedIndex = 0;

  SisteSok = "Ingen";

  window.parent.main.location.href="hoved.htm";
//window.parent.main.location.href="hoved.asp";
//window.parent.frames[1].location.href="hoved.htm"; (gjør samme nytte)

}

//---------------------------------

function bestilling() {

  document.sok.se.value = "";
  document.KategoriSok.se.selectedIndex = 0;

  SisteSok = "Ingen";

  window.parent.main.location.href="bestill.htm";
//window.parent.frames[1].location.href="bestill.htm"; (gjør samme nytte)

}

//---------------------------------

function betingelser() {

  document.sok.se.value = "";
  document.KategoriSok.se.selectedIndex = 0;

  SisteSok = "Ingen";

  window.parent.main.location.href="betingelser.htm";

//window.parent.main.location.href="betingelser.htm";
//window.parent.frames[1].location.href="betingelser.htm"; (gjør samme nytte)

}

//---------------------------------

function selge() {

  document.sok.se.value = "";
  document.KategoriSok.se.selectedIndex = 0;

  SisteSok = "Ingen";

  window.parent.main.location.href="selge.htm";
//window.parent.frames[1].location.href="selge.htm"; (gjør samme nytte)

}

//---------------------------------

function FriSok() {

  SisteSok = "FriSok";

  document.KategoriSok.se.selectedIndex = 0;

  if(document.sok.se.value=="") {
    alert("Du har ikke skrevet inn noe søkekriterie, og vil derfor få listet opp alle våre bøker");
    document.sok.submit();
  }

  else {
    document.sok.submit();
  }

}

//---------------------------------

function KatSok() {

  if(document.KategoriSok.se.options[document.KategoriSok.se.selectedIndex].value!="") {
      SisteSok = "KategoriSok";
      document.KategoriSok.submit();
  }

}

//---------------------------------

function delFriSok() {
  if(document.sok.se.value != "") {
    document.sok.se.value = "";
  }
}


//---------------------------------

function forklaring() {

var tekst = "Slik bruker du vår automatiske søke- og bestillingstjeneste:\n\n(denne veiledningen er ikke ferdig enda)\n\nALT VIRKER, OG DET ER INTUITIVT Å BRUKE SYSTEMET";

  alert(tekst);

}

//---------------------------------

function VisKun() {

  if(document.KategoriSok.nb.checked) {
    if(SettVisKunInfo==0) {
      alert("Denne innstillingen påvirker både frisøk og kategorisøk");
      SettVisKunInfo = 1;
    }
    document.sok.nb.value = "on";
  }

  else { document.sok.nb.value = "off"; }

  if(SisteSok=="FriSok") { document.sok.submit(); }

  else if((SisteSok=="KategoriSok")&&(document.sok.se.value=="")) {  document.KategoriSok.submit(); }

}

//---------------------------------