/*
	Standaard Javascript functies
*/


/*
	Deze functie maakt een dialog aan.
*/

function Dialog (sUrl, iWidth, iHeight)
{
	var posX = (screen.width / 2) - (iWidth/2);
	var posY = (screen.height / 2) - (iHeight/2);
		
	dialog = window.open (sUrl, "dialog", "width="+iWidth+"px, height="+iHeight+"px; resizable: no;");
	
	dialog.moveTo (posX, posY);
	dialog.name = 'popup';
	dialog.focus ();
	
	return true;
}


/*
	Functie voor het afronden van een float. Deze functie bestaat in 
	javascript alleen vanaf versie 1.5
*/
Number.prototype.toFixed = function(n) 
{
    var p = Math.pow(10,n);
    var sFixedNum = (Math.round(this * p) / p).toString();

    var aFixedNum = sFixedNum.split('.');
    if (aFixedNum.length == 1) aFixedNum[1] = '';

    var l = aFixedNum[1].length;
    while (l++ < n) aFixedNum[1] += '0';
				
	return aFixedNum.join('.');
}

/*
	Input mask, alleen een nummer is toegestaan
*/
function ForceNumber (objEvent)
{
	if (document.all) {
		iKeyCode = objEvent.keyCode;
	} else {
		iKeyCode = objEvent.which; 
    }
			
	if ((iKeyCode >= 48 && iKeyCode <= 57) || iKeyCode == 0 || iKeyCode == 8) {
		return true;
	} else {
		return false;
	}
}


/*
	Input mask: Alleen cijfers en een punt zijn toegestaan
*/
function ForceFloat (objEvent)
{
	if (document.all) {
		iKeyCode = objEvent.keyCode;
	} else {
		iKeyCode = objEvent.which; 
    }
			
	if (iKeyCode == 46 || (iKeyCode >= 48 && iKeyCode <= 57) || iKeyCode == 0 || iKeyCode == 8) {
		return true;
	} else {
		return false;
	}
}