// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function OpenPopup(sPicURL)
{    window.open("http://www.ggweb.nl/popup.php?"+sPicURL, "Vergroting", "resizable=0,HEIGHT=220,WIDTH=220");
} 
function changeImage(Obj)
{
	if( document.getElementById('big') ) 
	{
		document.getElementById('big').src = Obj.src;
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
jQuery(document).ready(function($){
	jQuery('#sfeer').cycle({ 
    fx:    'fade', 
    speed:  1200 
	});
/*$("#slider").simplyScroll({
			autoMode: 'loop',
			pauseOnHover: false,
			frameRate: 25,
			speed: 1,
			horizontal : true,
			autoMode : false
		});*/
	
		$("#slider").smoothDivScroll({ 
			autoScroll: "onstart", 
			autoScrollDirection: "backandforth", 
			autoScrollStep: 1, 
			autoScrollInterval: 15, 
			startAtElementId: "startAtMe", 
			visibleHotSpots: "always"
		
			});


	jQuery('#bigsfeer').cycle({ 
    fx:    'fade', 
    speed:  1200 
	});
	jQuery("a.photobox").fancybox({
	'zoomSpeedIn':	0, 
	'zoomSpeedOut':	0,
	'frameWidth':	600, 
	'frameHeight':	832,
	'overlayShow': true,
	'overlayOpacity': 0.8,
	'hideOnContentClick': false
	}); 

	
});
jQuery(function($) {
	$(".product img").reflect({/* Put custom options here */});
});

jQuery(function($) {
	$(".reflect").reflect({/* Put custom options here */});
});
  
  
function onNL100Change(){
	prijs = 9.87394958;
	aantal = document.offerteformulier.aantalsp.value;
	brutobig = prijs*aantal;
	nettobig = brutobig*1.19;
	brutoam = roundNumber(brutobig,2);
	nettoam = roundNumber(nettobig,2);
	fullnetto = nettoam.toFixed(2);
	bruto = addCommas(brutoam);
	netto = addCommas(fullnetto);
	document.offerteformulier.sp2.value= bruto;
	addNetto();
}
function onNL25Change(){
	prijs = 10.9243697;
	aantal = document.offerteformulier.aantalhp.value;
	brutobig = prijs*aantal;
	nettobig = brutobig*1.19;
	brutoam = roundNumber(brutobig,2);
	nettoam = roundNumber(nettobig,2);
	fullnetto = nettoam.toFixed(2);
	bruto = addCommas(brutoam);
	netto = addCommas(fullnetto);
	document.offerteformulier.hp2.value= bruto;
	addNetto();
}
function onNL5Change(){
	prijs = 4.87394958;
	aantal = document.offerteformulier.aantalsv.value;
	brutobig = prijs*aantal;
	nettobig = brutobig*1.19;
	brutoam = roundNumber(brutobig,2);
	nettoam = roundNumber(nettobig,2);
	fullnetto = nettoam.toFixed(2);
	bruto = addCommas(brutoam);
	netto = addCommas(fullnetto);
	document.offerteformulier.sv2.value= bruto;
	addNetto();
}
function onNL45Change(){
	prijs = 1.93277311;
	aantal = document.offerteformulier.aantalsvw.value;
	brutobig = prijs*aantal;
	nettobig = brutobig*1.19;
	brutoam = roundNumber(brutobig,2);
	nettoam = roundNumber(nettobig,2);
	fullnetto = nettoam.toFixed(2);
	bruto = addCommas(brutoam);
	netto = addCommas(fullnetto);
	document.offerteformulier.svw2.value= bruto;
	addNetto();
}
function onNL75Change(){
	prijs = 2.31092437;
	aantal = document.offerteformulier.aantalspa.value;
	brutobig = prijs*aantal;
	nettobig = brutobig*1.19;
	brutoam = roundNumber(brutobig,2);
	nettoam = roundNumber(nettobig,2);
	fullnetto = nettoam.toFixed(2);
	bruto = addCommas(brutoam);
	netto = addCommas(fullnetto);
	document.offerteformulier.spa2.value= bruto;
	addNetto();
}

function addNetto(){
	prijs1 = 9.87394958;
	prijs2 = 10.9243697;
	prijs3 = 4.87394958;
	prijs4 = 1.93277311;
	prijs5 = 2.31092437;
	var product1 = document.offerteformulier.aantalsp.value;
	var product2 = document.offerteformulier.aantalhp.value;
	var product3 = document.offerteformulier.aantalsv.value;
	var product4 = document.offerteformulier.aantalsvw.value;
	var product5 = document.offerteformulier.aantalspa.value;
	
	totaal1 = prijs1*product1;
	totaal2 = prijs2*product2;
	totaal3 = prijs3*product3;
	totaal4 = prijs4*product4;
	totaal5 = prijs5*product5;
	brutototaal1 = totaal1+totaal2+totaal3+totaal4+totaal5;
	nettototaal1 = brutototaal1*1.19;
	btw = nettototaal1-brutototaal1;
	brutototaaldot= roundNumber(brutototaal1,2); 
	nettototaaldot= roundNumber(nettototaal1,2);
	btwtotaaldot = roundNumber(btw,2);
	fullbruto= brutototaaldot.toFixed(2); 
	fullnetto = nettototaaldot.toFixed(2);
	fullbtw = btwtotaaldot.toFixed(2);
	nettototaal = addCommas(fullnetto);
	brutototaal = addCommas(fullbruto);
	btwtotaal = addCommas(fullbtw);
	document.offerteformulier.nettototaal.value= nettototaal;
	
	document.offerteformulier.nettototaal1.value= brutototaal;
	document.offerteformulier.btwtotaal.value= btwtotaal;
	
}


function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? ',' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1 + x2;
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}
