/*
						This library is copyright protected, Ninebits © 2007

			--------------------------------------------------------------------------------------------------------------------
			None of the scripts, functions or any other elements on this site and this library
			may be copied, sold, decompiled or used in any other way than as a library
			to the avenance site.

			Unauthorised backup is prohibited, only one instance may reside at the server
			where the avenance project is hosted. On request a new instance will be installed
			by Ninebits.
			--------------------------------------------------------------------------------------------------------------------
			Ninebits is a Maxquality BV company, please visit us at http://www.ninebits.nl
			--------------------------------------------------------------------------------------------------------------------
			This library is W3C compliant, FF, IE, NS, OP. 26-12-2007 09:21 CET
*/


	/* Functie vult dynamisch dropdownlijsten*/
	function nbvullijst(element,lijstnummer){
		nbleeglijst(element);
		nboptieverwijderen(element,0);
		nboptieinvoegen(element, '', '- ' + i18n[91] + ' -');
		for(var i=0;i< titels[lijstnummer].length;i++){
			if ( titels[lijstnummer][i] != '' && waarden[lijstnummer][i] != ''){
				nboptieinvoegen(element, waarden[lijstnummer][i], titels[lijstnummer][i]);
			}
		}
	}

	function nbleeglijst(element){
		for(var x = element.length; x >= 0; x = x - 1){
		 element[x] = null;
		}
	}

	function nboptieinvoegen(element,optiewaarde,optietitel){
		element[element.length] = new Option(optietitel,optiewaarde);
	}

	function nboptieverwijderen(element,optieindex){
		element[optieindex] = null;
	}


	// Melding in de I-popup
	function nb_melding(b,h,titel,melding,callback){
		_nb_ipopup(b,h,'','c-m',1,0,'',$.g.venster.ipopup.frame);
		if (typeof(callback) != 'undefined'){
			eval(callback);
		}
	}

	/* PNG 24 support voor IE 5.5 -> 7 gebaseerd op: (http://homepage.ntlworld.com/bobosola) */
	var _nbpngsupport = function(){
		var versie = navigator.appVersion.split('MSIE');
		var filter = 'DXImageTransform.Microsoft.AlphaImageLoader';
		if (typeof(versie[1]) != 'undefined' && (parseFloat(versie[1]) >= 5.5) && (document.body.filters)){
			for(var i=0; i < document.images.length; i++){
				var obj = document.images[i];
				var naam = obj.src.toUpperCase();
				if (naam.substring(naam.length - 3, naam.length) == 'PNG'){
					var stijl = "display: inline-block;" + obj.style.cssText;
					if (obj.align == 'left'){
						stijl = 'float: left;' + stijl;
					}
					if (obj.align == 'right'){
						stijl = 'float: right;' + stijl;
					}
					obj.outerHTML = '<' + 'span style="width:' + obj.width + 'px; height:' + obj.height + 'px;'
						+ stijl + '; filter:progid:' + filter + '(src=\'' + obj.src + '\', sizingMethod=\'scale\');"><\/span>';
					i = i - 1;
				}
			}
		}
	};

	/* Zijn er png's? Zo ja dan support inschakelen */
	var _nbpngaanwezig = function(support){
		var versie = navigator.appVersion.split('MSIE');
		if (typeof(versie[1]) != 'undefined' && (parseFloat(versie[1]) >= 5.5) && (document.body.filters)){
			for(var i=0; i < document.images.length; i++){
				var obj = document.images[i];
				var naam = obj.src.toUpperCase();
				if (naam.substring(naam.length - 3, naam.length) == 'PNG'){
					if (typeof(support) != 'undefined'){
						_nbpngsupport();
					}
					return true;
				}
			}
		}
		return false;
	};

		/* Positie bepalen van een item */
	function _nbobjectpositie(doel, richting){
		if (document.getElementById(doel)){
			//var diag = new Array();
			var obj = document.getElementById(doel);
			var c = new Array();
			if (obj.offsetParent){
				//diag[0] = obj.type + ' - ' + obj.tagName;
				c['x'] = obj.offsetLeft;
				c['y'] = obj.offsetTop;
				var d = 1;
				while (obj = obj.offsetParent){
					//diag[d] = obj.type + ' - ' + obj.tagName;
					d++;
					c['x'] += obj.offsetLeft;
					c['y'] += obj.offsetTop;
				}
			}
			//alert(diag);
			if (typeof(richting) == 'undefined'){
				return c;
			}
			return c[richting];
		}
		return -1;
	};

		/* Positie bepalen inc gescrollde divs */
	function _nbobjectpositieabsoluut(doel, richting){
		if (document.getElementById(doel)){
			var obj = document.getElementById(doel);
			var c = new Array();
			var curleft = curtop = 0;
			if (obj.offsetParent) {
				c['x'] = obj.offsetLeft - obj.scrollLeft;
				c['y'] = obj.offsetTop - obj.scrollTop;
				while (obj = obj.offsetParent) {
					c['x'] += obj.offsetLeft - obj.scrollLeft;
					c['y'] += obj.offsetTop - obj.scrollTop;
				}
			}
			if (typeof(richting) == 'undefined'){
				return c;
			}
			return c[richting];
		}
		return -1;
	};

