﻿function Replace(Str, FindFor, ReplaceWith)
{
  Str = "" + Str;
  res=""+Str.replace(FindFor, ReplaceWith);
  while(Str!=res)
  {
   Str=res;
   res=Str.replace(FindFor, ReplaceWith);
  };
  return ""+Str;
};

function CheckDate(liDay,liMonth,liYear)
{
  ldDate = new Date(1*liYear, 1*liMonth-1, 1*liDay);

  return ((ldDate.getFullYear()==1*liYear)&&(1*liYear<2070)&&
            (ldDate.getMonth()==1*liMonth-1)&&
            (ldDate.getDate()==1*liDay));
};
function CheckDateTime(liDay,liMonth,liYear,liHour,liMinute)
{
  ldDate = new Date(1*liYear, 1*liMonth-1, 1*liDay, 1*liHour, 1*liMinute);

  return ((ldDate.getFullYear()==1*liYear)&&(1*liYear<2070)&&
            (ldDate.getMonth()==1*liMonth-1)&&
            (ldDate.getDate()==1*liDay)&&
            (ldDate.getHours()==1*liHour)&&
            (ldDate.getMinutes()==1*liMinute));
};
function CheckTime(liHour,liMinute)
{
  ldDate = new Date(1, 1, 1, 1*liHour, 1*liMinute);

  return ((ldDate.getHours()==1*liHour)&&
            (ldDate.getMinutes()==1*liMinute)
		 );
};

function RTrim(lsStr)
{
  for(lsRes=lsStr;lsRes.charAt(lsRes.length-1)==' ';lsRes=lsRes.substr(0,lsRes.length-1));
  
  return lsRes;
};

function LTrim(lsStr)
{
  for(lsRes=lsStr;lsRes.charAt(0)==' ';lsRes=lsRes.substr(1,lsRes.length-1));
  
  return lsRes;
};

function Trim(lsStr)
{
  return RTrim(LTrim(lsStr));
};


