function checkfield( id , bit )
{
	
var istr = document.getElementById( id );
	
/*
S.....Sign 1=allowed 0=no signs!
I.....Integer
N.....Numeric
D.....Duty

S   I   N   D   
-------------------
0	0	0	0	0 
0	0	0	1	1
0	0	2	0	2   => default
0	0	2	1	3
0	4	0	0	4
0	4	0	1	5
0	4	2	0	6
0	4	2	1	7
8	0	0	0	8
8	0	0	1	9
8	0	2	0	10	
8	0	2	1	11
8	4	0	0	12
8	4	0	1	13
8	4	2	0	14
8	4	2	1	15
*/

sign 	= bit & 8 ? 1 : 0;
integer = bit & 4 ? 1 : 0;
numeric = bit & 2 ? 1 : 0;
duty 	= bit & 1 ? 1 : 0;

if ( duty && isBlank(istr.value) )
{
		istr.focus();
		alert(js_message_duty);
		return false;
}

if ( !sign && ( istr.value.match(/-/g) || istr.value.match(/\+/g) ) )
{
		istr.focus();
		alert(js_message_sign);
		return false;
}

if ( integer && !isInteger(istr.value) )
{
		istr.focus();
		alert(js_message_integer);
		return false;
}

if ( numeric && !isNumeric(istr.value) )
{
		istr.focus();
		alert(js_message_numeric);
		return false;
}
return true;
}

function isDigit(num)
{
	var string="1234567890";
	if (num.length>1)
	{
		return false;
	}
	if (string.indexOf(num)!=-1)
	{
		return true;
	}
	return false;
}

function isInteger(val)
{
	if (isBlank(val)){
		return true;
	}
	
	for(var i=0;i<val.length;i++)
	{
		if(!isDigit(val.charAt(i)))
		{
			return false;
		}
	}
	return true;
}

function isBlank(val)
{
	if (val=="")
	{
		return true;
	}
	return false;
}

function isNumeric(val)
{
	
	if (isBlank(val)){
		return true;
	}
		
	val = val.replace(/\./g,'');
	val = val.replace(/\,/g,'.');
	return (parseFloat(val,10)==(val*1));
}