
pic1= new Image(118,19);
pic1.src="http://www.polsbandjes.eu/layout/knop2-over.png";
pic2= new Image(118,19);
pic2.src="http://www.polsbandjes.eu/layout/knop3-over.png";

// ---------------------------------------------------------------------------------------------------

function BeginCenter()
{
 document.write("<center>");
}

// ---------------------------------------------------------------------------------------------------

function EindeCenter()
{
 document.write("</center>");
}

// ---------------------------------------------------------------------------------------------------

function popUp(URL)
{
 day = new Date();
 id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500');");
}

// ---------------------------------------------------------------------------------------------------

function makeTxt(id)
{
 var obj = document.getElementById(id);
 txt = document.MyForm.TekstEen.value; // haal de tekst uit het formulier
 document.getElementById(id).innerHTML = txt;

 id="FotoHouder";
 txt="";
 if (document.MyForm.FotoEen.value!="") { txt = "<img src=\"/"+document.MyForm.FotoEen.value+"\" xheight=\"45\" align=\"left\" >"; }
 //  style=\"Filter: Chroma(Color = #FFFFFF)\"
 document.getElementById(id).innerHTML = txt;

 checkPrijs(); // de prijs check voor lege bandjes
}

// ---------------------------------------------------------------------------------------------------

function AfrondenBedrag(Param)
{
 Param=Param.toFixed(2);
 if (Param>1000)
 {
  Groot=Math.floor(Param/1000);
  Klein=Param-(Groot*1000);
  Klein=Klein.toFixed(2);
  Klein=Klein.replace(".",",");
  Param=Groot+"."+Klein;
 }
 else
 {
  Param=Param.replace(".",",");
 }
 Param="€ "+Param;
 return Param;
}

// ---------------------------------------------------------------------------------------------------

function restoreTxt(id,Tekzt)
{
 var obj = document.getElementById(id);
 document.MyForm.TekstEen.value = Tekzt;
 document.getElementById(id).innerHTML = Tekzt;
}

// ---------------------------------------------------------------------------------------------------

function changeProdNr(Param)
{
 document.MyForm.productnr.value = Param;
 document.MyForm.action = "s-v-prodsoort.php";
 document.MyForm.submit();
}

// ---------------------------------------------------------------------------------------------------

function restoreAantal(Tekzt)
{
 document.MyForm.aantal.value = Tekzt;
}

// ---------------------------------------------------------------------------------------------------

function checkPrijs()
{
 ToT=0;
 SuB=0;

 Aantal=Math.round(document.MyForm.aantal.value);	// aantal afronden
 if (isNaN(Aantal)) { Aantal=10; }			// als geen getal dan 10
 Aantal=Math.ceil(Aantal/10)*10;			// altijd met 10-tallen werken
 document.MyForm.aantal.value=Aantal;			// afgerond aantal terugkoppelen

 var Pregel=new Array();
 if (document.MyForm.productnr.value==2)	{ Pregel=Tyvek25Pregel; } // tyvek25 prijzen
 else						{ Pregel=Tyvek19Pregel; } // tyvek19 prijzen

 DeRegel=1; i=0; Zelected=0; // de juiste prijs regel bepalen
 while(i < (Pregel.length - 1) )
 {
  i++;
  if ( (Aantal >= Pregel[i][0]) && (Aantal <= Pregel[i][1]) ) { DeRegel=i; Zelected=1; }
 }
 if (Zelected==0) { DeRegel=(Pregel.length - 1); } // als het aantal groter is dan het max aantal uit de prijslijst

 StuksPrijs=Pregel[DeRegel][2]/100; // (de tabel is nog een prijs per 100)
 SuB=Math.round((Aantal * StuksPrijs)*100)/100;
 document.MyForm.BasisPrijs.value = AfrondenBedrag(SuB);

 Designkosten=0;
 document.MyForm.OntwerpPrijs.value = AfrondenBedrag(Math.round(Designkosten*100)/100);

 StuksPrijs=(Pregel[DeRegel][3]-Pregel[DeRegel][2])/100; // (de tabel is nog een prijs per 100)
 Drukkosten=Math.round((Aantal * StuksPrijs)*100)/100;
 if ((document.MyForm.FotoEen.value=="")&&(document.MyForm.TekstEen.value=="")) { Drukkosten=0; } // als er geen opdruk is
 document.MyForm.BedrukkingPrijs.value = AfrondenBedrag(Math.round(Drukkosten*100)/100);


 Opstartkosten=0;
 if (Aantal<1000) { Opstartkosten=15; }
 document.MyForm.OpstartKosten.value = AfrondenBedrag(Math.round(Opstartkosten*100)/100);


 SuB=Math.round((SuB+Designkosten+Drukkosten+Opstartkosten)*100)/100;
 document.MyForm.SubTotaal.value = AfrondenBedrag(SuB);
 document.MyForm.SubBedrag.value = SuB.toFixed(2); // de waarde die wordt opgeslagen



// if (document.MyForm.AndereArtikelen.value!="0")
// {
//  AnArt=document.MyForm.AndereArtikelen.value.replace("€ ","");
//  AnArt=AnArt.replace(".","");
//  AnArt=AnArt.replace(",",".");
//  ZuB=Math.round((SuB+Designkosten+Drukkosten)*100)/100;
//  SuB=ZuB+Bedrag;
// }



 VerzendKosten=10;
 SuB=SuB+VerzendKosten;
 document.MyForm.VerzendPrijs.value = AfrondenBedrag(VerzendKosten);

 ToT=SuB*1.19;
 document.MyForm.TotaalPrijs.value = AfrondenBedrag(ToT);

 BtW=Math.round(ToT-SuB);
 document.MyForm.BtwPrijs.value = AfrondenBedrag(BtW);
}

// ---------------------------------------------------------------------------------------------------

function changeBackground(Param)
{
 Ext="gif";
 if (Param>2050) { Ext="png"; }
 if (Param==2065) { Ext="gif"; }
 if (Param==2066) { Ext="gif"; }
 document.getElementById("Bandje").style.background = "url(/images/"+Param+"."+Ext+")";
 document.getElementById("Bandje").style.backgroundPosition = "center";
 document.MyForm.Achtergrond.value = Param;
}

// ---------------------------------------------------------------------------------------------------

function changeKleur(Param)
{
 document.getElementById("Bandje").style.color=Param;
 document.MyForm.Drukkleur.value = Param;
}

// ---------------------------------------------------------------------------------------------------

function changeFontSize(Param)
{
 selInd = document.MyForm.FontSizeEen.selectedIndex;
 Param = document.MyForm.FontSizeEen.options[selInd].value;
 document.getElementById("Bandje").style.fontSize = Param+"px";
}

// ---------------------------------------------------------------------------------------------------

function restoreFontSize(Param)
{
 // de CSS waarde instellen
 document.getElementById("Bandje").style.fontSize = Param+"px";

 // de pulldown instellen
 for (var i=0; i <99 ; i++)
 {
	var d=0;
	d=document.MyForm.FontSizeEen.options[i].value;
	if(d==Param)
	{
		document.MyForm.FontSizeEen.options[i].selected=true;
		break;
	}
 }
}

// ---------------------------------------------------------------------------------------------------

function restoreFontSizeV2(Param)
{
 // de CSS waarde instellen
 Param = document.MyForm.FontSizeEen.value;
 document.getElementById("Bandje").style.fontSize = Param+"px";
}

// ---------------------------------------------------------------------------------------------------

function changeFontFamily(Param)
{
 selInd = document.MyForm.FontFamilyEen.selectedIndex;
 Param = document.MyForm.FontFamilyEen.options[selInd].value;
 document.getElementById("Bandje").style.fontFamily = Param;
}

// ---------------------------------------------------------------------------------------------------

function restoreFontFamily(Param)
{
 // de CSS waarde instellen
 document.getElementById("Bandje").style.fontFamily = Param;

 // de pulldown instellen
 for (var i=0; i <99 ; i++)
 {
	var d=0;
	d=document.MyForm.FontFamilyEen.options[i].value;
	if(d==Param)
	{
		document.MyForm.FontFamilyEen.options[i].selected=true;
		break;
	}
 }
}

// ---------------------------------------------------------------------------------------------------

function restoreFontFamilyV2(Param)
{
 // de CSS waarde instellen
 Param = document.MyForm.FontFamilyEen.value;
 document.getElementById("Bandje").style.fontFamily = Param;
}

// ---------------------------------------------------------------------------------------------------

function changeFotoEen(Param)
{
 selInd = document.MyForm.FotoEenSel.selectedIndex;
 Param = document.MyForm.FotoEenSel.options[selInd].value;
 document.MyForm.FotoEen.value = Param;

 makeTxt('TekstHouder');
}

// ---------------------------------------------------------------------------------------------------

function restoreFotoEen(Param)
{
 document.MyForm.FotoEen.value = Param;

 // de pulldown instellen
 for (var i=0; i <99 ; i++)
 {
	var d=0;
	d=document.MyForm.FotoEenSel.options[i].value;
	if(d==Param)
	{
		document.MyForm.FotoEenSel.options[i].selected=true;
		break;
	}
 }
}

// ---------------------------------------------------------------------------------------------------

function saveVoorUploaden()
{
 document.MyForm.action = "s-v-upl.php";
 document.MyForm.submit();
}

// ---------------------------------------------------------------------------------------------------

function submitform()
{
  document.MyForm.submit();
}

// ---------------------------------------------------------------------------------------------------

function ToonAflAdres()
{
 var id = "AflAdres";
 var obj = document.getElementById(id);

 var txt = '<hr class="B5H1">\
\
<p class="Kop">Voer hier het afleveradres van uw bestelling in:</p>\
\
<table border="0" cellpadding="0" cellspacing="0" class="TabelGrijs" width="385">\
\
<tr>\
<td class="TdR"><b class="Rood">Adres:</b></td>\
<td><input type="text" name="Aflever_adres" size="19" maxlength="50"> <b class="Rood">Huisnr:</b> <input type="text" name="Aflever_huisnummer" size="3"></td>\
</tr>\
\
<tr><td class="MandjeWit">.</td></tr>\
\
<tr>\
<td class="TdR"><b class="Rood">Postcode:</b></td>\
<td><input type="text" name="Aflever_postcode" size="10" maxlength="7"></td>\
</tr>\
\
<tr><td class="MandjeWit">.</td></tr>\
\
<tr>\
<td class="TdR"><b class="Rood">Woonplaats:</b></td>\
<td><input type="text" name="Aflever_plaats" size="35" maxlength="50"></td>\
</tr>\
\
<tr><td class="MandjeWit">.</td></tr>\
\
<tr>\
<td class="TdR"><b class="Rood">Land:</b></td>\
<td><select name="Aflever_land">\
<option value="NL">Nederland</option>\
<option value="BE">België</option>\
</select></td>\
</tr>\
\
</table>\
';

 if (document.getElementById(id).innerHTML=="") { document.getElementById(id).innerHTML = txt; }
 else { document.getElementById(id).innerHTML = ""; }

// document.getElementById(id).innerHTML = txt;
}

// ---------------------------------------------------------------------------------------------------

function ExtraBestelling()
{
 document.MyForm.ExtraBestelling.value = "1";
 javascript:document.MyForm.submit();
}

// EOF -----------------------------------------------------------------------------------------------

