/**********************************************************************************************
	DESCRIPTION (GENERAL.JS)                                                         
		Houses all javascript functions that are general in nature.   
                                                                     
	AUTHOR                                                            
                Brian Schwidder                     
                                                                     
        LAST MODIFIED DATE : 
                03/23/2003      DEVELOPMENT
                                                                     
        Written for Sovereign Surgical, Inc.                
        Copyright © 2003 MedTelligence.  All rights reserved.    
************************************************************************************************/
/***********************************************************************************************
			Utility Ftns.
************************************************************************************************/
function trim(str)
{
  //trim leading
  while (str.charAt(0) == ' ' || escape(str.charAt(0)) == '%0D' || escape(str.charAt(0)) == '%0A') 
    str = str.substring(1,str.length);

  //trim trailing
  while (str.charAt(str.length-1) == ' ' || escape(str.charAt(str.length-1)) == '%0D' || escape(str.charAt(str.length-1)) == '%0A')
    str = str.substring(0,str.length-1);

  return str
} // end of function

function emptyField(textObj) {
	textObj = eval(textObj);
	trimmedObjectValue = trim(textObj.value);
	if (trimmedObjectValue.length == 0) return true;
	else return false;
}

function isNull(value) 
{
   // comparing a number string to null is misleading, so concat an x for the compare
   if ("x" + value == "x" || "x" + value == "xnull" || "x" + value == "xundefined") return true;
   else return false;
}

function replaceString(oldS,newS,fullS) {
       for (var i=0; i<fullS.length; i++) 
       {      
            if (fullS.substring(i,i+oldS.length) == oldS) fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length);
       }
       
       return fullS;
}

