function CheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++){
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
			theForm[z].checked = theElement.checked;
		}
	}
}

function Round(value){
	value = Math.round(value * 100) / 100;
	return value;
}

function CheckAll_Group(theElement)
{             
	var myID = theElement.id + '_[]';
	for( i=0; i<theElement.form.elements.length;i++){
		var e = theElement.form.elements[i];
		if(e.id == myID){
			e.checked = theElement.checked;
		}
	}
}

function MakeNice(what){
	var output = (what.toString().length==1)? "0"+what : what
	return output
}

function Teller(secs,id,urldoor) {
	span = document.getElementById(id);
	
	var secs = secs;
	var mins = 0;
	var uren = 0;
	
	if (secs >= 60){
		mins = parseInt(secs / 60);
		secs = secs - parseInt(mins * 60);
	}
	if (mins >= 60){
		uren = parseInt(mins / 60);
		mins = mins - parseInt(uren * 60);
	}
	
	TelDoor(uren,mins,secs,span,urldoor);
}

function TelDoor(uren,mins,secs,span,url) {

	secs--;

	if(secs < 0) {
		mins--;
		secs = 59;
	}
	if(mins < 0) {
		uren--;
		mins = 59;
	}

	if((secs <= 0 && mins <= 0 && uren <= 0) || uren < 0) {
		var tekst = url;
		if (tekst.indexOf(".asp") > -1){
			location.href = url;
		}else{
			span.innerHTML = url;
		}
		return;
	} else {
		span.innerHTML = '' + MakeNice(uren) +  ':' + MakeNice(mins) + ':' + MakeNice(secs) + '';
		setTimeout(function(){TelDoor(uren,mins,secs,span,url)}, 1000);
	}	
}

function Submit(sAction,sForm) { 
	document.getElementById(sForm).action = sAction; 
	document.getElementById(sForm).submit(); 
} 

function Conf_Submit(action,form,msg) { 
	if (confirm(msg) == true){
		document.getElementById(form).action = action; 
		document.getElementById(form).submit(); 
	}
} 

function Conf_Act(sForm,sAction){
	if (confirm('Weet u zeker dat u deze selectie wilt verwijderen?') == true){
		document.getElementById(sForm).action = sAction; 
		document.getElementById(sForm).submit(); 
	}
}

function Conf(form){
	if (confirm('Weet u zeker dat u deze selectie wilt verwijderen?') == true){
		document.getElementById(form).submit(); 
	}
}

function Conf_URL(url,msg){
	if (confirm(msg) == true){
		location.href = url; 
	}
}

function GetDiv(sName){
	var Div = document.getElementById(sName);
	if (Div.style.display == "none"){
		Div.style.display = "";
	}else{
		Div.style.display = "none";
	}
}

function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function MouseOver(sName) {
	sName.style.cursor = 'pointer';
	sName.style.backgroundColor = '#dbf0f7';
}
function MouseOut(sName) {
	sName.style.cursor = 'pointer';
	sName.style.backgroundColor = '';
}

function Go(url) {
	location.href = url;
	return false;
}

function Num(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46 && charCode != 44 && charCode != 45){
		return false;
	}else{
		return true;
	}
}

function Print(pdf) {
	var url = pdf
	var sHeight = 600;
	var sWidth	= 800;
	screen_left	=(screen.width)	?(screen.width - sWidth)	/2:100;
	screen_top	=(screen.height)?(screen.height - sHeight)	/2:100;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,menubar=0,resizable=0,width=' + sWidth + ',height=' + sHeight + ',left='+ screen_left +',top='+ screen_top +'');");
}

function CenterItem(item){
	sWidth = item.style.width;
	sHeight = item.style.height;
	
	sWidth = sWidth.replace("px","");
	sHeight = sHeight.replace("px","");
	
	sBodyHeight = document.body.offsetHeight;
	sBodyWidth = document.body.offsetWidth;
	sScrollTop = window.document.body.scrollTop;
	
	sLeft = (sBodyWidth / 2) - (sWidth / 2);
	sTop = (sBodyHeight / 2) - (sHeight / 2);
	if (sTop < sScrollTop){
		sTop = sScrollTop + 10;
	}else{
		sTop = sTop + sScrollTop;
	}
	
	item.style.top = sTop - 40;
	item.style.left = sLeft	;	
}

