//document.onclick=function() {hidePopUp()};

function pPopUp(vFoto) 
{
 
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
    
  url = "vPopUp.asp?foto="+vFoto
  //location.href=url;
 xmlHttp.open("POST",url,true);
 xmlHttp.onreadystatechange=vPopUpChanged;
 xmlHttp.send('');

}

function vPopUpChanged() {
  if (xmlHttp.readyState==4)
    {

    oStr = xmlHttp.responseText;

   vArray = oStr.split("|");
   imgHeight = vArray[0];
   imgWidth = vArray[1];
   vFoto = vArray[2]

    document.getElementById("vPopUp").style.width=imgWidth+"px";
    document.getElementById("vPopUp").style.height=imgHeight+"px";

    document.getElementById("vPopUp").style.visibility='visible';
    document.getElementById("vlPict").innerHTML="<img src='shop/foto/"+vFoto+"' border='0' style='border-style:solid; border-width:1px; border-top-color:#FFFFFF; border-left-color:#FFFFFF; border-bottom-color:#000000; border-right-color:#000000;'>";

    }
}

/* ---- */
function sendOrder() 
{
 if (gemtKundeData==0)
    {
    action = window.setTimeout("advarsel('Udfyld felterne nedenfor og klik på \"Gem oplysninger\"!',180,80,tempY+20,tempX-200,0)",10);
    return;
    }
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
    
  url = "sendOrder.asp"
  //location.href=url;

 xmlHttp.open("POST",url,true);
 xmlHttp.onreadystatechange=sendOrderChanged;
 xmlHttp.send('');

}

function sendOrderChanged() {
  if (xmlHttp.readyState==4)
    {

    oStr = xmlHttp.responseText;
    fillRL('fillShop.asp',1,'fane7')
    action = window.setTimeout("advarsel('Din ordre er afsendt, og du vil modtage en bekræftelse snarest på din email!',200,200,tempY+20,tempX-200,0)",10);

    }
}

/* -- */
function saveKunde() 
{
 vValid = 1
 var tekst = ""
 if (document.getElementById('vNavn').value.length==0)
    {
    vValid = 0
    tekst = "Skriv dit navn!"
    } 
 if (document.getElementById('vAdresse').value.length==0)
    {
    vValid = 0
    tekst = "Adresse skal oplyses!"
    } 

 if (document.getElementById('vPostnr').value.length==0)
    {
    vValid = 0
    tekst = "Postnr skal oplyses!"
    } 
 if (document.getElementById('vBy').value.length==0)
    {
    vValid = 0
    tekst = "Hvilken by?"
    }
 if (document.getElementById('vMail').value.length==0)
    {
    vValid = 0
    tekst = "Mailadrese skal oplyses!"
    }

 if (vValid==0)
    {   
    action = window.setTimeout("advarsel('"+tekst+"',210,100,140,400,0)",100);
    return;
    }

  if ((document.getElementById('vMail').value.indexOf("@") < 0) || (document.getElementById('vMail').value.indexOf(".") < 0)) {
     action = window.setTimeout("advarsel('Email adresse er ikke korrekt!',210,100,140,400,0)",100);
     return;
     }
 vUrl = ""
 for(i=0; i<document.kundeForm.elements.length; i++)
 {
        vUrl = vUrl + document.kundeForm.elements[i].value+"|";
 }
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
    
  url = "saveKUnde.asp?streng="+vUrl
  //location.href=url;


 xmlHttp.open("POST",url,true);
 xmlHttp.onreadystatechange=kundeChanged;
 xmlHttp.send(''); 

 

}

function kundeChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('kundeButton').style.visibility='hidden';
    gemtKundeData = 1
    oStr = xmlHttp.responseText;
    action = window.setTimeout("advarsel('Dine oplysninger er blevet gemt!',180,80,tempY+20,tempX-200,0)",10);

    t=setTimeout('lukVareBesked()',2000);

    }
}

/* -- */
function showSaveButton()
{
 document.getElementById('kundeButton').style.visibility='visible';
 gemtKundeData=0;
}


window.onload=function() { 
  /*
  var qs = location.href.split("=");
  var vPageId = qs[1];
  switch(vPageId)
  {
  case "1":
    alert(vPageId)
    break;
  case "2":
    //nothing
    break;
  default:
    fillRL("fillRLmain.asp",0,"");
  }
  */
  fillRL("fillRLmain.asp",0,"");
}

function removeFromBasket(vBasket_id)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="removeFromBasket.asp?basket_id="+vBasket_id;
 //location.href=url;

 xmlHttp.onreadystatechange=removeFromBasketChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');


}

function removeFromBasketChanged() {
  if (xmlHttp.readyState==4)
    {
    oStr = xmlHttp.responseText;
    viewBasket();
    }
}

/* -- */
function viewBasket()
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="viewBasket.asp";
 //location.href=url;

 xmlHttp.onreadystatechange=viewBasketChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');


}

function viewBasketChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
    document.getElementById('blogArea').scrollTop=0;
    }
}
/* -- */
function putInBasket(vVare_id,vAntal,vLpage)
   {
   
   if ((vAntal=='') || (vAntal==0))
      {
       action = window.setTimeout("advarsel('Du skal angive et antal!',180,80,tempY+20,tempX-200,0)",10);
       return;
      }
 

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="putInBasket.asp?vare_id="+vVare_id+"&antal="+vAntal+"&lPage="+vLpage;

 xmlHttp.onreadystatechange=putInBasketChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');
 
}


function putInBasketChanged() {
  if (xmlHttp.readyState==4)
    {
    
    oStr = xmlHttp.responseText;
    if (oStr.indexOf("|") != -1)
       {
        //alert(oStr.substring(1))
    action = window.setTimeout("advarsel('Der er kun '+oStr.substring(1)+' stk. på lager',180,80,tempY+20,tempX-200,0)",10);
       }
    else
       { 
    document.getElementById('saldo').style.visibility='visible';
    document.getElementById('saldo').innerHTML="<font class='textP'>&nbsp;<b>Saldo:&nbsp;</b>"+oStr+"&nbsp;</font>"; 

    action = window.setTimeout("advarsel('Varen er lagt i indkøbskurv! Der er købt varer for '+oStr+' kr.',180,80,tempY+20,tempX-200,0)",10);


    t=setTimeout('lukVareBesked()',2000);
     }
    }
}

function lukVareBesked() {
 document.getElementById('advarselPopUp').style.visibility='hidden';
 //document.getElementById('vareIkurv').style.visibility='hidden';
}
/* -- */



function IsNumeric(strString,vName)
   {

   var strValidChars = "0123456789";
   var strChar;
  
   if (strString.length == 0) {return;}

   for (i = 0; i < strString.length; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         document.shop[vName].value="1";

         //action = window.setTimeout(" advarsel('Du skal angive en talværdi!',180,80,tempY+20,tempX-200,0)",10);
  
         }
      }
   }





//window.onresize = function() {placeIt();}

function placeIt()
{
var winW,winH;
if (self.innerHeight) // all except Explorer
 {
 	winW = self.innerWidth;
 	winH = self.innerHeight;
 }
 else if (document.documentElement && document.documentElement.clientHeight)
 	// Explorer 6 Strict Mode
 {
 	winW = document.documentElement.clientWidth;
 	winH = document.documentElement.clientHeight;
 }
 else if (document.body) // other Explorers
 {
 	winW = document.body.clientWidth;
 	winH = document.body.clientHeight;
 }
 winH=winH-20
if (winH<707)
   {
   winH=707
  }
 /*
 document.getElementById('screenBottom').style.top=winH+'px';
 document.getElementById('screenBottom').style.visibility='visible';

 document.getElementById('screenBottom2').style.top=winH+'px';
 document.getElementById('screenBottom2').style.visibility='visible'; 

 document.getElementById('pb').style.top=winH+'px';
 document.getElementById('pb').style.visibility='visible';
 */
 }



var contactText = ""
var contactKunde = ""
var contactMail = ""
function whichChar(e,felt){

if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
  keychar = String.fromCharCode(keynum);

  if (felt==1)
     {
     contactText = contactText + String.fromCharCode(keynum);
     }
  if (felt==2)
     {
     contactKunde = contactKunde + String.fromCharCode(keynum);
     }
  if (felt==3)
     {
     contactMail = contactMail + String.fromCharCode(keynum);
     }          
}
//----------------------------------------------
function uploadWindow(thisId) {
  vTop = (tempY+160)+'px' 
  vLeft = (tempX-10)+'px'
  window.open("upload.asp?id="+thisId,"","width=430px, height=160px, left="+vLeft+", top="+vTop+", resizable=no, scrollbars=no, menubar=no, toolbar=no, directories=no, location=no, status=no");	
}

/* -- */
function saveEditFol()
{

 vValid = 1
 var tekst = ""
 if (document.getElementById('vFornavn').value.length==0)
    {
    vValid = 0
    tekst = "Skriv dit fornavn!"
    } 
 if (document.getElementById('vEfternavn').value.length==0)
    {
    vValid = 0
    tekst = "Skriv dit efternavn!"
    } 
 if (document.getElementById('vEmail').value.length==0)
    {
    vValid = 0
    tekst = "Feltet Email skal udfyldes!"
    }  
 if (vValid==0)
    {   
    action = window.setTimeout("advarsel('"+tekst+"',210,100,140,400,0)",100);
    return;
    }


  if ((document.getElementById('vEmail').value.indexOf("@") < 0) || (document.getElementById('vEmail').value.indexOf(".") < 0)) {
     action = window.setTimeout("advarsel('Email adresse er ikke korrekt!',210,100,140,400,0)",100);
     //document.oprettelse.vKundeEmail.focus();
     return;
     }

 vUrl = ""
 for(i=0; i<document.addFol.elements.length; i++)
 {
        vUrl = vUrl + document.addFol.elements[i].value+"|";
 }

 vUrl = vUrl + document.remember.vId.value+"|"+document.jaTakFol.vMailJaTak.checked+"|"+document.jaTakFol.vSeMail.checked+"|"

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
    
  url = "saveEditFol.asp?streng="+vUrl


 xmlHttp.open("POST",url,true);
 xmlHttp.onreadystatechange=sEditFChanged;
 xmlHttp.send('');

}

function sEditFChanged() {
  if (xmlHttp.readyState==4)
    {
   //oStr = xmlHttp.responseText;
   //sString = "<font class='textO'>V&aelig;lg eventuelt dit eget password</font>"
   document.getElementById('dataGemt').style.visibility='visible';
   fillFollowers();
    }
}
/* -- */

function saveFol(vWhich)
{

 vValid = 1
 var tekst = ""
 if (document.getElementById('vFornavn').value.length==0)
    {
    vValid = 0
    tekst = "Skriv dit fornavn!"
    } 
 if (document.getElementById('vEfternavn').value.length==0)
    {
    vValid = 0
    tekst = "Skriv dit efternavn!"
    } 
 if (document.getElementById('vEmail').value.length==0)
    {
    vValid = 0
    tekst = "Feltet Email skal udfyldes!"
    }  
 if (vValid==0)
    {   
    action = window.setTimeout("advarsel('"+tekst+"',210,100,140,400,0)",100);
    return;
    }


  if ((document.getElementById('vEmail').value.indexOf("@") < 0) || (document.getElementById('vEmail').value.indexOf(".") < 0)) {
     action = window.setTimeout("advarsel('Email adresse er ikke korrekt!',210,100,140,400,0)",100);
     //document.oprettelse.vKundeEmail.focus();
     return;
     }

 vUrl = ""
 for(i=0; i<document.addFol.elements.length; i++)
 {
        vUrl = vUrl+document.addFol.elements[i].value+"|";
 }
 vAnt = parseInt(document.getElementById('antFol').innerHTML)+1
 document.getElementById('antFol').innerHTML = vAnt

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url = "saveAddFol.asp?streng="+vUrl


 xmlHttp.onreadystatechange=sFChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function sFChanged() {
  if (xmlHttp.readyState==4)
    {

    oStr = xmlHttp.responseText;

    if (oStr=='exists')
       {
        action = window.setTimeout("advarsel('Bruger er allerede oprettet!',210,100,140,400,0)",100);         
        return;
       }

   vArray  = oStr.split("|");

   document.addFol.vPw.value=vArray[1];

   document.remember.vId.value=vArray[0];

   //document.getElementById('newArt').style.visibility='hidden';
  
   document.getElementById('x1').style.visibility='visible';
   document.getElementById('x2').style.visibility='visible';
   document.getElementById('sendFollower').style.visibility='hidden';
   document.getElementById('annuller').style.visibility='hidden';
   sString = "<font class='textO'>V&aelig;lg eventuelt dit eget password</font>"
   document.getElementById('x3').innerHTML=sString;
   document.getElementById('editTopMenu').style.visibility='visible';
   document.getElementById('photo').style.visibility='visible';
   document.getElementById('jaTak').style.visibility='visible';
   fillFollowers();

    }
}

function fillAddFol()
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillAddFol.asp";
 xmlHttp.onreadystatechange=addFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function addFolChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('scrollArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').innerHTML=oStr;
    document.getElementById('scrollArea').scrollTop=0;
    }
}
/* */
function checkP(vMail,vPw,vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="checkPw.asp?mail="+vMail+"&pw="+vPw+"&id="+vId;
// location.href=url;
 xmlHttp.onreadystatechange=checkPwChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function checkPwChanged() {
  if (xmlHttp.readyState==4)
   {
    oStr = xmlHttp.responseText;
    varStr = oStr.split("|")
    if (varStr[0]==1)
       {
      fillEditFol(varStr[1]); 
       }

    else
      {
     tekst = "Email eller password er ikke korrekt! Pr&oslash;v igen."
     advarsel(tekst,210,100,tempY+20,tempX,0)    
    //advarsel2(0);


     return;

       }
   }
}

/* forgot pw */
function forgotPw(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="forgotPw.asp?mail="+document.cpw2.pwFjols.value+"&id="+vId;

 xmlHttp.onreadystatechange=forgotPwChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');


}

function forgotPwChanged() {

  if (xmlHttp.readyState==4)
   {

    oStr = xmlHttp.responseText;

    if (oStr=="yes")
       {
     document.getElementById('forgotPw').style.visibility='hidden';
     tekst = "Password er afsendt til din mailadresse"
     advarsel(tekst,210,100,tempY+40,tempX,0) 
     return
       }
    else
      {
     tekst = "Den oplyste mailadresse er desværre forkert."
     advarsel(tekst,210,100,tempY+40,tempX,0)    
     return;
       }
   }

}
/* */

function fillEditFol(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="fillEditFol.asp?id="+vId;

 xmlHttp.onreadystatechange=editFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function editFolChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('scrollArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').innerHTML=oStr;
    }
}
/* */
function fillViewFol(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="fillViewFol.asp?id="+vId;
 xmlHttp.onreadystatechange=viewFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');
}

function viewFolChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}

function deleteFollower(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="deleteFollower.asp?id="+vId;

 xmlHttp.onreadystatechange=deleteFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function deleteFolChanged() {
  if (xmlHttp.readyState==4)
    {
    fillRL('fillBlog.asp',1,'fane6')
    tekst = "Din profil er nu slettet!"
    advarsel(tekst,210,100,tempY+20,tempX,0) 
    /*
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
   */
    }
}
/* */
function fillViewFol2(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
 url="fillViewFol2.asp?id="+vId;
 xmlHttp.onreadystatechange=viewFol2Changed;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function viewFol2Changed() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}
/* --   */
function fillComments(vId,bund)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

  if (bund==1)
     {
     var objControl=document.getElementById("scrollArea");
     objControl.scrollTop = objControl.scrollHeight;
    }
  else
    {
    document.getElementById("scrollArea").scrollTop=0;
    }

 url="fillComments.asp?artikelId="+vId;

 xmlHttp.onreadystatechange=fillCommentsChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function fillCommentsChanged() {
  if (xmlHttp.readyState==4)
    {


   //document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}
/* - */
function fillKategori(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillKategori.asp?kategori_id="+vId;

 xmlHttp.onreadystatechange=fillKategoriChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function fillKategoriChanged() {
  if (xmlHttp.readyState==4)
    {


   //document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}

/*   - - */
function fillViewAllFol()
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillViewAllFol.asp";

 xmlHttp.onreadystatechange=viewAllFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');
}

function viewAllFolChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
    document.getElementById('scrollArea').scrollTop=0;
    }
}

/* Shop BEGIN */
function fillShop()
{

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillShop.asp";


 xmlHttp.onreadystatechange=shopChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function shopChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('scrollArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('scrollArea').innerHTML=oStr;
    }
}
/* Shop END */

/* artikel arkiv */

function fillViewArkiv()
{

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillViewArkiv.asp";


 xmlHttp.onreadystatechange=viewArkivChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function viewArkivChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}

/* Se artikel fra arkiv */
function fill_Artikel(vId)
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fill_Artikel.asp?artikelId="+vId;

 xmlHttp.onreadystatechange=fill_ArtikelChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function fill_ArtikelChanged() {
  if (xmlHttp.readyState==4)
    {
    //document.getElementById('scrollArea').scrollTop=0;
    document.getElementById('blogArea').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('blogArea').innerHTML=oStr;
    }
}

function fillFollowers()
{
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillFollowers.asp";

 xmlHttp.onreadystatechange=fillFolChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');
}

function fillFolChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('fPics').innerHTML=""
    oStr = xmlHttp.responseText;
    document.getElementById('fPics').innerHTML=oStr;
    }
}

function fillRL(rlPage,showLinks,vLink)
{

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
 
// location.href='fillRLmain.asp'




  document.getElementById('scrollArea').style.visibility='hidden';
  document.getElementById('linkPopUp').style.visibility='hidden';
if (showLinks==1)
   {
  document.getElementById('fane1').style.backgroundColor='#A5B2BD';
  document.getElementById('fane1').style.color='#FFFFFF';
  document.getElementById('fane2').style.backgroundColor='#F8AABD';
  document.getElementById('fane2').style.color='#FFFFFF';
  document.getElementById('fane3').style.backgroundColor='#8C8E8C';
  document.getElementById('fane3').style.color='#FFFFFF';
  document.getElementById('fane4').style.backgroundColor='#D69EB5';
  document.getElementById('fane4').style.color='#FFFFFF';
  document.getElementById('fane5').style.backgroundColor='#9C8A94';
  document.getElementById('fane5').style.color='#FFFFFF';
  document.getElementById('fane6').style.backgroundColor='#DE8E84';
  document.getElementById('fane6').style.color='#FFFFFF';
  document.getElementById('fane7').style.backgroundColor='#52616B';
  document.getElementById('fane7').style.color='#FFFFFF';
  document.getElementById('fane8').style.backgroundColor='#7B8E8C';
  document.getElementById('fane8').style.color='#FFFFFF';
  document.getElementById('fane9').style.backgroundColor='#736173';
  document.getElementById('fane9').style.color='#FFFFFF';  
   
  document.getElementById(vLink).style.backgroundColor='#FFFFFF';
  document.getElementById(vLink).style.color='#000000';
  aktivtLink=vLink
  
  document.getElementById('scrollArea').style.top='40px';
  document.getElementById('scrollArea').style.height='595px';
  document.getElementById('topmenu').style.visibility='visible';

   }
else
  {
  document.getElementById('topmenu').style.visibility='hidden';
  document.getElementById('scrollArea').style.top='13px';
  document.getElementById('scrollArea').style.height='625px';
  }


 url=rlPage;
 xmlHttp.onreadystatechange=RlMainChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send(''); 

}

function RlMainChanged() {
  if (xmlHttp.readyState==4)
    {
    document.getElementById('scrollArea').innerHTML=""
    oStr = xmlHttp.responseText;

    document.getElementById('scrollArea').innerHTML=oStr;
   document.getElementById('scrollArea').style.visibility='visible';

    /*
    if (oStr.indexOf("blabli") != -1)
       {
       document.getElementById('vvText').innerHTML=contactText;
       document.getElementById('vvKundeNavn').innerHTML=contactKunde;
       document.getElementById('vvKundeEmail').innerHTML=contactMail;       
       }
     */
    }
}

 function addComment(vId)
  {
  document.getElementById('addComment').style.visibility='visible'
  document.addCommentForm.huskId.value=vId;
  }

 function saveComment()
  {
  if (document.addCommentForm.komText.value.length==0)
     {
     tekst = "Du har ikke skrevet noget tekst!."
     advarsel(tekst,210,100,tempY+20,tempX,0)
      return;
     }

  xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
      {
      alert ("Your browser does not support AJAX!");
      return;
      }

  var vStreng = ""
  vStreng = document.addCommentForm.komMail.value+'|'+
                 document.addCommentForm.komText.value+'|'+
                 document.addCommentForm.huskId.value+'|'

  targetStr = "&"
  replaceStr = "%26"; 
  resultStr1 = vStreng.replace(new RegExp(targetStr, "g"), replaceStr);            
 
  lStreng = resultStr1
  targetStr = "\n"
  replaceStr = "L_S"    
  resultStr2 = lStreng.replace(new RegExp(targetStr, "g"), replaceStr);

  url="saveComment.asp?streng="+resultStr2;


   xmlHttp.onreadystatechange=saveCommentChanged;
   xmlHttp.open("POST",url,true);
   xmlHttp.send('');

  }

function saveCommentChanged() {
  if (xmlHttp.readyState==4)
    {
    document.addCommentForm.komMail.value="";
    document.addCommentForm.komText.value="";
    document.getElementById('addComment').style.visibility='hidden'
    oStr = xmlHttp.responseText;
    fillRL('fillBlog.asp',1,'fane4')    
    }
}

function showPw()
{
document.getElementById('checkPw').style.visibility='visible'
}

function kontaktLeve()
{
 vValid = 1
 var tekst = ""
 if (document.getElementById('vNavn').value.length==0)
    {
    vValid = 0
    tekst = "Feltet Navn skal udfyldes!"
    }    
 if (document.getElementById('vEmail').value.length==0)
    {
    vValid = 0
    tekst = "Email adresse?"
    }
 if (document.getElementById('vText').value.length==0)
    {
    vValid = 0
    tekst = "Du har ikke skrevet i tekstfeltet!"
    }   
 if (vValid==0)
    {   
    action = window.setTimeout("advarsel('"+tekst+"',210,100,tempY+20,tempX,0)",100);
    //advarsel(tekst,210,100,tempY+20,tempX,0)
    return;
    }
  if ((document.getElementById('vEmail').value.indexOf("@") < 0) || (document.getElementById('vEmail').value.indexOf(".") < 0)) {
     advarsel('Email adresse er ikke korrekt!',210,100,tempY+20,tempX,0)
     document.getElementById('vEmail').focus();
     return;
     }    
  var vStreng = ""
  vStreng = document.getElementById('vNavn').value+'|'+
            document.getElementById('vEmail').value+'|'+
            document.getElementById('vText').value+'|'
 targetStr = "&"
 replaceStr = "%26"; 
 resultStr1 = vStreng.replace(new RegExp(targetStr, "g"), replaceStr);            
 
 lStreng = resultStr1
 targetStr = "\n"
 replaceStr = "L_S"    
 resultStr2 = lStreng.replace(new RegExp(targetStr, "g"), replaceStr); 
    
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }
   
 url="kontaktLeve.asp?streng="+resultStr2;
 xmlHttp.onreadystatechange=kontaktDone;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');  
}

function kontaktDone()
{
  if (xmlHttp.readyState==4)
    {
     advarsel('Tak for din henvendelse! Jeg vil svare snarest muligt',210,100,200,400,0)
    }
}


listeVar=0
function liste()
{

if (listeVar==0)
 { 
 listeVar=1;
 document.getElementById('listText').innerHTML="Skjul plan"
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }

 url="liste.asp";

 xmlHttp.onreadystatechange=listeChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');
 }
else
 {
 listeVar=0;
 document.getElementById('enPlan').innerHTML="" 
 document.getElementById('listText').innerHTML="En plan kunne se sådan ud"
 }
}

function listeChanged() {
  if (xmlHttp.readyState==4)
    {
    oStr = xmlHttp.responseText;
    document.getElementById('enPlan').innerHTML=oStr;
    }
}

function betingelser()
{
  vTop = (tempY+50)+'px' 
  vLeft = (tempX-100)+'px'
 window.open("betingelser.html","","width=550px, height=645px, left="+vLeft+", top="+vTop+", resizable=no, scrollbars=no, menubar=no, toolbar=no, directories=no, location=no, status=no");
}


function fillLpage(vId)
{

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="fillLpage.asp?vareId="+vId;


 xmlHttp.onreadystatechange=fillLpageChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');

}

function fillLpageChanged() {
  if (xmlHttp.readyState==4)
    {
    oStr = xmlHttp.responseText;
    document.getElementById('scrollArea').innerHTML=oStr;
    }
}

//
function lpInBasket(vVare_id,vAntal,vLpage)
   {
 

 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
   {
   alert ("Your browser does not support AJAX!");
   return;
   }


 url="putInBasket.asp?vare_id="+vVare_id+"&antal="+vAntal+"&lPage="+vLpage;


 xmlHttp.onreadystatechange=lpInBasketChanged;
 xmlHttp.open("POST",url,true);
 xmlHttp.send('');


}


function lpInBasketChanged() {

  if (xmlHttp.readyState==4)
    {
    

    oStr = xmlHttp.responseText;
    if (oStr.indexOf("|") != -1)
       {
        //alert(oStr.substring(1))
    action = window.setTimeout("advarsel('Der er kun '+oStr.substring(1)+' stk. på lager',180,80,tempY+20,tempX-200,0)",10);
       }
    else
       { 
        viewBasket();
       }


    }
}
function download02(vFile)
{

 url="downloadInChunks.asp?file="+vFile;
 location.href=url;

}
