
/* check if the email is valid*/
function is_mail(mail){

regexpmail=/^[-a-zA-Z0-9_\.]{1,}[@][-a-zA-Z0-9_\.]{1,}[.][a-zA-Z]{2,4}/;
	if(!regexpmail.test(mail)){
		return false;
	}else{
	    return true;
	}
}

/* checks for minimum length*/
function is_long(txt,minlength){
    txt = trim(txt);
	if(txt.length<minlength){
      return false;
	}else{
	  return true;
	}
}

/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
**/
function is_num(val){
     var chk     = new RegExp(/^[0-9]+$/);
	 if(val.test(chk)===false){
	    return false;
	 }else{
	    return true;
	 }
}

function is_decimal(val){
     var chk     = new RegExp(/^\d*[0-9](|.\d*[0-9]|,\d*[0-9])?$/);
	 if(val.test(chk)===false){
	    return false;
	 }else{
	    return true;
	 }
}

function trim(txt) {
	return txt.replace(/^\s+|\s+$/g,"");
}

