function str_replace ( search, replace, subject ) { // Replace all occurrences of the search string with the replacement string // // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Gabriel Paderni if(!(replace instanceof Array)){ replace=new Array(replace); if(search instanceof Array){//If search is an array and replace is a string, then this replacement string is used for every value of search while(search.length>replace.length){ replace[replace.length]=replace[0]; } } } if(!(search instanceof Array))search=new Array(search); while(search.length>replace.length){//If replace has fewer values than search , then an empty string is used for the rest of replacement values replace[replace.length]=''; } if(subject instanceof Array){//If subject is an array, then the search and replace is performed with every entry of subject , and the return value is an array as well. for(k in subject){ subject[k]=str_replace(search,replace,subject[k]); } return subject; } for(var k=0; k-1){ subject = subject.replace(search[k], replace[k]); i = subject.indexOf(search[k],i); } } return subject; } function changeslide(namer) { $.ajax ({ type: "GET", url: "https://nw-estate.ru/mainpage/listobj.php", data: "type="+namer, dataType: "text", async: true, cache: true, beforeSend:function (XMLHttpRequest) { this; // the options for this ajax request $('#content').addClass("loading"); }, complete:function (XMLHttpRequest, textStatus) { this; // the options for this ajax request }, success: function(msg) { var ab=document.getElementById('searchid'); var ab2=ab.innerHTML; var patern = /page_s/gi; ab2=ab2.replace(patern, 'page_uns'); var stri="changeslide('"+namer+"');return false\">