/************************************************************************************************************
(C) www.dhtmlgoodies.com, September 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
See http://www.dhtmlgoodies.com/index.html?page=termsOfUse

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/		

var slideDownInitHeight = new Array();
var slidedown_direction = new Array();

var slidedownActive = false;
var contentHeight = false;
var slidedownSpeed = 3; 	// Higher value = faster script
var slidedownTimer = 7;	// Lower value = faster script
function slidedown_showHide(boxId)
{
	if(!slidedown_direction[boxId])slidedown_direction[boxId] = 1;
	if(!slideDownInitHeight[boxId])slideDownInitHeight[boxId] = 0;
	
	if(slideDownInitHeight[boxId]==0)slidedown_direction[boxId]=slidedownSpeed; else slidedown_direction[boxId] = slidedownSpeed*-1;
	
	slidedownContentBox = document.getElementById(boxId);
	var subDivs = slidedownContentBox.getElementsByTagName('DIV');
	for(var no=0;no<subDivs.length;no++){
		if(subDivs[no].className=='dhtmlgoodies_content')slidedownContent = subDivs[no];	
	}
	contentHeight = slidedownContent.offsetHeight;

	slidedownContentBox.style.visibility='visible';
	slidedownActive = true;
	slidedown_showHide_start(slidedownContentBox,slidedownContent);
}


function slidedown_showHide_start(slidedownContentBox,slidedownContent)
{

	if(!slidedownActive)return;
	slideDownInitHeight[slidedownContentBox.id] = slideDownInitHeight[slidedownContentBox.id]/1 + slidedown_direction[slidedownContentBox.id];
	if(slideDownInitHeight[slidedownContentBox.id] <= 0){
		slidedownActive = false;	
		slidedownContentBox.style.visibility='hidden';
		slideDownInitHeight[slidedownContentBox.id] = 0;
	}
	if(slideDownInitHeight[slidedownContentBox.id]>contentHeight){
		slidedownActive = false;	
	}
	slidedownContentBox.style.height = slideDownInitHeight[slidedownContentBox.id] + 'px';
	slidedownContent.style.top = slideDownInitHeight[slidedownContentBox.id] - contentHeight + 'px';

	setTimeout('slidedown_showHide_start(document.getElementById("' + slidedownContentBox.id + '"),document.getElementById("' + slidedownContent.id + '"))',slidedownTimer);	// Choose a lower value than 10 to make the script move faster
}

function setSlideDownSpeed(newSpeed)
{
	slidedownSpeed = newSpeed;
	
}

function openClose(boxId,pijlnaam) {
	if (document.getElementById('pijl_' + boxId).src.indexOf('dicht.png') == -1) {
		document.getElementById('pijl_' + boxId).src = 'images/' + pijlnaam + '_dicht.png';
	}
	else {
		document.getElementById('pijl_' + boxId).src = 'images/' + pijlnaam + '_open.png';
	}
}

function openSubMenu (id) {
	if (document.getElementById('img_' + id) && document.getElementById('row_' + id)) {
		if (document.getElementById('row_' + id).style.display == '') {
			document.getElementById('img_' + id).src = 'images/pijl_wit_dicht.png';
		}
		else {
			document.getElementById('img_' + id).src = 'images/pijl_wit_open.png';
		}
	}
	if (document.getElementById('row_' + id)) {
		if (document.getElementById('row_' + id).style.display == '') {
			document.getElementById('row_' + id).style.display = 'none';
			myString = new String(document.getElementById('rubrieken_open').value);
			rExp = eval('/"' + id + '",/g');
			document.getElementById('rubrieken_open').value = myString.replace(rExp,'');
		}
		else {
			document.getElementById('row_' + id).style.display = '';
			document.getElementById('rubrieken_open').value = '"' + id + '",' + document.getElementById('rubrieken_open').value;
		}
	}
}

function submitNavForm (id) {
	document.getElementById('siterubriek_id').value = id;
	document.navigatieform.submit();
}

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 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
	}
}