G={}; G.opt={}; G.balance=G.cache=G.ce={};function gett(e,type) {var e = e || window.event;var targ = e.target || e.srcElement;if (targ.nodeType == 3){targ = targ.parentNode; };G.event=targ;if(type){return tg=Array(e,targ);} else {return targ;}};function gep(elem){if(typeof elem !='object')var elem = $(elem);var w = elem.offsetWidth;var h = elem.offsetHeight;var l = 0;var t = 0;while (elem){l += elem.offsetLeft;t += elem.offsetTop;elem = elem.offsetParent;}return {"l":l, "t":t, "w": w, "h":h};};function mac(u, c, t){if(!G.cmac){alert('Дождитесь окончания загрузки страницы!');return;};if(G.cache[u]&&!t){G.macret=G.cache[u];c();return;}else{G.hr = ghro();if (G.hr){G.hr.open("GET", u, true);G.hr.onreadystatechange = function(){if (G.hr.readyState == 4){if (G.hr.status==200){G.cache[u]=G.macret=G.hr.responseText;c();}}};G.hr.send(null);}}};function ghro(){var xmlHttpRequest;if (typeof ActiveXObject != 'undefined'){xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');}else if (typeof XMLHttpRequest != 'undefined'){xmlHttpRequest = new XMLHttpRequest();}else{xmlHttpRequest = false;}return xmlHttpRequest;};function gcw(){return document.compatMode=='CSS1Compat' && document.documentElement.clientWidth;};function gch(){return document.compatMode=='CSS1Compat' && document.documentElement.clientHeight;};function gbst(){return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body &&document.body.scrollTop);};function gbsl(){return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);};function cc(){var x=parseInt(gcw()/2)+gbsl();var y=parseInt(gch()/2)+gbst();return {'x':x,'y':y};};function mp(event){var x = y = 0;if(document.attachEvent!=null){x=window.event.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);y=window.event.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);}else if(!document.attachEvent && document.addEventListener){x=event.clientX+window.scrollX;y=event.clientY+window.scrollY;}else{}return {x:x, y:y};};function li(o){o.previousSibling.previousSibling.src=roottpl+'image.png?r='+Math.floor(Math.random()*9999999);};G.b = {opera: /opera/i.test(navigator.userAgent),msie: (!this.opera && /msie/i.test(navigator.userAgent)),msie7: (!this.opera && /msie 7/i.test(navigator.userAgent)),msie6: (!this.opera && /msie 6/i.test(navigator.userAgent)),mozilla: /firefox/i.test(navigator.userAgent),chrome: /chrome/i.test(navigator.userAgent),safari: (!(/chrome/i.test(navigator.userAgent)) && /webkit|safari|khtml/i.test(navigator.userAgent))};G.shol=document.createElement('OL');G.shol.style.position='absolute';G.shol.style.width='270px';G.lcv = function(elem, next, t){G.mode=$(next);G.sliHTML(G.mode,'<option value="">Загружаю...</option>',0);G.curl=roottpl+'ajax.php?ids='+G.mode.id+'&v='+elem.value+(t?'&vv='+t:'');mac(G.curl,G.cb);};G.cb = function(){G.ret=G.macret.split('@@');if(G.ret[0]=='error') error(G.ret[1]);G.sliHTML(G.mode,G.ret[1],0);};function $(el,t){return G.ce[el]=t==1?(document.getElementById(el)):(G.ce[el]?G.ce[el]:document.getElementById(el));};function _(cl){var r = [];var m = new RegExp('\\b'+cl+'\\b');var e = document.getElementsByTagName('DIV'); for (var i = 0; i < e.length; i++) {var c = e[i].className;if (m.test(c)) {r.push(e[i]);}}return r;};function ch(){G.help.style.display='none';delete(G.mode);};function oh(id){load();G.curl=roottpl+'ajax.php?ids='+G.mode.id.substr(1,G.mode.id.length)+'&v='+id;mac(G.curl,G.cb);};function load(){G.mode=G.help;G.sliHTML(G.mode,'Загрузка...||<img src="'+roottpl+'img/al.gif">',0);return;}function fstr(){load();var d=[], c=0;var city=$('city').value;var distr=$('div_district').getElementsByTagName('INPUT');for(var i=0, s=distr.length; i<s; i++){if(distr[i].name=='district[]'&&distr[i].checked){d[c]=distr[i].value;c++;}}G.curl=roottpl+'ajax.php?ids=fstreet&v=1&c='+category+'&a='+action+'&city='+city+'&district='+d.join(',');G.fstr=true;mac(G.curl,G.cb);}function bl(t,i){if(t.value==''){t.nextSibling.style.backgroundPosition='0 -125px';if(i==1){t.value='Найти по номеру телефона';}else if(i==2){t.value='Найти по номеру объявления';}else{t.value='Найти по названию улицы';}t.style.color='#999';}}function fc(t){t.value='';t.style.color='black';t.nextSibling.style.backgroundPosition='0 -142px';}function photo_onload(img){$('image_dummy').style.display = 'none';img.style.visible = '';img.style.position = '';var el=$('image_full_div');el.firstChild.href=img.src.replace('photo','bigphoto');var pos=gep('photo_div');el.style.top=pos.t+pos.h-32+'px';el.style.left=pos.l+pos.w-32+'px';el.style.display='block';};function load_photo_callback(){   G.photo_div.innerHTML = G.macret;var elems = G.photo_div.getElementsByTagName('IMG');elems[0].onload = function(){photo_onload(this);}};function load_photo(name, filename){$('image_full_div').style.display='none';!G.photo_div?G.photo_div = $(name):0;var elems = G.photo_div.getElementsByTagName('IMG');if(elems.length){var pic = elems[0];G.image_dummy = $('image_dummy');G.photo_div.innerHTML = '';G.image_dummy.style.display = '';}G.curl=roottpl+'load_photo.php?filename='+filename;mac(G.curl, load_photo_callback);};startListmenu = function(){var nodes = $("menu").getElementsByTagName("LI");for (var i = 0; i < nodes.length; i++){nodes[i].onmouseover = function(){this.className += "over";};nodes[i].onmouseout = function(){this.className = this.className.replace(new RegExp("over\\b"), "");}}};G.sliHTML = function(elem,html,type){if(!elem)return;if(elem.id=='ahelp'){var cord=cc();var r=html.split('||');elem.style.top=(cord.y-200>0?cord.y-200:1)+'px';elem.style.left=cord.x-250+'px';if(type==1){elem.firstChild.innerHTML='<div style="float:left;">'+r[0]+'</div>';elem.lastChild.innerHTML=r[1]+'<div id=timer>'+G.nowtime+'</div>'+r[2];G.ttag=elem;G.tim=G.nowtime;G.timer = setInterval('timer()', 1000);}else{if(r[2]){eval(r[2]);}elem.firstChild.innerHTML='<div style="float:left;">'+r[0]+'</div><div id=close><span onclick="ch();">&nbsp;&nbsp;&nbsp;</span></div>';elem.lastChild.innerHTML=r[1];}elem.style.display='block';}else{var list = elem.firstChild;var ht=html;var html = '<select '+(list.name=='city'?'onchange="G.lcv(this,\'district\',form[\'region\'].value);" ':'')+'name="'+list.name+'" style="width:'+(list.name=='district'?'270':'172')+'px;">'+html+'</select>';elem.innerHTML = html;if(list.name=='city'&&ht!='<option value="">Загружаю...</option>'){G.lcv(elem.firstChild,'district',form['region'].value);}}};function timer(){G.tim-=1;$('timer',1).innerHTML=G.tim;if(G.tim<=0){clearInterval(G.timer);ch();delete(G.ttag);G.fg.style.display='none';}return;};function sestku(e){var e=gett(e,'1');var i=e[1];if(G.ls!=i.value){var t=0;if(typeof(form)!="undefined" && form['city'].value=='1'){G.tses=1;}else if($('filter') && $('div_city').firstChild.value=='1'){G.tses=2;}else{return;};G.sest=i;G.ls=i.value;G.curl=G.tses==1?roottpl+'ajax.php?ids=street&v='+encodeURI(G.ls)+'&r='+form['region'].value+'&c='+form['city'].value:roottpl+'ajax.php?ids=street&v='+encodeURI(G.ls)+'&r='+$('div_region').firstChild.value+'&c='+$('div_city').firstChild.value;mac(G.curl, cbt);}else{return;}};function cbt(){if(G.tses==2){update_count();}if(!G.ls){return};var cord=gep(G.sest);G.ret=G.macret.split('@@');if(G.ret[0]=='error') error(G.ret[1]);G.shol.style.top=cord.t+4+"px";G.shol.style.left=cord.l+"px";G.shol.style.width=cord.w-2+"px";G.shol.innerHTML=G.ret[1]+'<div id=clli>закрыть</div>';G.body.appendChild(G.shol);};var ttz='Внимание!!!||<br>Уважаемый пользователь!<br>Если вы частное лицо и вам необходимо подать одно-два объявления, то просим вас набраться терпения для просмотра заставок-рекламы, тем самым вы поддержите наши стремления сделать сайт еще более удобным и привлекательным. Спасибо!||Если вы юридическое лицо или частное, но операции с недвижимостью часть вашей работы, вы много и часто пользуйтесь услугами сайта nppn.ru, вам необходимы скорость и все возможности функции \"Моего кабинета\", то вам достаточно купить пакет "Базовый" в разделе "баланс", вашего кабинета';var dd;G.cmac=false;window.onscroll=funcScrollDiv;document.onmousedown=move;window.onload=function(){G.body=document.body;G.cmac=true;G.help=$('ahelp');if(!(/ieh/i.test(document.cookie))&&!(/msie 8/i.test(navigator.userAgent))&&G.b.msie){load();mac(roottpl+'ajax.php?ids=help&v=10',G.cb);}G.sp=$('return_count')?$('return_count'):0;funcScrollDiv();document.onkeydown=kn;if(G.uimo==0)fg();if (window.attachEvent) startListmenu();G.fi={};if($('filter')){$('fstr').onkeyup=sestku;update_count();}if($('filter')||$('v1')){dd=$('filter')?$('filter').getElementsByTagName('INPUT'):$('v1').getElementsByTagName('INPUT');for(var i=0, s = dd.length; i<s; i++){if(dd[i].parentNode.parentNode.parentNode.parentNode.parentNode.className=='tb_td'){if(dd[i].checked==true){G.fi[dd[i].name+dd[i].value]=1;dd[i].previousSibling.style.background='#efefff';}}}}if(_('bs')){var c=_('bs'), cl=c.length;if(cl>0){G.na=Array();for(i=0;i<cl;i++){G.na[i]='t[]='+c[i].id;};var s=document.createElement('SCRIPT');s.setAttribute('type', 'text/javascript');s.src = '/b.js?'+G.na.join('&');document.getElementsByTagName('head')[0].appendChild(s);}}};function fg(){if(!G.fg)G.fg=$('fg');if(!G.mn)G.mn=$('mn');if(G.mn&&G.fg){var divmnco=gep(G.mn);G.fg.style.top=divmnco.t+'px';G.fg.style.left=divmnco.l+'px';G.fg.style.width=divmnco.w+'px';G.fg.style.height=divmnco.h+'px';G.fg.style.display='block';G.sliHTML(G.help,ttz,1);}return;};function move(e){var r=gett(e,1);if((typeof(G.mode)!="undefined")&&G.mode.id=='ahelp'&&(r[1].id=='ahead'||r[1].parentNode.id=='ahead'))drag.start(r[0],G.help);};function error(t){return;};function funcScrollDiv(){if(!G.rc)G.rc = $('rc');if(!G.rc)return;G.stop=gep($('stop',1));var temp = gch()-33;var scrtop=temp+gbst();G.rc.style.top = G.stop.t>scrtop?scrtop+"px":G.stop.t+"px";};var tmp;document.onclick=function(e){var e=gett(e);if(e.tagName=="A"&&G.fstr){if(e.id!='clear'){$('fstrb').value=e.innerHTML;$('fstr').value=e.innerHTML;}else{$('fstrb').value='Выбрать улицу';$('fstr').value='';}ch();update_count();}if(e.id.substr(0,1)=='h'){id=e.id.substr(1,e.id.length);oh(id);}if(e.parentNode.id=='sl'){if(!G.ads)G.ads=$('ads');if(!G.inch)G.inch = G.ads.getElementsByTagName('INPUT');for(var i=0, s = G.inch.length; i<s; i++){if(G.inch[i].type=='checkbox'){if(e.id=='a'){G.inch[i].checked=true;}else if(e.id=='n'){G.inch[i].checked=false;}else if(e.id=='i'){G.inch[i].checked?G.inch[i].checked=false:G.inch[i].checked=true;}}}}if(e.id=='searchbut' && e.parentNode.id!='fuid')e.parentNode.submit();if(e.id=='searchbut' && e.parentNode.id=='fuid')window.location=roottpl+'item/'+e.parentNode.uid.value;if(e.id=='compare'||e.id=='print')G.comp(e.id);if(e.id=='f_href'){$('r_href').style.textDecoration='underline';e.style.textDecoration='none';$('filter_main').style.display='';$('rubricator_main').style.display='none';$('rubricator_main').parentNode.className='bgp';}if(e.id=='r_href'){$('f_href').style.textDecoration='underline';e.style.textDecoration='none';$('filter_main').style.display='none';$('rubricator_main').style.display='';$('rubricator_main').parentNode.className='bgo';}if(e.id.substr(0,2)=='ra'){for(var i=1; i<5; i++){$('r'+i).style.display='none';$('ra'+i).style.textDecoration='';}$('r'+e.id.substr(2,1)).style.display='block';e.style.textDecoration='underline';return false;}if(e.tagName=='A'){if(e.parentNode.parentNode.parentNode.parentNode.parentNode.className=='tb_td'&&e.tagName!='INPUT'){if(e.nextSibling.type=='radio'){tmp=e.parentNode.parentNode.parentNode.childNodes;for(var i=0, s = tmp.length; i<s; i++){tmp[i].firstChild.firstChild.style.background='#e5e3e3';}e.style.background='#efefff';if(G.b.msie){e.nextSibling.checked=true;if(!$('v1'))e.nextSibling.onclick();}}else{if(!G.fi[e.nextSibling.name+e.nextSibling.value]){G.fi[e.nextSibling.name+e.nextSibling.value]=1;e.style.background='#efefff';if(G.b.msie){e.nextSibling.checked=true;e.nextSibling.onclick();}}else{e.style.background='#e5e3e3';delete(G.fi[e.nextSibling.name+e.nextSibling.value]);if(G.b.msie){e.nextSibling.checked=false;e.nextSibling.onclick();}}}}}if($('graph')){if(e.parentNode.id=='stat1'||e.parentNode.parentNode.id=='stat1'){if(G.lsa[e.id]){G.lsa[e.id].style.display='none';G.lsa['a'+e.id].style.backgroundColor='#fff';}G.lsa[e.id]=e.nextSibling;G.lsa['a'+e.id]=e;e.style.backgroundColor='#ddd';G.lsa[e.id].style.display='block';if(e.nextSibling.firstChild.id=='data')charts(e.nextSibling.firstChild,'bar');}}};G.shol.onmousedown=clshol;G.lsa={};function clshol(e){var e=gett(e);if(e.id!='clli'){G.sest.value=e.innerHTML;}if(G.body.lastChild.tagName=='OL'){G.body.removeChild(G.body.lastChild);}if(G.tses==2){update_count();}delete(G.sest);G.shol.ns=0;};function kn(D){D=D||window.event;var A=D.keyCode;if(A==27&&(typeof(G.mode)!="undefined")){ch();}if(G.sest&&(A==38||A==40)){G.shol.ns=G.shol.ns?G.shol.ns:0;G.shol.childNodes[G.shol.ns].className='';if(A==40){G.shol.ns+=1;G.shol.ns=G.shol.ns>G.shol.childNodes.length-2?0:G.shol.ns;}else if(A==38){G.shol.ns-=1;G.shol.ns=G.shol.ns<0?G.shol.childNodes.length-2:G.shol.ns;}if(G.shol.childNodes[G.shol.ns].tagName=='LI'){G.shol.childNodes[G.shol.ns].className='bli';}}};function bmon(el){if(!G.balance[el.name]){G.balance[el.name]=el.parentNode.parentNode.previousSibling.firstChild.innerHTML;};el.parentNode.parentNode.previousSibling.firstChild.innerHTML=parseInt(G.balance[el.name])*el.childNodes[el.selectedIndex].value;};function buy(el,te, uid){var t=el.id.substr(2,el.id.length);var b=el.previousSibling.value;var d=el.parentNode.previousSibling.firstChild.lastChild.childNodes[el.parentNode.previousSibling.firstChild.lastChild.selectedIndex].value;var p=el.parentNode.previousSibling.previousSibling.firstChild.innerHTML;if(parseFloat(p)<=parseFloat(b)){if(confirm('Вы действительно хотите совершить покупку?')){if(te){$('balan').innerHTML=parseFloat(b)-parseFloat(p);load();mac(roottpl+'ajax.php?ids=ads_buing&v='+uid+'&k='+t+'&d='+d+'&kt='+te,G.cb,1);}else{window.location=roottpl+'bill_action/?buy='+t+'&d='+d;}}}else{alert('Недостаточно денег');return;}};G.comp=function(id){if(!G.ads)G.ads=$('ads');if(!G.inch)G.inch = G.ads.getElementsByTagName('INPUT');G.compare=[];var j=0;for(var i=0, s = G.inch.length; i<s; i++){if(G.inch[i].type=='checkbox' && G.inch[i].checked){G.compare[j]=G.inch[i].id.substr(1,9);j++;}}if(G.compare.length==0){alert('Выберите хотябы одно объявление!');return;};window.open(roottpl+"search/"+id+"/"+G.compare.join(','),id);};var drag={obj:null, fx:0, fy:0, c:null, drel:null, start:function(e,el){document.ondragstart = document.body.onselectstart=function() { return false };drag.obj=el;document.onmousemove=drag.drag;document.onmouseup=drag.end;drag.c=gep(drag.obj);drag.fx=mp(e).x-drag.c.l;drag.fy=mp(e).y-drag.c.t;drag.drel=$('drel');drag.drel.style.top=G.help.style.top;drag.drel.style.left=G.help.style.left;return false;},drag:function(e){drag.obj.focus();mpc=mp(e);drag.drel.style.top=mpc.y-drag.fy+'px';drag.drel.style.left=mpc.x-drag.fx+'px';drag.drel.style.display='block';return false;},end:function(){drag.obj.style.top=drag.drel.style.top;drag.obj.style.left=drag.drel.style.left;drag.drel.style.display='none';document.onmousemove=document.onmouseup=document.ondragstart=document.body.onselectstart=null;}};var price_arr=Array('rub','dol','rub_m','dol_m');function loc(l){update_count();if($('return_count').innerHTML!='0'){if(l=='u'){window.location=url_loc;}else{window.open(url_print,"print");}}else{alert('К сожалению ничего не найдено');}};function stf(num,g){$('S_total_from').value=g;$('S_total_to').value=num;update_count();};function srt(num,g){$('S_rooms_from').value=g;$('S_rooms_to').value=num;update_count();};function slf(num,g){$('S_live_from').value=g;$('S_live_to').value=num;update_count();};function ch_st(){if($('stotal_l').style.display=='none'){$('stotal_l').style.display='block';$('stotal').style.display='none';$('st_id').innerHTML='жилая';}else{$('stotal_l').style.display='none';$('stotal').style.display='block';$('st_id').innerHTML='общая';}};function ch_pr(){for(i=0;i<price_arr.length;i++){$('price_'+price_arr[i]).style.display='none';}if($('currency').value=='rub'){var mmm=$('pl').value=='plm'?'_m':'';$('pr_id').innerHTML='дол';$('currency').value='dol';$('price_'+$('currency').value+mmm).style.display='';}else{var mmm=$('pl').value=='plm'?'_m':'';$('pr_id').innerHTML='руб';$('currency').value='rub';$('price_'+$('currency').value+mmm).style.display='';}for(i=1;i<=4;i++){$('price_to'+i).value='';}};function ch_pl(){for(i=0;i<price_arr.length;i++){$('price_'+price_arr[i]).style.display='none';}if($('pl').value=='plo'){$('price_'+$('currency').value+'_m').style.display='';$('pl_id').innerHTML=category==5?'сотку':'кв.м';$('pl').value='plm';}else{$('price_'+$('currency').value).style.display='';$('pl_id').innerHTML='общую';$('pl').value='plo';}for(var i=1;i<=4;i++){$('price_to'+i).value='';}$('price_from').value='';};var  url_loc,url_print;function update_count(){var arr = Array(),a=0;var div = $('filter');var elems = div.getElementsByTagName("input");for(var i=0, s=elems.length;i<s;i++){if(elems[i].name){if(elems[i].type=='checkbox' && elems[i].checked==true){if(elems[i].value!='on'){var val=elems[i].value;}else if(elems[i].name=='rooms_count[]'){var val=elems[i].value;}else{var val='on';}}else if((elems[i].type=='hidden' || elems[i].type=='text') && elems[i].value!=''){var val=elems[i].name=='fstreet'?encodeURI(elems[i].value):elems[i].value;}else{var val='';}if(val){arr[a]=elems[i].name+'='+val;a++;}}}var elemss = div.getElementsByTagName("select");for(var i=0;i<elemss.length;i++){if(elemss[i].name && elemss[i].value && elemss[i].value!='undefined'){arr[a]=elemss[i].name+'='+elemss[i].value;a++;}}G.curl=roottpl+'ajax.php?ids=count&v=1&c='+category+'&a='+action+'&'+arr.join('&');url_loc=roottpl+surl+'?c='+category+'&a='+action+'&'+arr.join('&');url_print=roottpl+'printfilter/?c='+category+'&a='+action+'&'+arr.join('&');mac(G.curl, count_filter);};function count_filter(){G.ret=G.macret.split('@@');if(G.ret[0]=='error') error(G.ret[1]);G.sp.innerHTML='';G.sp.innerText='';G.sp.innerHTML=G.ret[1]?G.ret[1]:'0';};var list_change_mode_filter;var sel;function list_change_filter(list,mode){list_change_mode_filter = mode;sel=list.id;if(list.id == 'city'){$('div_district').innerHTML='Подождите...';}if(list.id == 'region'){$('div_city').innerHTML='<select name="city" id="city" onchange="list_change_filter(this,\'search\');" style="width:99%;"><option value="">Загружаю...</option></select>';}if(list.value == '' || list.id == 'region'){$('div_district').innerHTML='';update_count();}if(list.value == '' && list.id == 'region'){$('div_city').innerHTML='<select name="city" id="city" onchange="list_change_filter(this,\'search\');" style="width:99%;"><option value="" selected>не важно</option></select>';update_count();}if(list.value!=''){G.curl=list.id == 'city'?roottpl+'ajax.php?ids=district&v='+list.value+'&vv='+$('region').value+'&filter=1':roottpl+'ajax.php?ids=city&v='+list.value;mac(G.curl, list_change_callback_filter);}};function list_change_callback_filter(){G.ret=G.macret.split('@@');if(G.ret[0]=='error') error(G.ret[1]);    if(sel=='city'){$('div_district').innerHTML=G.ret[1];}else{$('div_city').innerHTML='<select name="city" id="city" onchange="list_change_filter(this,\'search\');" style="width:99%;"><option value="" selected>не важно</option>'+G.ret[1]+'</select>';}update_count();};function pt(n, el){if(n==0){$('price_from').value='';}else{var mmm=$('pl').value=='plm'?'_m':'';$('price_from').value=$('price_to'+el).options[parseInt(n)-1].value;}update_count();};function myfi(){load();mac(roottpl+'ajax.php?ids=myfi&v=1',G.cb,1);}function delmyfi(mel){G.mode=G.help;mac(roottpl+'ajax.php?ids=del_myfi&v='+escape(mel.innerHTML),G.cb,1);load();}function sh(el){el.style.display=el.style.display=='none'?'block':'none';}
