function isEmpty(elem, helperMsg){
    if(elem.value.length == 0){
        alert(helperMsg);
        elem.focus(); // set the focus to this input
        return true;
    }
    return false;
}

function isNumeric(elem, helperMsg){
    var numericExpression = /^[0-9]+$/;
    if(elem.value.match(numericExpression)){
        return false;
    }else{
        alert(helperMsg);
        elem.focus();
        return true;
    }
}

function isAlphabet(elem, helperMsg){
    var alphaExp = /^[a-zA-Z]+$/;
    if(elem.value.match(alphaExp)){
        return false;
    }else{
        alert(helperMsg);
        elem.focus();
        return true;
    }
}

function isAlphanumeric(elem, helperMsg){
    var alphaExp = /^[0-9a-zA-Z]+$/;
    if(elem.value.match(alphaExp)){
        return false;
    }else{
        alert(helperMsg);
        elem.focus();
        return true;
    }
}

function lengthRestriction(elem, min, max){
    var uInput = elem.value;
    if(uInput.length >= min && uInput.length <= max){
        return false;
    }else{
        alert("Please enter between " +min+ " and " +max+ " characters");
        elem.focus();
        return true;
    }
}

function madeSelection(elem, helperMsg){
    if(elem.value == "Please Choose"){
        alert(helperMsg);
        elem.focus();
        return true;
    }else{
        return false;
    }
}

function emailValidator(elem, helperMsg){
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
    if(elem.value.match(emailExp)){
        return false;
    }else{
        alert(helperMsg);
        elem.focus();
        return true;
    }
}

function notemailValidator(elem, helperMsg){
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
    if(elem.value.match(emailExp)){
        alert(helperMsg);
        elem.focus();
        return true;
    }else{
       return false; 
    }
}


function isMatch(elem1, elem2, helperMsg){
  if(elem1.value != elem2.value){
       alert(helperMsg);
       elem1.focus();
       return false 
  }
  else{   
  return true;
   }
}

function isPrice(elem,helperMsg){
    var priceExp = /^\$?[0-9\,]+(\.\d{2})?$/;
    if (elem.value.match(priceExp)){
        return false;
    }else{
        alert(helperMsg);
        elem.focus();
        return true;
    }
}