//
   //File name	: date_functions.js
   //Creator	: Doug Barclay Imatics Inc. 2003
   //Date		: 03/05/03
   //Purpose	: code used by our last modified
//


// convert date function
function convert_date(date_to_convert)
{
  var new_year;
  var new_month;
  var new_day;

  new_year=date_to_convert.getYear()
  if (new_year < 2000) {new_year=new_year+1900}

  new_month = date_to_convert.getMonth();
  new_day = date_to_convert.getDate();
  var tmp_var   

  new_month++;

  tmp_var = "" + new_month

  if (tmp_var.length==1)
  {
    new_month = "0" + new_month
  }


  tmp_var = "" + new_day
  if (tmp_var.length==1)
  {
    new_day = "0" + new_day
  }


  convert_date = new_year + "-" + new_month + "-" + new_day
  return convert_date;

}

function replace(str,txt,by)
{
    var strLength = str.length;
    var txtLength = txt.length;
    if ((strLength == 0) || (txtLength == 0)) return str;

    var i = str.indexOf(txt);
    if ((!i) && (txt != str.substring(0,txtLength))) return str;
    if (i == -1) return str;

    var newstr = str.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(str.substring(i+txtLength,strLength),txt,by);

    return newstr;
}

