function enRu() { var x = window.location+""; var reg = /\/en\//; if(reg.test(x)) x = x.replace(reg,"/"); else { x = x.replace("site.ru","site.ru/en"); } window.location = x }