function recalcportieprijs(art)
{
var prijsgew=document.getElementById("prijsgewicht"+art).value;
var basisprijs=document.getElementById("basisprijs"+art).value;
var portieprijs=document.getElementById("portieprijs"+art);
var portielist=document.getElementById("oaportiegew"+art);
var portiesel=portielist.selectedIndex;
var portiegew=portielist.options[portiesel].value;
var pp=(portiegew/prijsgew)*basisprijs;
portieprijs.innerHTML="&euro; "+pp.toFixed(2);
}
function aboshow(src)
{
document.getElementById("aboshow").style.background = "url(/img/imgart/"+src+")"; 
document.getElementById("aboshow").style.backgroundPosition="center";
}

function upd_ww_status(wwstatus)
{
document.getElementById("wwstatus").innerHTML=wwstatus;
}
function valideer_stappen(stap1,stap2,stap3,stap4,stap5)
{
var errors="";
if (stap1)
{
// bezorgdatum gekozen
if (!document.getElementById("slotkeuzecode").value)
  {errors+="U heeft nog geen bezorgtijdstip gekozen bij Stap "+stap1+".<br/>";}
}
if (stap3)
{
for (var i=0; i < document.orderform.aflid.length; i++)
   {
   if (document.orderform.aflid[i].checked && document.orderform.aflid[i].value==3)
      {
       if (!document.getElementById("katv").value) {errors+="U heeft nog geen TAV gevuld bij het afwijkende afleveradres bij Stap "+stap3+".<br/>";}
       if (!document.getElementById("kaad").value) {errors+="U heeft nog geen Adres gevuld bij het afwijkende afleveradres bij Stap "+stap3+".<br/>";}
       if (!document.getElementById("kapc").value) {errors+="U heeft nog geen Postcode gevuld bij het afwijkende afleveradres bij Stap "+stap3+".<br/>";}
       if (!document.getElementById("kapl").value) {errors+="U heeft nog geen Plaatsnaam gevuld bij het afwijkende afleveradres bij Stap "+stap3+".<br/>";}
      }
   }
}
if (stap2)
{
if (document.getElementById("kado").checked && document.getElementById("kadotext").value=="Hier kunt u uw persoonlijke boodschap aan de ontvanger schrijven. De boodschap komt in plaats van de factuur")
    {errors+="U heeft nog geen persoonlijke boodschap gevuld bij stap "+stap2+".<br/>";}
}
if (stap4)
{
var bwchosen;
for (var i=0; i < document.orderform.bwid.length; i++)
   {
   if (document.orderform.bwid[i].checked)
      {bwchosen=1;}
   }
//if (!bwchosen) {errors+="U heeft nog geen betaalwijze aangegeven bij Stap "+stap4+".<br/>";}
}
if (stap5)
{
if (!document.getElementById("acclevvw").checked)  {errors+="U dient de algemene voorwaarden te accepteren bij stap "+stap5+" om uw bestelling te kunnen afronden.<br/>";}
}

if (errors) {document.getElementById("validationerrors").innerHTML=errors; document.getElementById("validationerrors").style.display="block"; return false;}
else {document.getElementById("valok").value=1; document.getElementById("orderform").submit();}
}
function selectslot(slot)
{
var slotb=new Array();
slotb=document.getElementsByName("slotb");
for (var i=0;i<42;i++)
  {if(document.getElementById("slot"+i))
     {if (document.getElementById("slot"+i).className=="slotsel")
        {document.getElementById("slot"+i).className="slotb";}
     }
  }
document.getElementById(slot).className="slotsel";
document.getElementById("slotkeuze").innerHTML="Uw keuze: "+document.getElementById(slot+"lab").value;
document.getElementById("slotkeuzecode").value=document.getElementById(slot+"code").value;
}
function xmlhttpPost(strURL,pars) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    if (pars.substr(0,7)=="direct=")
     { 
      self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            directbestelpopup(self.xmlHttpReq.responseText);
        }
      }
     }
    else if (pars.substr(0,17)=="updatewinkelmand=")
     {
      self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatewinkelmand(self.xmlHttpReq.responseText);
        }
      }
     }
    self.xmlHttpReq.send(pars);
}
function directbestelpopup(str){
       var sections=str.split(";#;");
       document.getElementById("directpopupcenter").innerHTML=sections[0];
       document.getElementById("directpopup").style.display="block";
       document.getElementById("directpopupbottom").innerHTML="<a href=\"?pid="+sections[1]+"&###sid###\">Uitgebreide productinformatie</a>&nbsp;";
      }
function updatewinkelmand(str){
       var sections=str.split(";#;");
       var wws="<div id=\"wws\" class=\"statusnew\">"+sections[0]+"</div>";
       flashnew("wws");
       document.getElementById("wwstatus").innerHTML=wws;
       document.getElementById("wwmain").innerHTML=sections[1];
       document.getElementById("wwtotaal").innerHTML=sections[2];
       document.getElementById("wwtotaalmain").innerHTML=sections[2];
       document.getElementById("bezorgbijdragemain").innerHTML=sections[3];
      }
function flashnew(obj)
{
setTimeout("document.getElementById(\""+obj+"\").className=\"statusold\";",1500);
}
function wwupd (sid,oaid,aant)
{
//alert (sid+" "+oaid+" "+aant);
xmlhttpPost("?","updatewinkelmand=1&sid="+sid+"&oaid="+oaid+"&oaaant="+aant);
}

function showcb(num)
{
document.getElementById("carrouselimg0").innerHTML=document.getElementById("carrouselimg"+num).innerHTML;

for(i=1;i<=carrouselcount;i++)
  {document.getElementById("carrouselblok"+i).className="carrouselblok_na";}
document.getElementById("carrouselblok"+num).className="carrouselblok_mo";
}
function stopcarrousel(num)
{
running=0;
showcb(num);
}
function resumecarrousel(numov,start)
{
if (numov) {num=numov;}
if (start) 
   {running=1;}
else
  {
   if (running)
     { num++;
      if (num>carrouselcount) {num=1;}
      showcb(num);
     }
  }
if (!start) {setTimeout("resumecarrousel();",4000);}
}
var carrouselcount;
var num;
var running;

