var d=document;var timer=null;var catmenu={};var staticbar_control=0;var staticbars=new Array();var showadres=new Array();var formcmd=(function(){true});var lang={addfav:"Добавить закладку",delfav:"Удалить закладку",noscript:"Javascript не работает на этом Браузере! Обновите свой Браузер.",sc:"Поиск Объявлений...",load:'<img src="http://gorodnet.ru/images/spinningprogress.gif" alt="Загрузка...">',navwarn:"Пожаловаться модератору",navfriend:"Отправить другу",navprint:"Распечатать",navedit:"Изменить",addcomment:"Оставьте комментарий",delcomment:"Вы уверены, что вы хотите удалить ваш комментарий?",contactauthor:"Ответить на Объявление",del:"Удалить"};function mopen(e){clearTimeout(timer);e.onmouseout=function(){clearTimeout(timer);timer=setTimeout("mclose(false)",500)};if(e.className=="menu"){return}window.onclick=function(){mclose(false)};var b=d.getElementById("l"+e.id);var c="active";if(e.id=="catmenu"){c="btn active";catmenu.m=e;catmenu.c=b;var a=getlocation(e);b.style.top=a.y+"px";b.style.left=a.x+"px"}else{if(catmenu.s!=b){mclose(true);catmenu.s=b}}if(e.id!="catmenu"){catmenu.z=e}ie6select("hidden");e.className=c;b.style.display="block"}function mclose(a){clearTimeout(timer);if(catmenu.s){catmenu.s.style.display="none";catmenu.z.className=""}if(!a){if(catmenu.c){catmenu.c.style.display="none"}catmenu.m.className="btn";window.onclick=undefined}ie6select("visible")}function grayOut(a,b){var e=d.getElementById(a);if(!e){return}var b=b||{};var c=b.zindex||50;if(e.style.display=="block"){e.style.display="none";ie6select("visible");d.onkeydown=(function(f){true})}else{ie6select("hidden");e.style.zIndex=c+1;e.style.display="block";d.onkeydown=(function(f){if(f&&f.keyCode==27){grayOut(a,{})}})}}function iecompattest(){return(d.compatMode&&d.compatMode!="BackCompat")?d.documentElement:d.body}function staticbar(k,b,f){var a=d.getElementById(k);if(!a){return}staticbar_control=1;a.style.display="block";var l=a.offsetHeight;var m=(navigator.appName.indexOf("Netscape")!=-1)||window.opera;var e=1024;var j=getlocation(d.getElementById("footerbottom"));if(j&&l){e=j.y-l}window.stayTopLeft=function(){var o=m?pageYOffset:iecompattest().scrollTop;for(var q=0;q<staticbars.length;q++){var p=staticbars[q];p.src=d.getElementById(p.name);p.foc.y+=o-p.foc.y;if(p.offset){p.foc.y+=p.Y/8}if(p.foc.y<p.Y){p.pos="absolute";p.foc.y=p.Y}else{if(!ie6test()){p.pos="fixed";if(!p.offset){p.src.style.top=0}}}if(p.src.style.position!=p.pos){p.src.style.position=p.pos}if(p.foc.y<=p.maxlen&&p.pos=="absolute"){p.src.style.top=p.foc.y+"px"}if(staticbar_control==1){window.onscroll=function(){stayTopLeft()}}}};var c=getlocation(a);var n=false;for(var g=0;g<staticbars.length;g++){if(staticbars[g]&&staticbars[g].name==k){n=true}}if(n==false){var h={name:k,foc:c,maxlen:e,src:a,offset:f,Y:b,pos:"absolute"};staticbars.push(h)}stayTopLeft()}function getlocation(b){var c=0;var a=0;while(b){a+=b.offsetLeft;c+=b.offsetTop;b=b.offsetParent}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof d.body.leftMargin!="undefined"){a+=d.body.leftMargin;c+=d.body.topMargin}return({x:a,y:c})}function locshowad(f,c){var b=d.getElementById(f);var e=d.getElementById("location_"+f);if(!e||!b){return(false)}var a=getlocation(e);b.style.top=a.y+"px";b.style.left=a.x+"px";if(c){b.style.display="block"}return(true)}function showad(src){var res="";var found=false;var opt=true;if(src==0){opt=false}for(var i=0;i<showadres.length;i++){if(locshowad(showadres[i],opt)){res+='showad("'+showadres[i]+'");'}if(showadres[i]==src){found=true}}if(!found&&opt){if(locshowad(src,opt)){res+='showad("'+src+'");';showadres.push(src)}}window.onresize=null;window.onresize=function(){eval(res)}}function fxmlhttp_create(){var a=false;if(!a&&typeof XMLHttpRequest!="undefined"){try{a=new XMLHttpRequest()}catch(c){a=false}}if(!a&&window.createRequest){try{a=window.createRequest()}catch(c){a=false}}if(!a){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){a=false}}}if(!a){alert(lang.noscript);return false}return(a)}function fxmlhttp(id,src,type,input,donext){if(id!="script"){var foc=d.getElementById(id);if(!foc){foc=d.createElement("div");foc.id=id;d.body.appendChild(foc)}}var xmlhttp=fxmlhttp_create(src);d.body.style.cursor="wait";if(type=="get"||!type){xmlhttp.open("GET",src,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){if(id!="script"){foc.innerHTML=xmlhttp.responseText;eval(donext)}else{eval(xmlhttp.responseText);eval(donext)}d.body.style.cursor="default"}};xmlhttp.send(null)}else{if(type=="post"){var params="";if(input){var count=input.elements.length;for(var i=0;i<count;i++){params+=input.elements[i].name+"="+encodeURI(input.elements[i].value)+"&"}}xmlhttp.open("POST",src,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){if(id!="script"){foc.innerHTML=xmlhttp.responseText;eval(donext)}else{eval(xmlhttp.responseText);eval(donext)}d.body.style.cursor="default"}};xmlhttp.send(params)}}}function formloading(f,a,e){var e=e||{};if(f){if(a){for(c=0;c<f.elements.length;c++){f.elements[c].disabled=true}}if(e.id){if(e.f){formcmd=(function(){fxmlhttp(e.f,e.url,f.method,f,e.cmd)})}else{formcmd=(function(){f.action=e.url;f.submit()})}var g="load_"+e.id;if(d.getElementById(g)){formcmd()}else{var c=d.createElement("input");c.name=c.id=g;c.type="hidden";f.appendChild(c);fxmlhttp("script","/formloading.php?i="+Number(new Date())+"&id="+e.id,"get",false,"formcmd()")}}}if(a){var b=d.getElementById(a);if(!b){return}if(e.open){b.style.display="block";if(e.input){b.innerHTML=e.input}}else{if(e.close){b.style.display="none"}else{b.innerHTML=lang.load}}}}function pageloadingoff(){setTimeout("formloading(false, 'loading', {'close': 1})",1000)}function contactform(b){var c=0;if(b){var a=getlocation(b);c=a.y}showcontact("gorodnet",0,c)}function showcontact(c,f,e){var a="xmlcontact_"+c;var b="/contact.php?contact="+c+"&y="+e;if(typeof(xadid)!="undefined"){b+="&id="+xadid}if(c=="cflag"){b+="&cid="+f}fxmlhttp("xmlhttp",b,"get",false,'grayOut("'+a+'",{})')}function showadpics(a){var c=getimg(a,false,false);if(!c){return}var e=d.getElementById("showad_p");i=e.getElementsByTagName("img")[0].src;if(i==c.url){return}e.innerHTML="";d.body.style.cursor="wait";d.getElementById("showad_l").style.visibility="visible";var b=d.createElement("img");b.onload=function(){showad(0);d.getElementById("showad_l").style.visibility="hidden";d.body.style.cursor="default"};b.className=c.cls;b.src=c.url;e.appendChild(b);return false}function searchbox(b,a){if(b=="focus"){if(a.value==lang.sc){a.value=""}a.style.fontWeight="bold";a.style.color="#000";d.getElementById("submitsearch").style.borderColor=a.style.borderColor="#33677F"}else{if(b=="blur"){if(a.value==""){a.value=lang.sc;a.style.fontWeight="normal";a.style.color="#999"}d.getElementById("submitsearch").style.borderColor=a.style.borderColor=""}else{if(b=="over"){d.getElementById("submitsearch").style.borderColor=a.style.borderColor="#35ABD8"}else{if(b=="out"){d.getElementById("submitsearch").style.borderColor=a.style.borderColor=""}else{if(b=="sort"||b=="search_date"){d.f.elements[b].value=a.options[a.selectedIndex].value;d.f.submit()}}}}}}function fhover(){var e=false;if(xview=="ads"||xview=="favorites"){var f=d.getElementById("ads");if(f){e=f;var r=f.getElementsByTagName("li");for(var k=0;k<r.length;k++){r[k].onmouseover=function(){this.className="hov"};r[k].onmouseout=function(){this.className=""}}}}if(xview=="showad"){e=d.getElementById("navlist")}if(e){var q=getElementsByClass("fav",e,"span");if(q){for(var k=0;k<q.length;k++){var g="";if(q[k].className=="fav delete"){g=lang.delfav}else{g=lang.addfav}q[k].innerHTML=g;q[k].title=g;q[k].style.display="block";q[k].onclick=function(){myfav(this)};q[k].onmouseover=function(){this.style.textDecoration="underline"};q[k].onmouseout=function(){this.style.textDecoration=""}}}if(xview=="showad"){var q=e.getElementsByTagName("span");if(q){for(var k=0;k<q.length;k++){var g="";if(q[k].className=="warn"){g=lang.navwarn;q[k].onclick=function(){showcontact("flag",0,0)}}else{if(q[k].className=="friend"){g=lang.navfriend;q[k].onclick=function(){showcontact("friend",0,0)}}else{if(q[k].className=="print"){g=lang.navprint;q[k].onclick=function(){window.open("?print=1","printad_"+xadid)}}else{if(q[k].className=="edit"){g=lang.navedit;q[k].onclick=function(){d.location.href="/edad/"+xadid+"/"}}}}}if(g){q[k].innerHTML=g;q[k].title=g;q[k].style.display="block"}q[k].onmouseover=function(){this.style.borderColor="#83aada";this.style.backgroundColor="#ddecfe"};q[k].onmouseout=function(){this.style.borderColor=this.style.backgroundColor=""}}}var o=d.getElementById("contact");if(o){o.title=lang.contactauthor;var p=o.getElementsByTagName("button")[0];var k=o.getElementsByTagName("div")[0];p.innerHTML=lang.contactauthor;p.onclick=k.onclick=function(){showcontact("showad",0,0)};o.style.display="block"}var m=d.getElementById("comments");if(m){var q=m.getElementsByTagName("button");if(q){var n=[];for(var k=0;k<q.length;k++){q[k].innerHTML=lang.addcomment;q[k].title=lang.addcomment;q[k].onclick=function(){var a=getlocation(this);fxmlhttp("script","/comment.php?i="+xadid+"&y="+a.y,"get",false,"")}}}var r=m.getElementsByTagName("li");for(var k=0;k<r.length;k++){r[k].onmouseover=function(){this.className_prev=this.className;this.className=this.className+" hov"};r[k].onmouseout=function(){this.className=this.className_prev};var q=r[k].getElementsByTagName("span");if(q){for(var h=0;h<q.length;h++){var g="";if(q[h].className=="warn"){g=lang.navwarn;q[h].onclick=function(){var a=getlocation(this);showcontact("cflag",this.parentNode.id,a.y)}}else{if(q[h].className=="del"){g=lang.del;q[h].onclick=function(){if(this.parentNode.id){if(confirm(lang.delcomment)){fxmlhttp("script","/comment.php?del="+this.parentNode.id,"get",false,"")}}}}}if(g){q[h].innerHTML=g;q[h].title=g;q[h].onmouseover=function(){this.style.color="#AF2B2B"};q[h].onmouseout=function(){this.style.color=""}}}}}}}}}function getElementsByClass(b,g,a){var f=new Array();if(g==null){g=document}if(a==null){a="*"}if(typeof d.getElementsByClassName==="function"){return(g.getElementsByClassName(b))}var e=g.getElementsByTagName(a);if(e){var h=new RegExp("(^|\\s)"+b+"(\\s|$)");for(var c=0;c<e.length;c++){if(h.test(e[c].className)){f.push(e[c])}}}return f}function selectads(c,b){var b=b||{};var a="/selectads.php";var e=false;if(c=="city"){var f=b.id||b.foc.options[b.foc.selectedIndex].value;a+="?scountryid="+f;e=true}else{if(c=="cat"){a+="?scityid="+b.cityid;if(xsearchmode==1){a+="&xsearch="+encodeURI(d.getElementById("search").value)}e=true;d.getElementById("selectcity").style.display="none"}else{if(c=="off"){minheight(false);ie6select("visible");d.getElementById("select"+b.foc).style.display="none"}else{e=true}}}if(e){var c=c||"city";minheight(true);ie6select("hidden");fxmlhttp("xmlhttp",a,"get",false,'d.getElementById("select'+c+'").style.display="block"')}}function minheight(b){var a=d.getElementById("container");if(b){a.className="minh"}else{a.className=""}d.getElementById("xmlhttp").className=""}function ie6select(g){if(!ie6test()){return}var h=d.getElementsByTagName("select");for(var f=0;f<h.length;f++){if(h[f].className!="select"){h[f].style.visibility=g}}if(g=="hidden"){g="none"}else{g="block"}var e=["side","side1","top","middle","bottom","bottomafs","topafs","sideafs","box1","box2"];for(var f=0;f<6;f++){var c=d.getElementById("google_"+e[f]);if(c){var b=c.getElementsByTagName("iframe");if(b){c.style.display=b[0].style.display=g}}}}function ie6test(){if(navigator.appVersion.indexOf("MSIE")==-1){return(false)}var a=parseFloat(navigator.appVersion.split("MSIE")[1]);if(a>6.9){return(false)}return(true)}function imgpopup(j,a){var k="imgpopup";if(!a||j.id==k){return grayOut(k,{})}var e=d.getElementById(k);if(!e){return}var h=getlocation(j);e.style.top=h.y+"px";var c={};if(xview=="showad"){c=getimg(j,"/pics/p","/pics/zp")}else{c=getimg(j,false,false)}if(!c){return}var g=d.getElementById(k+"_p");i=g.getElementsByTagName("img")[0].src;if(i!=c.url){g.innerHTML="";d.getElementById(k+"_l").style.visibility="visible";var b=d.createElement("img");b.onload=(function(){d.getElementById(k+"_l").style.visibility="hidden"});b.src=c.url;g.appendChild(b)}grayOut(k,{})}function getimg(g,f,e){var c=g.getElementsByTagName("img");if(!c[0]){return false}var b={cls:c[0].className};var a=c[0].src;if(!f){f="thumbs/tn_";e=""}b.url=a.replace(f,e);return b}function myfavbar(b){var a=d.getElementById("favn");if(!a){return}a.style.top=b+"px";ie6select("hidden");fade("favn",1);timer=setTimeout((function(){myfavbarno()}),7500);a.onmouseover=function(){clearTimeout(timer)};a.onmouseout=function(){timer=setTimeout((function(){myfavbarno()}),7500)};d.getElementById("favnx").onclick=function(){myfavbarno()}}function myfavbarno(){ie6select("visible");fade("favn",0);clearTimeout(timer);var a=d.getElementById("favn");a.onmouseout=null;a.style.display="none";ie6select("visible")}function myfav(c){clearTimeout(timer);var h="add";var j=0;if(c=="delall"){h="delall"}else{var b=getlocation(c);j=b.y}var f="/fav.php?x="+xview;if(h=="delall"){f=f+"&delall=1"}else{var g=c.parentNode.id.substr(1);f=f+"&i="+g;if(c.className!="fav"){h="del";f=f+"&del=1"}}fxmlhttp("fav",f,"get",false,"myfavbar("+j+")");if(h=="add"){c.className="fav delete";c.innerHTML=lang.delfav;c.title=lang.delfav;xfavorites++}else{var a=[c];if(h=="delall"){a=getElementsByClass("fav",d.getElementById("ads"),"span")}for(var g=0;g<a.length;g++){xfavorites--;if(xview=="favorites"){if(xfavorites<1){d.getElementById("myfavorites").style.display="none"}var e=a[g].parentNode.id;fade(e,0)}else{a[g].className="fav";a[g].innerHTML=lang.addfav;a[g].title=lang.addfav}}}}function slideUp(c){var a=d.getElementById(c);if(!a){return}function b(e,h,g){if((e.offsetHeight-h-25)>0){e.style.height=(e.offsetHeight-h-25)+"px";setTimeout((function(){b(e,h,g)}),1)}else{e.style.height="0px";e.style.display="none";for(var f=0;f<showadres.length;f++){if(showadres[f]==c){showadres.splice(f,1);break}}showad(0)}}b(a,Math.ceil(a.offsetHeight/50),a.offsetHeight)}function fade(b,c){var a=d.getElementById(b);if(a==null){return}if(a.FadeState==1||a.FadeState==-1){a.FadeTimeLeft=1000-a.FadeTimeLeft}else{a.FadeState=c==1?1:-1;a.FadeTimeLeft=750;setTimeout("animateFade("+new Date().getTime()+",'"+b+"')",33)}}function animateFade(e,b){var c=new Date().getTime();var g=c-e;var a=d.getElementById(b);if(a.FadeTimeLeft<=g||(ie6test()&&a.ran)){a.style.opacity=a.FadeState==1?1:0;a.style.filter="alpha(opacity = "+(a.FadeState==1?100:0)+")";if(a.FadeState==-1){if(xview=="favorites"&&!ie6test()){slideUp(b)}else{a.style.display="none";a.onmouseout=null;showad(0)}}a.FadeState=null;return}a.FadeTimeLeft-=g;var f=a.FadeTimeLeft/1000;if(a.FadeState==1){f=1-f}a.style.opacity=f;a.style.filter="alpha(opacity = "+(f*100)+")";if(a.style.display=="none"){a.style.display="block";showad(0)}if(a.style.visibility=="hidden"){a.style.visibility="visible"}a.ran=true;setTimeout("animateFade("+c+",'"+b+"')",33)}function recaptcha(){fxmlhttp("script","/captcha.re.php?i="+Number(new Date()),"get",false,"")}function recaptcha_img(e){d.body.style.cursor="wait";var b=getElementsByClass("captchaimg",d,"img");if(b){b[0].onload=function(){d.body.style.cursor="default"};for(var c=0;c<b.length;c++){b[c].src=e}}};
