function TWebModule1.replace(str,s1,s2:string;casesensitive:boolean):string;
var
i:integer;
s,t:string;
begin
s:='';
t:=str;
repeat
if casesensitive then i:=pos(s1,t) else i:=pos(lowercase(s1),lowercase(t));
if i>0 then
begin
s:=s+Copy(t,1,i-1)+s2;
t:=Copy(t,i+Length(s1),MaxInt);
end
else s:=s+t;
until i<=0;
result:=s;
end;