// JavaScript Document

function buttonHighlight (id,status) {
	if(status == 'over') {
		//document.getElementById(id).style.backgroundColor = '#006699';
		document.getElementById(id).style.color = '#E1081E';
	}
	else {
		//document.getElementById(id).style.backgroundColor = '';
		document.getElementById(id).style.color = '#006699';
	}
}

function meerInfo (id) {
	if (document.getElementById('meerinfo' + id).style.display == 'none') {
		document.getElementById('meerinfo' + id).style.display = '';
		document.getElementById('meerinfotekst' + id).innerHTML = 'Verberg extra info';
	}
	else {
		document.getElementById('meerinfo' + id).style.display = 'none';
		document.getElementById('meerinfotekst' + id).innerHTML = 'Toon extra info';
	}
}

function gotoPage (url) {
	location.href = url;
}

var variabelenformsubmit = false
function wijzigWinkelmandje (winkelmandjeactie,id,aantal) {
	if (variabelenformsubmit == false) {
		document.getElementById('winkelartikel_id').value = id;
		document.getElementById('actie').value = "winkelmandje";
		document.getElementById('winkelmandjeactie').value = winkelmandjeactie;
		document.getElementById('aantal').value = aantal;
		document.variabelenform.action = 'winkelmandje.asp';
		document.variabelenform.submit();
		variabelenformsubmit = true
	}
	
}
function bestelWinkelmandje () {
	document.getElementById('actie').value = "bestel";
	document.variabelenform.action = 'bestellen.asp';
	document.variabelenform.submit();
}

function printBestelling (ordernummer) {
	document.getElementById('ordernummer').value = ordernummer;
	document.variabelenform.action = '__winkelbestelling_print.asp';
	document.variabelenform.target = '_blank';
	document.variabelenform.submit();
}

function downloadPDF (file) {
	OpenRequestedPopup (file,"PDF");
}

var WindowObjectReference;
function OpenRequestedPopup(strUrl, strWindowName) {
	if (WindowObjectReference == null || WindowObjectReference.closed) {
		WindowObjectReference = window.open(strUrl, strWindowName, "width=500,height=400,resizable=yes,scrollbars=yes, status=yes");
	}
	else {
		WindowObjectReference.focus();
	}
}

function newWindow(url,windowname,w,h) {
	LPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TPosition = (screen.height) ? (screen.height-h)/2 : 0;
	properties = '';
	properties += 'width=' + w +',';
	properties += 'height=' + h +',';
	properties += 'left=' + LPosition +',';
	properties += 'top=' + TPosition +',';
	properties += 'scrollbars=yes' +',';
	properties += 'resizable=yes' +',';
	properties = properties.substring(0,properties.length-1);
	newwindow=window.open(url,windowname,properties);
	newwindow.focus();
}

function trefwoordZoek () {
	if (document.getElementById('trefwoord_snelzoek').value.length < 3) {
		document.getElementById('trefwoord_snelzoek').style.backgroundColor = '#CC0000';
	}
	else {
		if (variabelenformsubmit == false) {
			document.getElementById('trefwoord').value = document.getElementById('trefwoord_snelzoek').value;
			document.getElementById('actie').value = "zoek";
			document.variabelenform.action = 'winkelartikelen.asp';
			document.variabelenform.submit();
			variabelenformsubmit = true
		}
	}
}

function verderWinkelen () {
	if (variabelenformsubmit == false) {
		document.getElementById('actie').value = "verderwinkelen";
		document.variabelenform.action = 'winkelartikelen.asp';
		document.variabelenform.submit();
		variabelenformsubmit = true
	}
}

function checkEnter(actie,artikel,aantal,e){ 
	var characterCode
	if (e && e.which) { 
		e = e
		characterCode = e.which
	}
	else {
		e = event
		characterCode = e.keyCode
	}
	if (characterCode == 13) {
		wijzigWinkelmandje(actie,artikel,aantal)
		return false
	}
	else {
		return true
	}
}

function download(bestand) {
	location.href = 'download.asp?file=' + bestand;
}
