// JavaScript Document
function numbersonly(myfield, e, dec)
{
	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
 		return true;
	keychar = String.fromCharCode(key);
	// control keys
	//alert(key);
	if	(
		 	(key==null) || 
			(key==0) || 
			(key==8) || 
 			(key==9) || 
			(key==13)|| 
			(key==27) 
		)
 	return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
		return true;
	// decimal point jump
	else if (dec && (keychar == "."))
 	{
		//myfield.form.elements[dec].focus();
 		return true;
 	}
	else
 		return false;
}

function nextTabIndex( nb_max, obj )
{	
	if(obj.value.length==nb_max)
	{
		try
		{
			document.getElementById("tel#"+(obj.tabIndex+1)).focus();
		}
		catch( e )
		{
			alert(e.toString());
		}	
	}
}

function switchCSSClass( id, oldClassname, newClassname, checked)
{
	if(!checked )
	{
		newClassname = oldClassname;
	}
	try
	{
		document.getElementById( id ).className = newClassname;
	}
	catch( e )
	{
		//alert( e.toString() );
	}
}
