
function isValidSSN(value) { 
    var re = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/; 
    if (!re.test(value)) { return false; } 
    var temp = value; 
    if (value.indexOf("-") != -1) { temp = (value.split("-")).join(""); } 
    if (value.indexOf(" ") != -1) { temp = (value.split(" ")).join(""); } 
    if (temp.substring(0, 3) == "000") { return false; } 
    if (temp.substring(3, 5) == "00") { return false; } 
    if (temp.substring(5, 9) == "0000") { return false; } 
    return true; 
}

function isValidPhone(str)
{
	var re = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/; 
	    if (!re.test(str)) { return false; } 
	    return true;
}

function isValidEmail(emailAddress) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(2([0-4]\d|5[0-5])|1?\d{1,2})(\.(2([0-4]\d|5[0-5])|1?\d{1,2})){3} \])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (!re.test(emailAddress)) { return false; } 
    return true;
}

function isValidZipCode(value) {
   var re = /^\d{5}([\-]\d{4})?$/;
   if (!re.test(value)) { return false; } 
   return true;
}

function isValidDate(strDate) {
	if (strDate == "") return false;
     // (\d{1,2}) means 4 or 12
     // (\/|-) means either (/ or -), 4-12 or 4/12 
     // NOTE: we have to escape / (\/)
     // or else pattern matching will interpret it to mean the end instead of the literal "/"
     // \2 use the 2nd placeholder (\/|-) "here"
     // (\d{2}|\d{4}) means 02 or 2002
     var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
     var matchArray = strDate.match(datePat);

     if (matchArray == null) return false;

     // matchArray[0] will be the original entire string, for example, 4-12-02 or 4/12/2002
     var month = matchArray[1];     // (\d{1,2}) - 1st parenthesis set - 4
     var day = matchArray[3];         // (\d{1,2}) - 3rd parenthesis set - 12
     var year = matchArray[4];        // (\d{2}|\d{4}) - 5th parenthesis set - 02 or 2002

     if (month < 1 || month > 12) return false;
     if (day < 1 || day > 31) return false;
     if ((month == 4 || month == 6 || month==9 || month == 11) && day == 31) return false;
     if (month == 2) {
          var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));

          if (day > 29 || (day == 29 && !isleap)) return false;
     }
     return true;
}


function isInteger(value) {
   var re =  /^[+]?[0-9]+$/;
   if (!re.test(value)) { return false; } 
   return true;
}

function isValidNumber(inpString) {
   var re =  /^[+]?\d+(\.\d+)?$/
   if (!re.test(inpString)) { return false; } 
   return true;
}

function isAlpha(value) {
   var re =  /^[A-Za-z]+$/;
   if (!re.test(value)) { return false; } 
   return true;
}

function isAlpha_s(value) {
   var re =  /^[A-Za-z ]+$/;
   if (!re.test(value)) { return false; } 
   return true;
}

function Trim(str) {
  str =str.replace(/^\s+|\s+$/g, '');
  return str;
}


function submit_form()
{
if(event.keyCode == 13)
{
document.getElementById(frm).submit();
}
}