var nowactive='';
var old='';
function active(im){
	old = nowactive;
	nowactive = im;
	document[im].src = '/img/btn/' + im + '_s.gif';
}
function flipoff(im){
	if (nowactive!=im){
		document[im].src = '/img/btn/' + im + '.gif';
	}
}
function flipon(im){
	document[im].src = '/img/btn/' + im + '_s.gif';
}

var myimg=new Array();
function preloadimg(){
	for (i=0;i<preloadimg.arguments.length;i++){
		myimg[i]=new Image();
		myimg[i].src=preloadimg.arguments[i];
	}
}
preloadimg("/img/btn/welkom_s.gif", "/img/btn/mogelijkheden_s.gif", "/img/btn/klanten_s.gif", "/mg/btn/nieuws_s.gif", "/img/btn/vacatures_s.gif", "/img/btn/login_s.gif", "/img/btn/contact_s.gif", "/img/btn/customers_s.gif", "/img/btn/fotos_s.gif", "/img/btn/introductie_s.gif", "/img/btn/introduction_s.gif", "/img/btn/jobs_s.gif", "/img/btn/login_s.gif", "/img/btn/mogelijkheden_s.gif", "/img/btn/news_s.gif", "/img/btn/possibilities_s.gif", "/img/btn/profiel_s.gif", "/img/btn/uitloggen_s.gif", "/img/btn/vacatures_s.gif");

function checkww(w1, w2, em){
	if (w1!=w2 || em==""){
		alert("De wachtwoorden zijn niet gelijk en/of geen e-mail ingevuld!");
		return false;
	}else{
		return true;
	}	
}

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}

function checknumber(veld, inp, num){
	patroon = /(^-?\d\d*$)/;
	if(parseInt(inp)<parseInt(num) || !patroon.test(num)){
		document.getElementById(veld).value=inp;
		document.getElementById(veld).focus(); 
		document.getElementById(veld).select(); 
		alert('Minimum number of items is '+num+'.'); 
		return false;
	}
}

function check_form(prijs1, prijs2, prijs4)
{
	total = 0;
	
	if (prijs1) { total+= document.getElementById('aantal1').options[document.getElementById('aantal1').selectedIndex].value; }
	if (prijs2) { total+= document.getElementById('aantal2').options[document.getElementById('aantal2').selectedIndex].value; }
	if (prijs4) { total+= document.getElementById('aantal4').options[document.getElementById('aantal4').selectedIndex].value; }
	
	if (total== 0) {
		alert ('U dient een aantal aan te geven.');
	}
	else {
		document.pForm.submit();
	}	
}


function subit(actie, twyp){
	//update cart
	if(actie=='p'){
		document.pForm.submit();
	//update cart
	}else if(actie=='u'){
		document.cForm.action.value='update';
		document.cForm.submit();
	//checkout
	}else if(actie=='c'){
		document.cForm.action.value='checkout';
		document.cForm.submit();
	//volgende stap in checkout
	}else if(actie=='n'){
		document.oForm.submit();
	//bestelling voltooien
	}
	else if(actie=='a'){
		document.oForm.promocodeset.value='1';
		document.oForm.submit();
	//bestelling voltooien
	}else if(actie=='r'){
		if(twyp=='ideal' && document.getElementById('issuerID').options[document.getElementById('issuerID').selectedIndex].value==0){
			alert('Kies uw bank.');
		}
		else if(document.getElementById('agree').checked!=1){
			alert('Ga akkoord met onze algemene voorwaarden.');
		}
		else{
			document.oForm.submit();
		}
	}
}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;

function checkmail(e){
	var returnval=emailfilter.test(e.value);
	if (returnval==false){
		alert("Geldig e-mail adres invullen a.u.b.!");
		e.select();
		return false;
	}else{
		return true;
	}	
}
