var confirmMsg  = 'Delete?';

function confirmLink(theLink)
{
    if (confirmMsg == '') {
        return true;
    }
    var is_confirmed = confirm(confirmMsg);
    if (is_confirmed) {
        theLink.href += '&confirmed=1';
    }
    return is_confirmed;
}

var popupCount = Math.round(Math.random() * 100);

function openPopup(fileID, width, height) {
	openPopup(fileID, width, height, '0');
}

function openPopup(fileID, width, height, scroll) {
	width += 6;
	height += 5;
 	popupCount ++;
	window.open(fileID , 'fly'+popupCount, "menubar=0,scrollbars=" + scroll + ",toolbar=0,location=0,directories=0,status=0,resizable=0,width=" + width + ",height=" + height + "left=10, top=10");
}

function checkCount(veld, aantal, volgende) {
	if(veld.value.length >= aantal) {
		volgende.focus(); }
}

function onlyNumbers(obj) {
	var checked = "", replace = false;
	for (i = 0; i < obj.value.length; i++)
	if (isNumber(obj.value.substr(i, 1))) checked += obj.value.substr(i, 1);
		else replace = true;
	if (replace) obj.value = checked;
}

function isNumber(c){
	if (c==0||c==1||c==2||c==3||c==4||c==5||c==6||c==7||c==8||c==9||c=='.'||c==',') return true;
		else return false;
}

function show(elementId) {
	if (document.getElementById) {
		var theElement = document.getElementById(elementId);
	} else {
		if (document.all) {
			var theElement = document.all[elementId];
		} else {
			var theElement = new Object();
		}
	}
	if (!theElement) { return; }
	if (theElement.style) { theElement = theElement.style; }
	if (typeof(theElement.display) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ) { return; }

	theElement.display = 'block';
}

function hide(elementId) {
	if (document.getElementById) {
		var theElement = document.getElementById(elementId);
	} else {
		if (document.all) {
			var theElement = document.all[elementId];
		} else {
			var theElement = new Object();
		}
	}
	if (!theElement) { return; }
	if (theElement.style) { theElement = theElement.style; }
	if (typeof(theElement.display) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ) { return; }

	theElement.display = 'none';
}

function toggle(elementId) {
	if (document.getElementById) {
		theElement = document.getElementById(elementId);
	} else {
		if (document.all) {
			var theElement = document.all[elementId];
		} else {
			var theElement = new Object();
		}
	}
	if (!theElement) { return; }
	if (theElement.style) { theElement = theElement.style; }
	if (typeof(theElement.display) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ) { return; }
	if (theElement.display == 'none') {
		theElement.display = 'block';
	} else {
		theElement.display = 'none';
	}
}

function clean(elementId, state) {
	if (document.getElementById) {
		theElement = document.getElementById(elementId);
	} else {
		if (document.all) {
			var theElement = document.all[elementId];
		} else {
			var theElement = new Object();
		}
	}
	if (!theElement) { return; }
	childSize = theElement.childNodes.length;
	for (i = 0; i < childSize; i++) {
		if (theElement.childNodes[i].tagName && theElement.childNodes[i].tagName.toLowerCase() == "div") {
			theElement.childNodes[i].display = 'none';
			clean(theElement.childNodes[i].id, state);
		}
		if (theElement.childNodes[i].type && theElement.childNodes[i].type.toLowerCase() == "checkbox") {
			theElement.childNodes[i].checked = state;
		}
	}
}