
/*
* assumes has a value attribute.
* If the value is empty ('') we shake it up a bit and change it's BG color.  Otherwise we change the BG color to white.
*/
function isEmpty(id)
{
	elm = id.value ? id : $(id) ;
	if (elm.value == '') {
		somethingWrongWith(id, "Le champs en rouge ne peut &ecirc;tre vide.") 
		return true
	}
}


function isNotNumber(id)
{
	elm = id.value ? id : $(id) ;
	if (!elm.value.isNumeric()) {
		somethingWrongWith(id, "Le champs en rouge &ecirc;tre num&eacute;rique.") 
		return true
	}
}

function somethingWrongWith(id, error)
{
	elm = id.value ? id : $(id) ;
	elm.focus(); elm.select(); new Effect.Shake(elm); new Effect.Highlight(elm, { startcolor: '#FF0000', endcolor: '#FFFFFF' })
	$('formErrors').innerHTML = error
	$('formErrors').style.display = 'block'
}


String.prototype.isNumeric = function() {
	return (String(Number(this)) == this)
}

