  function removeSpaces(sStr)
  {
    
    var sNewStr = '';
   
    var iLen = sStr.length;
      
    for(i=0; i< iLen; i++)
    {
      var iCharCode = sStr.charCodeAt(i);
      
      if( iCharCode!= 32 && iCharCode!=13 && iCharCode!= 10)
      {
        sNewStr += sStr.charAt(i);
      }
    }
    
    return sNewStr;
  }
  
  function mytrim(s)
  {   
     s = s.replace(/(^\s*)|(\s*$)/gi,"");
     s = s.replace(/[ ]{2,}/gi," ");
     s = s.replace(/\n /,"\n");
     return s;
  }
  
  function checkUncheckAll(objChkAll, sChkBxId, sNoOfChkBoxId)
  {
    
    try
    {
      if(!objChkAll)
      {
        alert("Check/Uncheck All Check Box Not Found ...!!");
        return false;
      }
      
      if(removeSpaces(sChkBxId)=='')
      {
        alert("Check Box Id Must Not Be Empty ...!!");
        return false;
      }
      
      if(removeSpaces(sNoOfChkBoxId)=='')
      {
        alert("No Of Check Boxes' Id Must Not Be Empty ...!!");
        return false;
      }
      objNoOfChkBx = document.getElementById(sNoOfChkBoxId);
       
      if(!objNoOfChkBx)
      {
        alert("No Of Check Boxes Count Object Not Found ...!!");
        return false;  
      }
      
      iNoOfChkBox = objNoOfChkBx.value;
      //alert(iNoOfChkBox);
      for(var iIdCounter=1; iIdCounter<=iNoOfChkBox; iIdCounter++ )
      {
        try
        {
          objChkBox = document.getElementById(sChkBxId+""+iIdCounter+"");
          objChkBox.checked = objChkAll.checked;
        }
        catch(e)
        {
          alert("Check Box With Id : "+sChkBxId+""+iIdCounter+" Not Found ..!!");
          objChkAll.checked = false;
          return false;
        }  
      }  
    }
    catch(e)
    {
      
    }
  }
