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 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	;	
}

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 Submit(sAction,sForm) { 
	document.getElementById(sForm).action = sAction; 
	document.getElementById(sForm).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(sForm){
	if (confirm('Weet u zeker dat u deze selectie wilt verwijderen?') == true){
		document.getElementById(sForm).submit(); 
	}
}

function Conf_URL(url,msg){
	if (confirm(msg) == true){
		location.href = url; 
	}
}


function FormatCurrency(sBox,sDec){	
	sVal = FormatCurrencyNow(sBox.value)
	if (isNaN(sVal)) {sBox.focus()}
	return sVal
}

function FormatCurrencyNow(strWaarde){	
	if (strWaarde.toString() != ""){
		sTmp = strWaarde.toString()
		strWaarde=sTmp.replace(",",".")
		if (isNaN(strWaarde)){
			alert("U heeft geen numerieke waarde ingevoerd.")
			return strWaarde
		}else{
			strWaarde = strWaarde.toString();
			if (strWaarde.length==0){
				strWaarde="0"
			}
			if (strWaarde.indexOf(".") < 0) {
				return strWaarde + ".00"
			}else{
				if (eval(strWaarde)<0){
					sTeken="-1"
					strWaarde=strWaarde.substring(1,strWaarde.length)
				}else{
					sTeken="1"
				}
				strWaarde = Math.round(eval(strWaarde * 100));
				strWaarde = strWaarde.toString();
				if (strWaarde.length==1){
					strWaarde = "0.0" + strWaarde
				} else {
					strWaarde = strWaarde.substring(0,strWaarde.length-2) + "." + strWaarde.substring(strWaarde.length-2,strWaarde.length);
					if (strWaarde.substring(0,1) == '.')
					{
						strWaarde = "0" + strWaarde
					}
				}
				if (sTeken=="-1"){
					return "-" + strWaarde;
				} else {
					return strWaarde;
				}
			}
		}
	} else {
		return ""
	}
}

function GetDiv(sName){
	var Div = document.getElementById(sName);
	Div.style.cursor = "pointer";

	if (Div.style.display == "none"){
		Div.style.display = "";
	}else{
		Div.style.display = "none";
	}
}

function MouseOver(sName) {
	sName.style.cursor 			= 'pointer';
	sName.style.backgroundColor = '#dbe7ef';
}
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 Valid(veld){
	if (document.getElementById(veld).value == ''){ 
		document.getElementById(veld).style.backgroundImage = "url('Icons/Meldingen/Fout.gif')"; 
		document.getElementById(veld).style.backgroundPosition = "right center"; 
		document.getElementById(veld).style.backgroundRepeat = "no-repeat"; 
		return false
	}else{
		document.getElementById(veld).style.backgroundImage = "url('Icons/Meldingen/Goed.gif')"; 
		document.getElementById(veld).style.backgroundPosition = "right center"; 
		document.getElementById(veld).style.backgroundRepeat = "no-repeat"; 
		return true
	}
}


