
function validateEmail(Obj) {
/************************************************
DESCRIPTION: Validates that a string contains a
valid email pattern.

PARAMETERS:
strValue - String to be tested for validity
RETURNS:
True if valid, otherwise false.

REMARKS: Accounts for email with country appended
does not validate that email contains valid URL
type (.com, .gov, etc.) or valid country suffix.
*************************************************/
var txtObj=document.getElementById? document.getElementById(Obj) : document.all[Obj];
var IsValid;
//var objRegExp  =/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
var objRegExp  =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/
//check for valid email
IsValid=objRegExp.test(txtObj.value);
if (txtObj.value!="" && IsValid==false)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function validateEmail_text(email_text){
	var IsValid;
	//var objRegExp  =/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
	var objRegExp  =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/
	//check for valid email
	IsValid=objRegExp.test(email_text);
	if (email_text!="" && IsValid==false)
		{
			return false;
		}
		else
		{
			return true;
		}
}


String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }

//--------------------- Is Numeric
var numbers=".0123456789";
  function isNumeric(x) {
    // is x a String or a character?
    if(x.length>1) {
      // remove negative sign
      x=Math.abs(x)+"";
      for(j=0;j<x.length;j++) {
        // call isNumeric recursively for each character
        number=isNumeric(x.substring(j,j+1));
        if(!number) return number;
      }
      return number;
    }
    else {
      // if x is number return true
      if(numbers.indexOf(x)>=0) return true;
      return false;
    }
  }

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function radio_check(element_id){
	if ($(element_id + '_yes').checked){
		$(element_id + '_div').show();
	}
	if ($(element_id + '_no').checked){
		$(element_id + '_div').hide();
	}
}