function ARR_kl(ELEM,RETURN){
	if(RETURN == 'RETURN'){ if(ELEM.match("#") != null){ for(i=0; i < ARR_kleur.length; i++){ if(ARR_kleur[i][0] == ELEM){ return ARR_kleur[i][1]; } } } else { return 'geen kleur opgegeven'; } }
	else{ var STR = document.getElementById(ELEM).value; for(i=0; i < ARR_kleur.length; i++){ if(ARR_kleur[i][0] == STR){ document.getElementById('sp_' + ELEM).innerText = ARR_kleur[i][1]; } } }
}

function RESET(ELEM){ 
	if(ELEM == 'groenblijvend' || ELEM == 'kluit'){ document.getElementById(ELEM).value = ""; document.getElementById('JN').src = "images/JN_.png"; }
	else { document.getElementById(ELEM).value = ''; document.getElementById('sp_' + ELEM).innerText = ''; document.getElementById(ELEM).style.backgroundColor = 'transparent'; }
}

function CHECK_JN(ELEM,INP){
	if(ELEM.name == "JN_Nee" || ELEM.name == ""){ ELEM.src = "images/JN_Ja.png"; ELEM.name = "JN_Ja"; document.getElementById(INP).value = "Ja"; } 
	else { ELEM.src = "images/JN_Nee.png"; ELEM.name = "JN_Nee"; document.getElementById(INP).value = "Nee"; }
}

function CHECK_KORTING(PRIJS,KORTING,RETURN){ //alert(PRIJS+'-'+KORTING)
	if(RETURN != 'RETURN' && RETURN != 'PRIJS'){ var PRIJS = document.getElementById("prijs").value; var KORTING = document.getElementById("korting").value; }
	if(PRIJS == ''){ PRIJS = '0'; } if(KORTING == '' || KORTING == 0 || KORTING == '0'){ KORTING = '0'; } 
		NEW = (PRIJS / 100) * (100 - KORTING);
	if(KORTING == '0' || PRIJS == '0'){ MSG = '&euro;' + PRIJS; } else { 
		MSG = 'Van <span style="text-decoration: line-through;">&euro;' + PRIJS + '</span> nu voor <b><span style="color: red;">&euro;' + CUR_validator(NEW,'NOINPUT') + '!</span></b> (<b>' + KORTING + '%</b> korting)'; 
	}
	if(RETURN == 'RETURN'){ return MSG; }
	else if(RETURN == 'PRIJS'){ if(KORTING == '0'){
		return '<i>'+CUR_validator(PRIJS,'NOINPUT')+'</i>';
	} else { return '<small><i><span style="text-decoration: line-through;color: #333;">'+CUR_validator(PRIJS,'NOINPUT')+'</span> <span style="color: #CA0000;">&euro;'+CUR_validator(NEW,'NOINPUT')+'</span></i></small>'; } }
	else{ document.getElementById("sp_prijs").innerHTML = MSG; }
}

function SLIDE(ELEM,RETURN){
	try{
		var Le = $('#slider').slider('values')[0] + 1;
		var Ri = $('#slider').slider('values')[1] + 1;
		
			if(Le > Ri){ Le = Le - 12; }
		
		if(document.all){
			var LeSTR = document.getElementById('M'+Le).innerText;
			var RiSTR = document.getElementById('M'+$('#slider').slider('values')[1]).innerText;
		} else{
			var LeSTR = document.getElementById('M'+Le).textContent;
			var RiSTR = document.getElementById('M'+$('#slider').slider('values')[1]).textContent;
		}
		
			for(i=1; i < 25; i++){ document.getElementById('M'+i).style.backgroundColor = 'transparent'; }
			for(i=Le; i < Ri; i++){ document.getElementById('M'+i).style.backgroundColor = '#033'; }
		
			if(LeSTR == RiSTR){ STR = LeSTR; } 
			else if(Le == Ri){ STR = ''; } 
			else if(Le == 1 && Ri == 13 || Le == 1 && Ri == 25 || Le == 13 && Ri == 25){ STR = 'Hele jaar'; } 
			else { STR = LeSTR + ' t/m ' + RiSTR; }
		
		document.getElementById(ELEM).value = STR;
			
			if(RETURN == 'RETURN'){ return STR; }
	}catch(err){}
}

function SetSLIDE(ELEM){
	var blt = document.getElementById(ELEM).value;
	if(blt.match("jaar") != null){
		$('#slider').slider('values',0,0); $('#slider').slider('values',1,12);
	}
	else if(blt.length > 2){
		blt = blt.split(" t/m "); var SLD1 = 0; var SLD2 = 0;
		
		var ARR = new Array("JAN","FEB","MAA","APR","MEI","JUN","JUL","AUG","SEP","OKT","NOV","DEC");
		
		for(i=0; i < ARR.length; i++){ if(ARR[i] == blt[0]){ SLD1 = i; } if(blt[1] != null){ if(ARR[i] == blt[1]){ SLD2 = i + 1; } } }
			if(SLD2 != 0){ if(SLD1 > SLD2){ SLD2 = SLD2 + 12; } }
		
		$('#slider').slider('values',0,SLD1);
		if(SLD2 != 0){ $('#slider').slider('values',1,(SLD2*1)); } else { $('#slider').slider('values',1,(SLD1+1)); }
	}
}

function Mover(a){ a.style.color = "#D3FF5B" } function Mout(a){ a.style.color = "#C177FF" }
function OpenPages(){ var d = document.getElementById("DIVpage"); if(d.style.display == "none"){ d.style.display = "block" } else{ d.style.display = "none" } }
function printDIV(){ var a = window.open('','','width=300,height=300'); a.document.open("text/html"); a.document.write(document.getElementById('DIVmain').innerHTML); a.document.close(); a.print(); a.close();}

function ZOEK(SEL,STR,LIST,LIMIT,SHOW){
	if(LIMIT == null){ LIMIT = ''; } if(SHOW == null){ SHOW = ''; } 
	var AHREF = '';
	if(SEL == null){ 
		var SEL = document.getElementById('SEL_CAT').value; var STR = document.getElementById('INP_ZOEK').value;
		if(STR.match(' ') != null){
			var SPL = STR.split(' '); 
				AHREF += SEL + ' LIKE "%' + SPL[0] + '%" OR ' + SEL + ' LIKE "' + SPL[0] + '%" OR ' + SEL + ' LIKE "%' + SPL[0] + '"'; 
				if(SEL == 'naam'){ AHREF += ' OR latijn LIKE "%' + SPL[0] + '%" OR latijn LIKE "' + SPL[0] + '%" OR latijn LIKE "%' + SPL[0] + '"'; } 
			for(i=1; i<SPL.length; i++){ if(SPL[i].length > 1){ 
				AHREF += ' OR ' + SEL + ' LIKE "%' + SPL[i] + '%" OR ' + SEL + ' LIKE "' + SPL[i] + '%" OR ' + SEL + ' LIKE "%' + SPL[i] + '" '; 
				if(SEL == 'naam'){ AHREF += ' OR latijn LIKE "%' + SPL[i] + '%" OR latijn LIKE "' + SPL[i] + '%" OR latijn LIKE "%' + SPL[i] + '"'; 
			} } }
		}
		else{ 
			if(SEL == 'naam'){ AHREF = SEL + ' LIKE "%' + STR + '%" OR ' + SEL + ' LIKE "' + STR + '%" OR ' + SEL + ' LIKE "%' + STR + '" OR latijn LIKE "%' + STR + '%" OR latijn LIKE "' + STR + '%" OR latijn LIKE "%' + STR + '"' ; } 
			else { AHREF = SEL + ' LIKE "%' + STR + '%" OR ' + SEL + ' LIKE "' + STR + '%" OR ' + SEL + ' LIKE "%' + STR + '"' ; } 
		}
	}
	if(LIST == null){ LIST = ''; }
	if(SEL == 'kleur' || SEL == 'bladkleur'){
		AHREF = 'kleur LIKE "%#000%"';
		if(STR.match(' ') != null){ var SPL = STR.split(' '); 
			for(x=0; x<SPL.length; x++){ if(SPL[x].length > 1){ for(i=0; i< ARR_kleur.length; i++){ if(ARR_kleur[i][1].match(SPL[x]) != null){ AHREF += ' OR kleur LIKE "%'+ ARR_kleur[i][0] +'%"'; } } } }
		} else { for(i=0; i< ARR_kleur.length; i++){ if(ARR_kleur[i][1].match(STR) != null){ AHREF += ' OR kleur LIKE "%'+ ARR_kleur[i][0] +'%"'; } } }
	}
	AHREF = escape(AHREF); A('zoek.php&RS=' + SEL + '&STR=' + AHREF + '&STR_ORIG=' + STR + '&TYPE=PLAIN' + LIST + SHOW + LIMIT);
}

function SEL_ROW(ELEM){
	ELEM.className = 'TR_BG';
}

function UNSEL_ROW(ELEM){
	ELEM.className = 'REM_TR_BG';
}

function PRINT(DIV){
	var DIV = document.getElementById(DIV).innerHTML;
	var p = window.open('', '', 'width=800, height=600, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
		p.document.open();
		p.document.write('<html><head><title>GreenXpress.nl :: Print Pagina</title>');
    	p.document.write('<link rel="stylesheet" type="text/css" href="css/TEKST.css" />');
		p.document.write('</head><body onload="self.print();window.close();">' + DIV + '</body></html>');
		p.document.close();
		p.focus();
}

function LEVERBAAR(STR){
	var DATE = new Date(); var MONTH = DATE.getMonth() + 1;
		ARR_MND = new Array("JAN","FEB","MAA","APR","MEI","JUN","JUL","AUG","SEP","OKT","NOV","DEC");
		STR = STR.toUpperCase();
	if(STR == 'HELE JAAR'){ return 'ja'; }
	else if(STR.length > 2){ 
		if(STR.match('T/M') != null){ STR = STR.split(' T/M '); FROM = null; TO = null;
			for(i=0; i < ARR_MND.length; i++){ if(STR[0] == ARR_MND[i]){ FROM = i + 1; } if(STR[1] == ARR_MND[i]){ TO = i + 1; } }
			if(FROM > TO && MONTH >= FROM && MONTH <= TO){ return 'ja'; } else if(FROM < TO && MONTH >= TO && MONTH <= FROM){ return 'ja'; } else { return 'nee'; }
		} else { for(i=0; i < ARR_MND.length; i++){ if(STR == ARR_MND[i]){ if((i+1) == MONTH){ return 'ja'; } else { return 'nee'; } } } }
	}
	else { return 'nee'; }
}


















