   function myReplaceAll(str,var1,var2){
      while (str.indexOf(var1) > -1){
         str=str.replace(var1,var2);
      }
      return str;
   }