String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g,"");
}

function isNumeric(sText)
{
	var NumRX = /^[+-]?[0-9]+(.[0-9]+)?$/;
	return NumRX.test(sText);
}
function isInteger(sText)
{
	var NumRX = /^[+-]?[0-9]+$/;
	return NumRX.test(sText);
}

function ShowHide(ID)
{
	document.getElementById(ID).style.display=document.getElementById(ID).style.display==""?"none":"";
}
function isDate(day,month,year)
{	
	if (!isNumeric(day) || !isNumeric(month) || !isNumeric(year)) return false;
	if (day.length !=2 || month.length!=2 || year.length!=4) return false;
	var Meuberet = ((year % 4)==0 && (year % 100)!=0) || ((year % 400)==0);
	if (month == 2 && day >28 && !Meuberet){
		return false;
	}
	if (month<1 || month>12)
		return false;
	if (month == 1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
	{
		if (day<1 || day>31)
		{
			return false;
		}
	}else{
		if (day<1 || day>30)
		{
			return false;
		}
	}
	return true;
}

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}