function validateInteger( strValue ) 
	{
  	var objRegExp  = /(^-?\d\d*$)/;

  	//check for integer characters
  	return objRegExp.test(strValue);
	}
	
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 validateEmail(strValue) 
	{
	var objRegExp  = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/i;
	//check for valid email
	return objRegExp.test(strValue);
	}
	
function validateUSDate( strValue ) 
	{
	  //var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2,4}$/
	  var objRegExp = /^\d{1,2}\/\d{1,2}\/\d{2,4}$/
	  
	  //check to see if in correct format
	  if(!objRegExp.test(strValue))
		return false; //doesn't match pattern, bad date
	  else{
		if(isNaN(strValue.substring(1,2)))
			{var strSeparator = strValue.substring(1,2)} //find date separator
		else
			{var strSeparator = strValue.substring(2,3)}
		var arrayDate = strValue.split(strSeparator); //split date into month, day, year
		//create a lookup for months not equal to Feb.
		var arrayLookup = {'1' : 31,'3' : 31, '4' : 30,'5' : 31,'6' : 30,'7' : 31,'8' : 31,'9' : 30,'10' : 31,'11' : 30,'12' : 31}
		var intDay = parseInt(arrayDate[1],10); 
		
		//check if month value and day value agree
		if(arrayLookup[parseInt(arrayDate[0],10)] != null) 
		{
		  if(intDay <= arrayLookup[parseInt(arrayDate[0],10)] && intDay != 0)
			return true; //found in lookup table, good date
		}
		
		var intMonth = parseInt(arrayDate[0],10);
		if (intMonth == 2) 
		{ 
		   var intYear = parseInt(arrayDate[2]);
		   if (intDay > 0 && intDay < 29) 
		   	{return true;}
		   else if (intDay == 29) {
			 if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
				 (intYear % 400 == 0)) {
				  // year div by 4 and ((not div by 100) or div by 400) ->ok
				 return true;
			 }   
		   }
		}
	  }  
	  return false; //any other values, bad date
	}	

function popupWindow(fileToOpen,width,height,winName)
	{
	LeftPosition = (screen.width) ? (screen.width-470)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-450)/3 : 0;
	features = "location=no,toolbar=no,menubar=no,resizeable=no,scrollbars=yes,height="+height+",width="+width;
	if (navigator.appName == "Netscape") features += ",screenX="+LeftPosition+",screenY="+TopPosition
	else features += ",left="+LeftPosition+",top="+TopPosition
					
	/* features = "location=no,toolbar=no,menubar=no,resizeable=no,scrollbars=yes,height="+height+",width="+width;
	if (navigator.appName == "Netscape") features += ",screenX=150,screenY=150"
	else features += ",left=150,top=150" */
	window.open(fileToOpen,winName,features);	
	}
function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }