if(typeof deconcept=="undefined")
{var deconcept=new Object();}
if(typeof deconcept.util=="undefined")
{deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined")
{deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a)
{if(!document.getElementById){return;}
this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}
if(c){this.addParam("bgcolor",c);}
var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}
return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length)
{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";}else
{if(this.getAttribute("doExpressInstall"))
{this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;},write:function(_20)
{if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version")))
{this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version")))
{var n=(typeof _20=="string")?document.getElementById(_20):_20;if(n!=null){n.innerHTML=this.getSWFHTML();}
return true;}
else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function()
{var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length)
{var x=navigator.plugins["Shockwave Flash"];if(x&&x.description)
{_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}
else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0)
{var axo=1;var _26=3;while(axo)
{try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}
else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null)
{_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}
return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return"";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())
+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')
+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.2",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;}
var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};}
$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});return _remove.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);}
var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));}
return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;}
if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace]=$[namespace]||{};$[namespace][name]=function(element,options){var self=this;this.namespace=namespace;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(event,key,value){if(event.target==element){return self._setData(key,value);}}).bind('getData.'+name,function(event,key){if(event.target==element){return self._getData(key);}}).bind('remove',function(){return self.destroy();});};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);}
options={};options[key]=value;}
$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element
[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+
this.namespace+'-state-disabled').attr("aria-disabled",value);}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);event=$.Event(event);event.type=eventName;if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};$.widget.defaults={disabled:false};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;event.stopImmediatePropagation();return false;}});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;}
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);}
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);function GetRollPossition(objId){var obj;var xPos=0;var yPos=0;var oldObj;oldObj=objId;xPos=0;yPos=0;obj=document.getElementById(objId);while(obj){xPos+=obj.offsetLeft;yPos+=obj.offsetTop;obj=obj.offsetParent;}
return yPos;}
var yadType;function SetyadTypeVertical(strid){if(strid===undefined)strid="vertical";yadType="vertical";}
function SetVerticalLimit()
{var CountOfDirect=0;var hi=(GetRollPossition("positionBottom")-GetRollPossition("positionTop")-GetRollPossition("banners_2"));if(hi>0&&GetRollPossition("DIV_NNN_1730")>220){hi=hi+220;}
CountOfDirect=(Math.round(hi/210));if(CountOfDirect>=5)CountOfDirect=5;if(CountOfDirect<=0)CountOfDirect=0;yd_vertical_yandex_direct_limit=CountOfDirect;return CountOfDirect;}
var showDropFrom=false;var popUpActive=false;hide_selects=false;$(document).ready(function(){$('.pseudo-select .border').click(function(){hide_selects=false;showPopup($(this).offset(),$('.text',$(this)).html());return false;});var t=false;var once=false;$('#statistics .border').mouseover(function(){$(this).click();$('#popUp').mouseover(function(){if(t!=false)
clearTimeout(t);});$('#popUp').mouseout(function(){t=setTimeout('hidePopup()',250);});once=true;});$('#region').mouseover(function(){$('.l-pop-region').show();});$('#changeReg').click(function(){$('.l-pop-region').show();hide_selection();});$('#changeRegs').click(function(){$('.l-pop-region').show();hide_selection();});$('#popUp table').hover(function(){popUpActive=true;},function(){popUpActive=false;});$(document).click(function(){if(!popUpActive)
hidePopup();});});function showPopup(place,content){hidePopup();var ltIE7=false
if(!ltIE7&&$.browser.msie){$.browser.version='6.0';}
if($.browser.msie&&($.browser.version!='7.0'&&hide_selects==true)){$("#search_house_realty_type").css("visibility","hidden");$("#m_select_parent").css("visibility","hidden");$("#search_currency_type").css("visibility","hidden");$("#search_type_deal").css("visibility","hidden");}
popUpActive=true;$(window).unbind('scroll',onScroll);$('#popUp').removeClass('centered');$('#popUp .content').html(content);$('#popUp .content ul li').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});if(place!=undefined){$('#popUp').css('left',place.left-5);$('#popUp').css('top',place.top-5);}
$('#popUp').show();}
function showPopupCenter(content,scroll){hidePopup();if($.browser.msie&&($.browser.version!='7.0')){$('body').prepend('<iframe class="spawn" style="height: '+$(document).height()+'px"></iframe>');}
if(scroll==undefined)
scroll=false;if($.browser.msie&&($.browser.version!='7.0')&&scroll==false)
{scroll=true;}
$('#popUp .content').html(content);$('#popUp').addClass('centered').show();$('#popUp').css('left',0);var wh=document.getElementsByTagName('html')[0].clientHeight;var h=$('#popUp').height();if(h<60)
h=h+200;var sTop=0;if($.browser.msie&&($.browser.version!='7.0')){sTop=$(document).scrollTop();}
var inScr=false;if(h<wh){$('#popUp').css('top',sTop+(wh-h)/2);inScr=true;}else{$('#popUp').css('top',sTop+50);}
if($.browser.msie&&($.browser.version!='7.0')){if(scroll&&inScr)
$(window).bind('scroll',onScroll);}}
function onScroll(){var wh=$(window).height();var h=$('#popUp').height();var sTop=$(document).scrollTop();$('#popUp').css('top',sTop+(wh-h)/2);}
function getDropdownform()
{var formhtml=$('#formdropdown').html();if(formhtml!=''&&formhtml!='undefined'&&formhtml!=null)
{var checkedSvo=document.getElementById('svoform');var checked5fl=document.getElementById('5flform');var checkedStud=document.getElementById('studform');if(checkedSvo.checked)
{document.getElementById('svo').checked=true;}
else
{document.getElementById('svo').checked=false;}
if(checked5fl.checked)
{document.getElementById('5fl').checked=true;}
else
{document.getElementById('5fl').checked=false;}
if(checkedStud.checked)
{document.getElementById('stud').checked=true;}
else
{document.getElementById('stud').checked=false;}
var src=$('#room_selector_img').attr('src');if(!checkedSvo.checked&&!checked5fl.checked&&!checkedStud.checked)
{src=src.replace('_s.png','.png');}
else
{if(!src.match(/_s/ig))
{src=src.replace('.png','_s.png');}}
$('#room_selector_img').attr('src',src);}
var showDropFrom=false;}
function hidePopup()
{getDropdownform();if($.browser.msie&&($.browser.version!='7.0')){$("#search_house_realty_type").css("visibility","");$("#m_select_parent").css("visibility","");$("#search_currency_type").css("visibility","");$("#search_type_deal").css("visibility","");$('iframe.spawn').remove();$(window).unbind('scroll',onScroll);}
$('#popUp').unbind('mouseout');$('#popUp').unbind('mouseover');$('#popUp').hide();}
function viewPhotoWindow(img,width,height)
{if(width==undefined||!width){width=640;}
if(height==undefined||!height){height=480;}
height+=25;wnd=window.open('/photo/?pic='+escape(img),'photo','scrollbars=0,toolbar=0,width='+width+',height='+height+',menubar=0,location=0,statusbar=0');return false;}
function viewFoto(img,width,height)
{try{wnd.close();}catch(e){}
PopUp(img,'photo',width,height);return false;}
function viewPanorams(img,width,height)
{try{wnd.close();}catch(e){}
PopUp(img,'panorams',width,height);return false;}
function PopUp(url,name,width,height,center,resize,scroll,posleft,postop)
{var Win=PopUpWindow("",name,width,height,center,resize,scroll,posleft,postop);Win.document.open();Win.document.write('<html><head><title>Изображение');Win.document.write('</title></head><style type="text/css">body { margin: 0px; padding: opx; }</style><body>');Win.document.write('<img src="'+url+'" hspace="0" vspace="0" border="0" />');Win.document.write('</body></html>');Win.document.close();}
function PopUpWindow(url,name,width,height,center,resize,scroll,posleft,postop)
{width=width>0?width:640;height=height>0?height:475;var showx="";var showy="";if(posleft!=0){X=posleft}
if(postop!=0){Y=postop}
if(!scroll){scroll=0}
if(!resize){resize=0}
if(scroll!=0){scroll=1}
var Win=window.open(url,name,'width='+width+',height='+height+showx+showy+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');return Win;}
function hideFoto(){hidePopup();}
function get_null_value()
{return"<select size=\"10\" style=\"background-color:#efefef;\">не заполнено<option/></select>";}
function onchange_selection(obj,value,notevent)
{var url='/geo/getregion';var next;var next2;var id=obj.val();var name="";var event="";value=value*1;name=obj.attr("NAME");var string=get_null_value();if((value!=undefined)&&(value>0)){id=value;$('#GROUP_ID').html(string);}
var string=get_null_value();if(name=="GROUP_ID"){event="country";next="COUNTRY_ID";next2="REGION_ID";$('#'+next).html(string);if(notevent!=1){$('#'+next2).html(string);}
$('#'+'onclick').hide();$('#'+'noclick').show();$('#'+'onclick_top').hide();$('#'+'noclick_top').show();}
if(name=="COUNTRY_ID"){event="region";next="REGION_ID";$('#'+'onclick').show();$('#'+'noclick').hide();$('#'+'onclick_top').hide();$('#'+'noclick_top').show();}
if(name=="REGION_ID"){event="set_region";$('#'+'noclick').hide();$('#'+'onclick').show();$('#'+'onclick_top').hide();$('#'+'noclick_top').show();}
if(notevent==2){event="groups";next="GROUP_ID";}
if(event!="set_region"){$('#'+next).html("<div style='width: 150px;'><img src='/images/wait.gif' align='absmiddle'/>&nbsp;&nbsp;&nbsp;Загрузка</div>");$.get(url,{type:'type',mode:'ajax',event:event,group_id:id+''},function(data)
{$('#'+next).html(data);if(notevent==2){onchange_selection($('#GROUP_ID_S'));}});}
else{$('#change_regions').val(obj.value);}
$('.l-pop-region').bgiframe();}
function setRegionCountryGroup(region_id,country_id,group_id){$('.regionText tr').removeClass('selected');$('.regionText tr[id='+region_id+']').addClass('selected');if(region_id==null)region_id=0;if(country_id==null)country_id=0;if(group_id==null)group_id=0;$('#change_regions').val(region_id);$('#change_country').val(country_id);$('#change_group').val(group_id);hidePopup();$('.regionText').click(function(){return false;});$('.regionText tr').click(function(){return false;});$('#change_region_form_script').submit();}
function hide_selection()
{$('.select').hide();$('#search_price_type').hide();$('.control').hide();$('.formIco').hide();}
function show_selection()
{$('.select').show();$('#search_price_type').show();$('.control').show();$('.formIco').show();}
function clickRegOnSearch()
{default_regions_set();$('.l-pop-region').show();hide_selection();return false;}
function onchange_adv(obj,value,notevent)
{var url='/geo/getregion';var next;var next2;var id=obj.val();var name="";var event="";value=value*1;name=obj.attr("NAME");var idss=obj.attr("ID");var string=get_null_value();if((value!=undefined)&&(value>0)){id=value;$('#GROUP_ID').html(string);}
if(name=="GROUP_ID"){event="country";next="COUNTRY_ID";next2="REGION_ID";$('#'+next).html(string);if(notevent!=1){$('#'+next2).html(string);}
$('#'+'onclick').hide();$('#'+'noclick').show();$('#'+'onclick_top').hide();$('#'+'noclick_top').show();}
if(idss=="COUNTRY_ID_S"){event="region";next="REGION";}
$('#'+next).html("<div style=''><img src='/images/wait.gif' align='absmiddle'/>&nbsp;&nbsp;&nbsp;Загрузка</div>");$.get(url,{type:'type',mode:'ajax',event:event,group_id:id+'',size:1,name:'PROPERTY_VALUES[ID_REGION]'},function(data){$('#'+next).html(data);});}
(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d<b))){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);;function getCountVal(value,text){if(value>10&&value<20){res=text[2];}else{switch((""+(value%10)).charAt(0)){case"1":res=text[0];break;case"2":res=text[1];break;case"3":res=text[1];break;case"4":res=text[1];break;default:res=text[2];break;}}
return res;}
var favClass='isFav';var noFavClass='isNoFav';var noFavTitle='Добавить в избранное';var yesFavTitle='Объявление находится в избранном. Нажмите, чтобы удалить из избранного';var pleaseAuthText='<a href="/personal/">Авторизуйтесь</a>&nbsp;,&nbsp;чтобы&nbsp;воспользоваться&nbsp;Избранным';var sessExpireText='Ваша сессия истекла. ';var linkAddToFav=noFavTitle;var linkDelFav='Удалить из избранного';var favsActionLocked=false;function toggleFavState(adsId,status)
{if(status==1){updateFavsCount(1);$('#STATUS_ADS_ID_'+adsId).val(1);$('.fav'+adsId).attr('title',yesFavTitle).addClass('icoStar_orange').removeClass('icoStar_white');$('.favLink').attr('title',yesFavTitle).addClass(favClass).removeClass(noFavClass).text(linkDelFav);}
else if(status==0){updateFavsCount(-1);$('#STATUS_ADS_ID_'+adsId).val(0);$('.fav'+adsId).attr('title',noFavTitle).removeClass('icoStar_orange').addClass('icoStar_white');$('.favLink').attr('title',noFavTitle).removeClass(favClass).addClass(noFavClass).text(linkAddToFav);}
else if(status==-1){$('.'+favClass+', .'+noFavClass).attr('class','favLink').removeAttr('onclick').unbind('click');}
if(typeof(search_MapObjectEvent)!='undefined')
setTimeout(function(){search_MapObjectEvent(adsId,1);},100);}
function changeStatus(Id,adsId,xmlidStatus){if(favsActionLocked){return false;}
favsActionLocked=true;$.get('/realty/changestatus',{id:$('#STATUS_ADS_ID_'+adsId).val(),mode:'ajax',id_ads:adsId,xml_id_status:xmlidStatus},function(data){toggleFavState(adsId,data);favsActionLocked=false;});return true;}
function updateFavsCount(cnt)
{var initval=$('.count_favorite:first').text();initval=initval!=undefined?parseInt(initval):0;var res=initval+cnt;if(res<0){res=0;}
$('.count_favorite').text(res);var tab=$('#favTabs li.current span');if(tab.length>0){initval=$(tab.get(0)).attr('tmp_cnt');initval=initval!=undefined?parseInt(initval):0;var res=initval+cnt;if(res<0){res=0;}
$('em',tab).html('('+res+')');tab.attr('tmp_cnt',res);}
var text='';if(res==1){text='объект';}
else{var strRes=res.toString();res=strRes.charAt(strRes.length-1);if(res=='2'||res=='3'||res=='4'){text='объекта';}
else{text='объектов';}}
$('.favoritesCountText').text(text);}
$(document).ready(function(){$('.addToFavorites').click(function(){showPopup({top:$(this).offset().top-7,left:$(this).offset().left-7},pleaseAuthText);return false;});});function my_getbyid(id)
{itm=null;if(document.getElementById)
{itm=document.getElementById(id);}
else if(document.all)
{itm=document.all[id];}
else if(document.layers)
{itm=document.layers[id];}
return itm;}
function countdown(yr,m,d,h)
{var today=new Date();var todayy=today.getYear();if(todayy<1000)
todayy+=1900;var todaym=today.getMonth()+1;var todayd=today.getDate();var todayh=today.getHours();var todaymin=today.getMinutes();var todaysec=today.getSeconds();var todaystring=todayy+"/"+todaym+"/"+todayd+" "+todayh+":"+todaymin+":"+todaysec;var futurestring=yr+"/"+m+"/"+d+" "+h+":00";dd=Date.parse(futurestring)-Date.parse(todaystring);dday=Math.floor(dd/(60*60*1000*24)*1);dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);return{days:dday,hours:dhour,mins:dmin,secs:dsec};}
function declension(num,words)
{num=Math.abs(num);var plural=(num%10==1&&num%100!=11)?0:((num%10>=2&&num%10<=4&&(num%100<10||num%100>=20))?1:2);return words[plural]!==undefined?words[plural]:'';}
function setCounter(year,month,day,hour)
{var timeout=function(){setCounter(year,month,day,hour);};var counter=countdown(year,month,day,hour);$('#countDays').text(counter.days);$('#countHours').text(counter.hours);$('#countMins').text(counter.mins);$('#countSecs').text(counter.secs);$('#countDaystr').text(declension(counter.days,['день','дня','дней']));$('#countHourstr').text(declension(counter.hours,['час','часа','часов']));$('#countMinstr').text(declension(counter.mins,['минута','минуты','минут']));$('#countSecstr').text(declension(counter.secs,['секунда','секунды','секунд']));setTimeout(timeout,1000);}
function auObjectListLoad()
{thumbs=$('#apartmentsList .gallery img.thumbnail');jQuery.each(thumbs,function(ii,ff){el=$(ff);el.css({cursor:'pointer'});el.click(function(){me=$(this);big=$('img.current',$(this).parent());big.fadeTo(200,0.1);me.fadeTo(200,0.1,function(){meimg=me.attr('src');bigimg=big.attr('src');meimg=meimg.substr(0,meimg.search(/_w/));bigimg=bigimg.substr(0,bigimg.search(/_w/));me.load(function(){me.fadeTo(400,1);});big.load(function(){big.fadeTo(200,1);});me.attr('src',bigimg+'_w84.jpg');big.attr('src',meimg+'_w360.jpg');})});});}
function carouselView(id)
{var ph=$('#current_photo');var url='http://www.gdeetotdom.ru/images/static/auction/'+id+'_w360.jpg';ph.fadeTo(200,0.1,function(){ph.load(function(){ph.fadeTo(400,1);});ph.attr('src',url);});}
if(jQuery)(function($){$.extend($.fn,{multiSelect:function(o,callback){if(!o)var o={};if(o.selectAll==undefined)o.selectAll=true;if(o.selectAllText==undefined)o.selectAllText="Select All";if(o.noneSelected==undefined)o.noneSelected='Select options';if(o.oneOrMoreSelected==undefined)o.oneOrMoreSelected='% selected';$(this).each(function(){var select=$(this);var html='<input type="text" readonly="readonly" class="multiSelect" value="" style="cursor: default;" />';html+='<div class="multiSelectOptions" style="position: absolute; z-index: 99999; display: none;">';if(o.selectAll)html+='<label class="selectAll"><input type="checkbox" class="selectAll" />'+o.selectAllText+'</label>';$(select).find('OPTION').each(function(){if($(this).val()!=''){html+='<label><input type="checkbox" name="'+$(select).attr('name')+'" value="'+$(this).val()+'"';if($(this).attr('selected'))html+=' checked="checked"';html+=' />'+$(this).html()+'</label>';}});html+='</div>';$(select).after(html);$(select).next('.multiSelect').mouseover(function(){$(this).addClass('hover');}).mouseout(function(){$(this).removeClass('hover');}).click(function(){if($(this).hasClass('active')){$(this).multiSelectOptionsHide();}else{$(this).multiSelectOptionsShow();}
return false;}).focus(function(){$(this).addClass('focus');}).blur(function(){$(this).removeClass('focus');});if(o.selectAll){var sa=true;$(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT:checkbox').not('.selectAll').each(function(){if(!$(this).attr('checked'))sa=false;});if(sa)$(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT.selectAll').attr('checked',true).parent().addClass('checked');}
$(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT.selectAll').click(function(){if($(this).attr('checked')==true)$(this).parent().parent().find('INPUT:checkbox').attr('checked',true).parent().addClass('checked');else $(this).parent().parent().find('INPUT:checkbox').attr('checked',false).parent().removeClass('checked');});$(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT:checkbox').click(function(){$(this).parent().parent().multiSelectUpdateSelected(o);$(this).parent().parent().find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');$(this).parent().parent().prev('.multiSelect').focus();if(!$(this).attr('checked'))$(this).parent().parent().find('INPUT:checkbox.selectAll').attr('checked',false).parent().removeClass('checked');if(callback)callback($(this));});$(select).next('.multiSelect').next('.multiSelectOptions').each(function(){$(this).multiSelectUpdateSelected(o);$(this).find('INPUT:checked').parent().addClass('checked');});$(select).next('.multiSelect').next('.multiSelectOptions').find('LABEL').mouseover(function(){$(this).parent().find('LABEL').removeClass('hover');$(this).addClass('hover');}).mouseout(function(){$(this).parent().find('LABEL').removeClass('hover');});$(select).next('.multiSelect').keydown(function(e){if($(this).next('.multiSelectOptions').is(':visible')){if(e.keyCode==9){$(this).addClass('focus').trigger('click');$(this).focus().next(':input').focus();return true;}
if(e.keyCode==27||e.keyCode==37||e.keyCode==39){$(this).addClass('focus').trigger('click');}
if(e.keyCode==40){if(!$(this).next('.multiSelectOptions').find('LABEL').hasClass('hover')){$(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');}else{$(this).next('.multiSelectOptions').find('LABEL.hover').removeClass('hover').next('LABEL').addClass('hover');if(!$(this).next('.multiSelectOptions').find('LABEL').hasClass('hover')){$(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');}}
$(this).multiSelectAdjustViewport($(this));return false;}
if(e.keyCode==38){if(!$(this).next('.multiSelectOptions').find('LABEL').hasClass('hover')){$(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');}else{$(this).next('.multiSelectOptions').find('LABEL.hover').removeClass('hover').prev('LABEL').addClass('hover');if(!$(this).next('.multiSelectOptions').find('LABEL').hasClass('hover')){$(this).next('.multiSelectOptions').find('LABEL:last').addClass('hover');}}
$(this).multiSelectAdjustViewport($(this));return false;}
if(e.keyCode==13||e.keyCode==32){if($(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').hasClass('selectAll')){if($(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked')){$(this).next('.multiSelectOptions').find('INPUT:checkbox').attr('checked',false).parent().removeClass('checked');}else{$(this).next('.multiSelectOptions').find('INPUT:checkbox').attr('checked',true).parent().addClass('checked');}
$(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);if(callback)callback($(this));return false;}
if($(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked')){$(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked',false);$(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);$(this).next('.multiSelectOptions').find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');$(this).next('.multiSelectOptions').find('INPUT:checkbox.selectAll').attr('checked',false).parent().removeClass('checked');if(callback)callback($(this));}else{$(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked',true);$(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);$(this).next('.multiSelectOptions').find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');if(callback)callback($(this));}}
return false;}else{if(e.keyCode==38||e.keyCode==40||e.keyCode==13||e.keyCode==32){$(this).removeClass('focus').trigger('click');$(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');return false;}
if(e.keyCode==9){$(this).focus().next(':input').focus();return true;}}
if(e.keyCode==13)return false;});if($.fn.bgiframe)$(select).next('.multiSelect').next('.multiSelectOptions').bgiframe();$(select).remove();});},multiSelectOptionsHide:function(){$(this).removeClass('active').next('.multiSelectOptions').hide();},multiSelectOptionsShow:function(){$('.multiSelect').multiSelectOptionsHide();$(this).next('.multiSelectOptions').find('LABEL').removeClass('hover');$(this).addClass('active').next('.multiSelectOptions').show();var offset=$(this).position();$(this).next('.multiSelectOptions').css({top:offset.top+$(this).outerHeight()+'px'});$(this).next('.multiSelectOptions').css({left:offset.left+'px'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;$(this).next('.multiSelectOptions').children().each(function(){listHeight+=this.offsetHeight;});if(listHeight>200)$(this).next('.multiSelectOptions').css({height:'200px'});}
multiSelectCurrent=$(this);var timer='';$(this).next('.multiSelectOptions').hover(function(){clearTimeout(timer);},function(){timer=setTimeout('jQuery(multiSelectCurrent).multiSelectOptionsHide(); $(multiSelectCurrent).unbind("hover");',250);});},multiSelectUpdateSelected:function(o){var i=0,s='';$(this).find('INPUT:checkbox:checked').not('.selectAll').each(function(){i++;})
if(i==0){$(this).prev('INPUT.multiSelect').val(o.noneSelected);}else{if(o.oneOrMoreSelected=='*'){var display='';$(this).find('INPUT:checkbox:checked').each(function(){if($(this).parent().text()!=o.selectAllText)display=display+$(this).parent().text()+', ';});display=display.substr(0,display.length-2);$(this).prev('INPUT.multiSelect').val(display);}else{$(this).prev('INPUT.multiSelect').val(o.oneOrMoreSelected.replace('%',i));}}},multiSelectAdjustViewport:function(el){var i=0;var selectionTop=0,selectionHeight=0;$(el).next('.multiSelectOptions').find('LABEL').each(function(){if($(this).hasClass('hover')){selectionTop=i;selectionHeight=$(this).outerHeight();return;}
i+=$(this).outerHeight();});var divScroll=$(el).next('.multiSelectOptions').scrollTop();var divHeight=$(el).next('.multiSelectOptions').height();$(el).next('.multiSelectOptions').scrollTop(selectionTop-((divHeight/2)-(selectionHeight/2)));}});})(jQuery);var show=false;var change_form=0;var last_type=0;var last_td=0;function SearchFormOnReady()
{$('#search_type_deal').change(function()
{AdvSearch.updateFromSimple();});$('#search_house_realty_type').change(function()
{AdvSearch.updateFromSimple();});$('#search_form input.button').click(function(){return validateForm('search_form');});$('#search_form').keypress(function(event){try{if(event.keyCode==13){validateForm('search_form');}}catch(e){}});metroCount=($('#metro_stn_concat').length>0&&$('#metro_stn_concat').val().length>0)?$('#metro_stn_concat').val().split(',').length:0;admCount=($('#okrug_concat').length>0&&$('#okrug_concat').val().length>0)?$('#okrug_concat').val().split(',').length:0;AdvSearch.updateFromSimple();}
$(document).ready(function(){SearchFormOnReady();});function setSelectValue(id,value,txt){$('#'+id).val(value);$('#'+id).change();$('#'+id+'_txt .pseudo-a').text(txt);hidePopup();}
function trim(inputString){if(typeof inputString!="string"){return inputString;}
var retValue=inputString;var ch=retValue.substring(0,1);while(ch==" "){retValue=retValue.substring(1,retValue.length);ch=retValue.substring(0,1);}
ch=retValue.substring(retValue.length-1,retValue.length);while(ch==" "){retValue=retValue.substring(0,retValue.length-1);ch=retValue.substring(retValue.length-1,retValue.length);}
while(retValue.indexOf("  ")!=-1){retValue=retValue.substring(0,retValue.indexOf("  "))+retValue.substring(retValue.indexOf("  ")+1,retValue.length);}
return retValue;}
function validateForm(id)
{var errors=false;if($('#pstart').length)
{var fromPrice=$('#pstart').val();var toPrice=$('#pfinal').val();var isNull=false;if(fromPrice==''){fromPrice=0;isNull=true;}else{if(!isNaN(fromPrice))
fromPrice=parseInt(fromPrice);}
if(toPrice==''){toPrice=0;isNull=true;}else{if(!isNaN(toPrice))
toPrice=parseInt(toPrice);}
if(isNaN(fromPrice)||isNaN(toPrice)){errors=true;showError('invalidPriceVals','pstart');}else if(toPrice<0||fromPrice<0){errors=true;showError('negativePriceVals','pstart')}else if((toPrice<fromPrice)&&(!isNull)){errors=true;showError('incorrectPriceVals','pstart');}}
if($('#fromSquare').length)
{var fromSquare=$('#fromSquare').val();var toSquare=$('#toSquare').val();var isNull=false;if(fromSquare==''){fromSquare=0;isNull=true;}else{if(!isNaN(fromSquare))
fromSquare=parseInt(fromSquare);}
if(toSquare==''){toSquare=0;isNull=true;}else{if(!isNaN(toSquare))
toSquare=parseInt(toSquare);}
if(isNaN(fromSquare)||isNaN(toSquare)){errors=true;showError('invalidTotalVals','fromSquare');}else if(fromSquare<0||toSquare<0){errors=true;showError('negativeTotalVals','fromSquare')}else if((toSquare<fromSquare)&&(!isNull)){errors=true;showError('incorrectSquareVals','fromSquare');}}
if($('#fromBld').length)
{var fromBld=$('#fromBld').val();var toBld=$('#toBld').val();var isNull=false;if(fromBld==''){fromBld=0;isNull=true;}else{if(!isNaN(fromBld))
fromBld=parseInt(fromBld);}
if(toBld==''){toBld=0;isNull=true;}else{if(!isNaN(toBld))
toBld=parseInt(toBld);}
if(isNaN(fromBld)||isNaN(toBld)){errors=true;showError('invalidBldVals','fromBld');}else if(fromBld<0||toBld<0){errors=true;showError('negativeBldVals','fromBld')}else if((toBld<fromBld)&&(!isNull)){errors=true;showError('incorrectBldVals','fromBld');}}
if(!errors){$('#'+id).submit();return true;}else{return false;}}
function showError(errorType,fieldID){if($("#"+fieldID).length)
{}
else
{return;}
var errorMess=new Object();errorMess.invalidPriceVals="Некорректное значение цены.<br />Вводите, пожалуйста, только положительные целые числа без пробелов";errorMess.invalidBldVals="Некорректное значение года постройки.<br />Вводите, пожалуйста, только положительные целые числа без пробелов";errorMess.invalidTotalVals="Некорректное значение метров.<br />Вводите, пожалуйста, только положительные целые числа без пробелов";errorMess.negativePriceVals="Некорректное значение цены.<br />Цены должны быть положительными";errorMess.negativeBldVals="Некорректное значение года постройки.<br />Год постройки должн быть положительным";errorMess.negativeTotalVals="Некорректное значение метров.<br />Метры должны быть положительными";errorMess.incorrectPriceVals="Цена от не может превышать цену до";errorMess.incorrectTotalVals="Значение от не может превышать значение до";errorMess.incorrectSquareVals="Площадь от не может превышать площадь до";errorMess.incorrectBldVals="Значение от не может превышать значение до";if(errorType!=''){$('#errorMessageDiv .closeBtn a').click(function(){$('#errorMessageDiv').hide();});eval('errorText = errorMess.'+errorType+';');errorText='<span class="error">'+errorText+'</span>';var offset=$('#'+fieldID).offset();offset.top=offset.top+$('#'+fieldID).height()+7;showPopup(offset,errorText);$('#'+fieldID).focus(function(){$('#errorMessageDiv').hide();});$('#pfinal').focus(function(){$('#errorMessageDiv').hide();});}}
function checkEnter()
{validateForm('search_form');}
function metro_init(){if(flashShowAdm){$('#mAreas span').each(function(){$(this).append('<i>,</i>');$(this).appendTo('#items').attr('title','Нажмите, чтобы удалить из списка');$('#items').append(' ');});$('#items').append('<br /><br />')}
if(flashShowMetro){$('#mStations span').each(function(){$(this).append('<i>,</i>');$(this).appendTo('#items').attr('title','Нажмите, чтобы удалить из списка');$('#items').append(' ');});}
if(!flashShowMetro&&!flashShowAdm){$('#items').remove();$('#chooseBox').remove();}else{if(flashShowMetro)
$('#mStations').empty();if(flashShowAdm)
$('#mAreas').empty();$('#mStations span:has(input:checked)').show();$('#mAreas span:has(input:checked)').show();$('#items span').click(function(){stationElementClick(this);});}
function createOptions(id,title,val)
{var textContainer=$("<option/>");textContainer.attr("id",id);textContainer.attr("value",val);textContainer.text(title);$("#search_price_type").append(textContainer);}
function show_pop()
{showPopupCenter('<div id="authData"><img src="/images/wait.gif" align="left" border="0" /><div style="margin-left:32px;margin-right:15px;padding-top:2px;">Загрузка...</div></div>',false);}
last_td=$("#search_type_deal").val();}
function stationElementClick(elem)
{var value=$('input[type=checkbox]',$(elem)).val();if($(elem).hasClass('metroSt'))
removeStation(value);else
removeAdm(value);}
function removeStationElement(elem)
{$('input[type=checkbox]',$(elem)).removeAttr('checked');$(elem).hide();if($(elem).hasClass('metroSt'))
{$('#st_flash_for_a').html(countStations());try
{var flashMovie=getFlashMovieObject(nameFileMetro);flashMovie.clearItems($('input',$(elem)).val());}
catch(e){}}
else
{$('#adm_flash_for_a').html(countAdms());try
{var flashMovie=getFlashMovieObject(nameFileAdm);flashMovie.clearItems($('input',$(elem)).val());}
catch(e){}}}
function addToAreaList(id,name)
{var leftContainer=$('#popup-area-list-left');var rightContainer=$('#popup-area-list-right');var container=null;if(leftContainer.children().size()>rightContainer.children().size())
container=rightContainer;else
container=leftContainer;var html='<p id="popup-area-id-'+id+'"><a href="#" onclick="removeAdm(\''+id+'\'); return false;">'+name+'</a></p>';container.append(html);}
function addToStationList(id,name)
{var container1=$('#popup-station-list-1');var container2=$('#popup-station-list-2');var container3=$('#popup-station-list-3');var container4=$('#popup-station-list-4');var container=null;var arr=[container1.children().size(),container2.children().size(),container3.children().size(),container4.children().size()];function getMinKey(arr)
{var min=arr[0];var minKey=0;var len=arr.length;for(var i=0;i<len;i++)if(arr[i]<min)minKey=i;return minKey;}
var key=getMinKey(arr);container=$('#popup-station-list-'+(++key));var html='<p id="popup-station-id-'+id+'"><a href="#" onclick="removeStation('+id+'); return false;">'+name+'</a></p>';container.append(html);}
function removePopupStations()
{clearItems('metro');$('#popup-station-list-1').html('');$('#popup-station-list-2').html('');$('#popup-station-list-3').html('');$('#popup-station-list-4').html('');$('#selected-stations-selector').html(0);}
function removePopupArea(id)
{$('#popup-area-id-'+id).remove();modifyAreaLabel(false);}
function removePopupAreas()
{clearItems('adm');$('#popup-area-list-left').html('');$('#popup-area-list-right').html('');$('#selected-areas-selector').html(0);}
function removePopupStation(id)
{$('#popup-station-id-'+id).remove();modifyStationLabel(false);}
function modifyAreaLabel(add)
{var element=$('#selected-areas-selector');var count=element.html();if(add)
element.html(++count);else
element.html(--count);}
function modifyStationLabel(add)
{var element=$('#selected-stations-selector');var count=element.html();if(add)
element.html(++count);else
element.html(--count);}
function addPopupArea(id,name)
{addToAreaList(id,name);modifyAreaLabel(true);}
function addPopupStation(id,name)
{addToStationList(id,name);modifyStationLabel(true);}
function addStationList(ids)
{if(navigator.userAgent.indexOf('Opera')!=-1)
setTimeout(function(){addStationListTimeOut(ids)},1);else
addStationListTimeOut(ids);}
function addStationListTimeOut(ids)
{for(var i in ids)
{addStation('',ids[i].id);}}
function removeStationList(ids)
{for(var i in ids)
{removeStation(ids[i].id);}}
function addStation(name,id,nosync)
{$('#items #stn'+id).attr('checked','checked');$('#st_flash_for_a').html(countStations());if(!nosync&&AdvSearch.syncMetro)
AdvSearch.syncMetro(true,id,true);$("#metro_select").text(getText());if($('#popup-station-list-container'))
{var stationName=$('#items #st'+id).text().replace(/,/g,'');addPopupStation(id,stationName);}}
function removeStation(id,nosync)
{$('#stn'+id).removeAttr('checked');removeStationElement($('#items #st'+id));if(!nosync&&AdvSearch.syncMetro)
AdvSearch.syncMetro(false,id,true);$("#metro_select").text(getText());if($('#popup-station-list-container'))
{removePopupStation(id)}}
function countStations()
{var result=0;if($('#metro_map span.metroSt').length>0)
result=$('#metro_map span.metroSt input:checked').length;else if($('#metro_chbx_block').length>0)
result=$('#metro_chbx_block .metroSt input:checked').length;else
return false;if(result==0){result=false;}else{result="станций: "+result;}
return result;}
function countAdms()
{var result=0;if($('#metro_map').length>0)
result=$('#metro_map span.adm input:checked').length;else if($('#districts_chbxs').length>0)
result=$('#districts_chbxs input.okrug_chbx:checkbox:checked').length;if(result==0){result=false;}else{result="округов: "+result;}
return result;}
function addAdm(name,id,nosync)
{$('#metro_map #ar'+id+' input').attr('checked','checked').parent().show();$('#adm_flash_for_a').html(countAdms());if(!nosync)
AdvSearch.setOkrug(true,id,true);$("#metro_select").text(getText());if($('#popup-area-list-container'))
{var areaName=$('#items #ar'+id).text().replace(/,/g,'');addPopupArea(id,areaName);}}
function removeAdm(id,nosync)
{$('#metro_map #ar'+id+' input').removeAttr('checked');if(!nosync)
AdvSearch.setOkrug(false,id,true);try
{var flashMovie=getFlashMovieObject(nameFileAdm);flashMovie.clearItems(id);}
catch(e){}
$("#metro_select").text(getText());if($('#popup-area-list-container'))
{removePopupArea(id);}}
function strReplace(s,r,w)
{return s.split(r).join(w);}
function trim(str)
{if(!str)return'';return str.replace(/^\s+|\s+$/g,'');}
function toggleStationsPopup(mode)
{if(mode)
{toggleAreaPopup(false);$('#pseudo-select-popup-container').show();}
else
$('#pseudo-select-popup-container').hide();}
function toggleAreaPopup(mode)
{if(mode)
{toggleStationsPopup();$('#pseudo-select-popup-area-container').show();}
else
$('#pseudo-select-popup-area-container').hide();}
function switchSchema(type)
{if(type=='metro')
{$('#schema-metro-id').addClass('selected');$('#schema-area-id').removeClass('selected');toggleFlashContainers('metro');}
else
{$('#schema-metro-id').removeClass('selected');$('#schema-area-id').addClass('selected');toggleFlashContainers('area');}}
function toggleFlashContainers(type)
{if(type=='metro')
{$('#mStations-container').css('width','auto');$('#mStations-container').css('height','auto');$('#mAreas-container').css('width','1px');$('#mAreas-container').css('height','1px');}
else
{$('#mStations-container').css('width','1px');$('#mStations-container').css('height','1px');$('#mAreas-container').css('width','auto');$('#mAreas-container').css('height','auto');}}
function clearItems(type)
{if(type==undefined||type=='metro')
{try{var flashMovie=getFlashMovieObject(nameFileMetro);flashMovie.clearItems("all");}catch(e){}
$('#metro_map .metroSt input[type=checkbox]:checked').removeAttr('checked').each(function()
{if($('#popup-station-list-container'))
{removePopupStation(this.value);}});$('#st_flash_for_a').html(countStations());AdvSearch.setCheckboxes(false,'metro_chbx_block');}
if(type==undefined||type=='adm')
{try{var flashMovie=getFlashMovieObject(nameFileAdm);flashMovie.clearItems("all");}catch(e){}
if($('#popup-station-list-container'))
{$('#districts_chbxs input[type=checkbox]:checked.okrug_chbx').each(function()
{removePopupArea(this.value);});}
$('#metro_map .adm input[type=checkbox]').removeAttr('checked');$('#adm_flash_for_a').html(countAdms());AdvSearch.setCheckboxes(false,'districts_chbxs');}
try
{$("#metro_select").text(getText());}
catch(e){}}
function selectItems(type)
{if(type==undefined||type=='metro')
{try{var flashMovie=getFlashMovieObject(nameFileMetro);flashMovie.selectItems("all");}catch(e){}
if($('#popup-station-list-container'))
{$('#metro_stations_list .metroSt input[type=checkbox]:not(:checked)').each(function()
{var stationName=$('#items #st'+this.value).text().replace(/,/g,'');addPopupStation(this.value,stationName);});}
$('#metro_map .metroSt input[type=checkbox]').attr('checked','checked');$('#st_flash_for_a').html(countStations());AdvSearch.setCheckboxes(true,'metro_chbx_block');}
if(type==undefined||type=='adm')
{try{var flashMovie=getFlashMovieObject(nameFileAdm);flashMovie.selectItems("all");}catch(e){}
if($('#popup-station-list-container'))
{$('#districts_chbxs input[type=checkbox]:not(:checked).okrug_chbx').each(function()
{var areaName=$('#items #ar'+this.value).text().replace(/,/g,'');addPopupArea(this.value,areaName);});}
$('#metro_map .adm input[type=checkbox]').attr('checked','checked');$('#adm_flash_for_a').html(countAdms());AdvSearch.setCheckboxes(true,'districts_chbxs');}
$("#metro_select").text(getText());}
function getFlashMovieObject(movieName)
{if(window.document[movieName])
{return window.document[movieName];}
if(navigator.appName.indexOf("Microsoft Internet")==-1)
{if(document.embeds&&document.embeds[movieName])
return document.embeds[movieName];}
else
{return document.getElementById(movieName);}}
function showMap()
{if($('#metro_map').length==0)
updateMetro(showMetroBlock);else
showMetroBlock();}
function updateMetro(callback)
{AdvSearch.setAdmMetroValues();$('#metro_map_wrapper').load('/search/metro/map/'+AdvSearch.prepareQueryString(),{},function()
{$.getScript('/search/metro/init/'+AdvSearch.prepareQueryString(),showMetroBlock);});}
function showMetroBlock()
{$('#metro_map').show().bgiframe();generateMaps();$('#bg-overlay').show();$('#m_select_parent').hide();DD_belatedPNG.fix('.pseudo-select-popup-container .pseudo-select-popup-top');DD_belatedPNG.fix('.pseudo-select-popup-container .pseudo-select-popup-middle');DD_belatedPNG.fix('.pseudo-select-popup-container .pseudo-select-popup-bottom');DD_belatedPNG.fix('.pseudo-select-popup-area-container .pseudo-select-popup-top-area');DD_belatedPNG.fix('.pseudo-select-popup-area-container .pseudo-select-popup-middle-area');DD_belatedPNG.fix('.pseudo-select-popup-area-container .pseudo-select-popup-bottom-area');}
function metroSelect(){$("div#metro_map").hide();$("div#bg-overlay").hide();$('#m_select_parent').show();if($.browser.msie&&$.browser.version=='6.0'){popUpActive=false;$('iframe.spawn').remove();}
$('#adm_flash_for_a').html(countAdms());$('#st_flash_for_a').html(countStations());$("#metro_select").text(getText());}
function metroCancel(){$("div#metro_map").hide();$("div#bg-overlay").hide();$('#m_select_parent').show();if($.browser.msie&&$.browser.version=='6.0'){popUpActive=false;$('iframe.spawn').remove();}}
function getText()
{var stc=countStations();var adms=countAdms();if(stc===false&&adms===false)
return'местоположение';var result='';if(stc!==false)
{result=stc;if(adms!==false)
result+=';';}
return result+(adms!==false?adms:'');}
function AdvSearchObj()
{var rtype;var dealtype;var objtype;var region;var country;var loading=false;var advanced=0;var queryOverride;this.callback=function(){this.loading=false;$('#advSearchBtn').show();$('#advSearchBtnLoading').hide();$('#advSearchBtn .show').toggle();$('#advSearchBtn .hide').toggle();$('#advSearchForm').slideToggle('slow');$('#advanced_flag').val(1);AdvSearch.advanced=AdvSearch.advanced^1;this.toggleAdvConditions();};this.toggleAdvConditions=function(){if($('#search_type_deal').val()==2&&AdvSearch.advanced==1)
$('#advConditions').show();else
$('#advConditions').hide();}
this.toggle=function(){if(rtype!=this.rtype||$('#search_type_deal').val()!=this.dealtype||$('#search_house_realty_type').val()!=this.objtype)
{if(this.loading)
return;$('#advSearchBtn').hide();$('#advSearchBtnLoading').show();this.loading=true;this.rtype=rtype;this.dealtype=$('#search_type_deal').val();this.objtype=$('#search_house_realty_type').val();var __this=this;this.update(function(){__this.callback()},true);}
else
{this.callback();}}
this.update=function(callback,skipClear)
{this.setAdmMetroValues();var qs=this.prepareQueryString();$('.simpleSearch .submit').attr("disabled","disabled");$('#advSearchForm .submit input').attr("disabled","disabled");$('#advSearchFormContent').load('/search/advancedForm/'+qs,{},function(data){AdvSearch.queryOverride=$.query.load(qs);$('.simpleSearch .submit').removeAttr("disabled");$('#advSearchForm .submit input').removeAttr("disabled");if(callback)
callback();});$('.ac_results').remove();if(!skipClear)
$('#metro_map_wrapper').empty();}
this.updateSimple=function()
{$('#simpleFormContent').load('/search/simpleForm/'+AdvSearch.prepareQueryString(),{},function(data){SearchFormOnReady();$("#metro_select").text(getText());});AdvSearch.syncGeo();}
this.reset=function()
{var query='?rtype='+$('#rtype').val();$('#advSearchFormContent').load('/search/advancedForm/'+query,{},function(data){AdvSearch.queryOverride=$.query.load(query);$('#simpleFormContent').load('/search/simpleForm/'+query,{},function(data){SearchFormOnReady();$("#metro_select").text(getText());});});$('.ac_results').remove();$('#metro_map_wrapper').empty();}
this.updateFromSimple=function()
{if(AdvSearch.advanced==1)
this.update(this.toggleAdvConditions);}
this.clearFromTo=function(obj)
{if(obj.value=='от'||obj.value=='до')
{obj.value='';return true;}
return false;}
this.setAdmMetroValues=function()
{var metro_block=$('#metro_map');if(metro_block.length==0)
metro_block=$('#metro_stations_list');if(metro_block.length>0)
{var metro=$('.metroSt input:checkbox:checked',metro_block);var stations=new Array;for(var i=0;i<metro.length;i++)
{stations.push(metro[i].value);}
$('#metro_stn_concat').val(stations.join(','));}
var adm_block=$('#metro_map');if(adm_block.length==0)
adm_block=$('#districts_chbxs');if(adm_block.length>0)
{var admlist=$('.adm input:checkbox:checked',adm_block);var adms=new Array;for(var i=0;i<admlist.length;i++)
{adms.push(admlist[i].value);}
$('#okrug_concat').val(adms.join(','));adm_block=$('#districts_chbxs');if(adm_block.length>0)
{var districts=new Array;admlist=$('.adm input:checkbox',adm_block).not(':checked');for(var i=0;i<admlist.length;i++)
{var list=$('#districts_'+admlist[i].value);if(list.length)
{var dstr=$('input:checkbox:checked',list);for(var j=0;j<dstr.length;j++)
districts.push(dstr[j].value);}}
$('#districts_concat').val(districts.join(','));}}}
this.prepareQueryString=function(form)
{var fromto=$('#search_form .fromto');var restore=new Array();for(var i=0;i<fromto.length;i++)
{var oldval=fromto[i].value;if(this.clearFromTo(fromto[i]))
restore.push([fromto[i].id,oldval]);}
var a=$('#search_form').formToArray();var b=new Array();if(!form)
{var query=(AdvSearch.queryOverride!=undefined)?AdvSearch.queryOverride.copy():$.query.copy();var postponed=new Array();for(var i=0;i<a.length;i++)
{var name=a[i].name;if(name.search(/\[/)==-1)
{query.REMOVE(name);if(a[i].value)
query.SET(name,a[i].value);}
else
{query.REMOVE(name.slice(0,name.search(/\[/)));if(a[i].value)
postponed.push([name,a[i].value]);}}
if(postponed.length>0)
{for(var i=0;i<postponed.length;i++)
{query.SET(postponed[i][0],postponed[i][1])}}
var ret=query.toString();}
else
{for(var i=0;i<a.length;i++)
{if(a[i].value&&a[i].name!='rgn'&&a[i].name!='ctr')b.push(a[i]);}
var ret='?'+$.param(b);}
for(var i=0;i<restore.length;i++)
{$('#'+restore[i][0]).val(restore[i][1]);}
return ret.replace(/%2c/gi,',').replace(/%2b/gi,'+');}
this.loadMetroForm=function(type)
{this.setAdmMetroValues();var query=this.prepareQueryString();query+=(query?'':'?')+'&type='+type;$('#'+'metro_chbx_block').load('/search/metro/'+query);}
this.toggleMetroLine=function(id)
{$('#'+'metro_stations_'+id).slideToggle('normal');$('#'+'metro_line_div_'+id+' .fold').toggle();}
this.checkMetroLine=function(id)
{if($('#metro_stations_'+id+' input:checkbox').length==$('#metro_stations_'+id+' input:checkbox:checked').length)
{$('#metro_line_'+id).attr('checked','checked');}
else
{$('#metro_line_'+id).removeAttr('checked');}}
this.toggleDistrict=function(id)
{$('#'+'districts_'+id).slideToggle('normal');$('#'+'okrug_item_'+id+' .fold').toggle();}
this.setCheckboxes=function(check,block_id)
{if(check)
$('#'+block_id+' input:checkbox').attr('checked','checked');else
$('#'+block_id+' input:checkbox').removeAttr('checked');}
this.setMetro=function(check,block_id)
{this.setCheckboxes(check,block_id);$('#'+block_id+' input:checkbox').each(function(i){AdvSearch.syncMetro(this.checked,this.value);});$("#metro_select").text(getText());}
this.setAllMetro=function()
{selectItems('metro');}
this.clearMetro=function()
{this.setCheckboxes(false,'metro_chbx_block');clearItems('metro');}
this.setMetroStation=function(checked,id)
{this.syncMetro(checked,id);$("#metro_select").text(getText());}
this.syncMetro=function(checked,id,nosync)
{if(checked)
{if(!nosync)
addStation('',id,true);else
$('#metro_station_'+id).attr('checked','checked');}
else
{if(!nosync)
removeStation(id,true);else
$('#metro_station_'+id).removeAttr('checked');}}
this.checkOkrug=function(id)
{if($('#districts_'+id+' input:checkbox').length==$('#districts_'+id+' input:checkbox:checked').length)
{$('#okrug_'+id).attr('checked','checked');this.syncOkrug(true,id);}
else
{$('#okrug_'+id).removeAttr('checked');this.syncOkrug(false,id);}}
this.setOkrug=function(checked,id,nosync)
{this.setCheckboxes(checked,'#districts_'+id);this.syncOkrug(checked,id,nosync);}
this.syncOkrug=function(checked,id,nosync)
{if(checked)
{if(!nosync)
addAdm('',id,true);else
$('#okrug_'+id).attr('checked','checked');}
else
{if(!nosync)
removeAdm(id,true);else
$('#okrug_'+id).removeAttr('checked');}}
this.syncField=function(value,field)
{$('#'+field).val(value);}
this.syncGeo=function()
{if($('#ctr').length)
$('#cid').val($('#ctr').val());if($('#rgn').length)
$('#rid').val($('#rgn').val());}
this.submit=function()
{this.setAdmMetroValues();var query=this.prepareQueryString(true);if($('#ctr').val()&&$('#rgn').val()&&$('#gid').val()&&($('#ctr').val()!=cid||$('#rgn').val()!=rid))
query+='&rbcid='+$('#ctr').val()+'&rbrid='+$('#rgn').val()+'&rbgid='+$('#gid').val();var url=$('#search_form').attr('action')+query;window.location=url;return false;}}
var AdvSearch=new AdvSearchObj;new function(settings){var $separator=settings.separator||'&';var $spaces=settings.spaces===false?false:true;var $suffix=settings.suffix===false?'':'[]';var $prefix=settings.prefix===false?false:true;var $hash=$prefix?settings.hash===true?"#":"?":"";var $numbers=settings.numbers===false?false:true;jQuery.query=new function(){var is=function(o,t){return o!=undefined&&o!==null&&(!!t?o.constructor==t:true);};var parse=function(path){var m,rx=/\[([^[]*)\]/g,match=/^([^[]+?)(\[.*\])?$/.exec(path),base=match[1],tokens=[];while(m=rx.exec(match[2]))tokens.push(m[1]);return[base,tokens];};var set=function(target,tokens,value){var o,token=tokens.shift();if(typeof target!='object')target=null;if(token===""){if(!target)target=[];if(is(target,Array)){target.push(tokens.length==0?value:set(null,tokens.slice(0),value));}else if(is(target,Object)){var i=0;while(target[i++]!=null);target[--i]=tokens.length==0?value:set(target[i],tokens.slice(0),value);}else{target=[];target.push(tokens.length==0?value:set(null,tokens.slice(0),value));}}else if(token&&token.match(/^\s*[0-9]+\s*$/)){var index=parseInt(token,10);if(!target)target=[];target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value);}else if(token){var index=token.replace(/^\s*|\s*$/g,"");if(!target)target={};if(is(target,Array)){var temp={};for(var i=0;i<target.length;++i){temp[i]=target[i];}
target=temp;}
target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value);}else{return value;}
return target;};var queryObject=function(a){var self=this;self.keys={};if(a.queryObject){jQuery.each(a.get(),function(key,val){self.SET(key,val);});}else{jQuery.each(arguments,function(){var q=""+this;q=q.replace(/^[?#]/,'');q=q.replace(/[;&]$/,'');if($spaces)q=q.replace(/[+]/g,' ');jQuery.each(q.split(/[&;]/),function(){try{var key=decodeURIComponent(this.split('=')[0]||"");}
catch(e){var key="";}
try{var val=decodeURIComponent(this.split('=')[1]||"");}
catch(e){var val="";}
if(!key)return;if($numbers){var oldval=val;if(/^[+-]?[0-9]+\.[0-9]*$/.test(val))
val=parseFloat(val);else if(/^[+-]?[0-9]+$/.test(val))
val=parseInt(val,10);if((val+"")!=(oldval+"")){val=oldval;}}
val=(!val&&val!==0)?true:val;if(val!==false&&val!==true&&typeof val!='number')
val=val;self.SET(key,val);});});}
return self;};queryObject.prototype={queryObject:true,has:function(key,type){var value=this.get(key);return is(value,type);},GET:function(key){if(!is(key))return this.keys;var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];while(target!=null&&tokens.length!=0){target=target[tokens.shift()];}
return typeof target=='number'?target:target||"";},get:function(key){var target=this.GET(key);if(is(target,Object))
return jQuery.extend(true,{},target);else if(is(target,Array))
return target.slice(0);return target;},SET:function(key,val){var value=!is(val)?null:val;var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];this.keys[base]=set(target,tokens.slice(0),value);return this;},set:function(key,val){return this.copy().SET(key,val);},REMOVE:function(key){return this.SET(key,null).COMPACT();},remove:function(key){return this.copy().REMOVE(key);},EMPTY:function(){var self=this;jQuery.each(self.keys,function(key,value){delete self.keys[key];});return self;},load:function(url){var hash=url.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var search=url.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new queryObject(url.length==search.length?'':search,url.length==hash.length?'':hash);},empty:function(){return this.copy().EMPTY();},copy:function(){return new queryObject(this);},COMPACT:function(){function build(orig){var obj=typeof orig=="object"?is(orig,Array)?[]:{}:orig;if(typeof orig=='object'){function add(o,key,value){if(is(o,Array))
o.push(value);else
o[key]=value;}
jQuery.each(orig,function(key,value){if(!is(value))return true;add(obj,key,build(value));});}
return obj;}
this.keys=build(this.keys);return this;},compact:function(){return this.copy().COMPACT();},toString:function(){var i=0,queryString=[],chunks=[],self=this;var encode=function(str){str=str+"";if($spaces)str=str.replace(/ /g,"+");return encodeURIComponent(str);};var addFields=function(arr,key,value){if(!is(value)||value===false)return;var o=[encode(key)];if(value!==true){o.push("=");o.push(encode(value));}
arr.push(o.join(""));};var build=function(obj,base){var newKey=function(key){return!base||base==""?[key].join(""):[base,"[",key,"]"].join("");};jQuery.each(obj,function(key,value){if(typeof value=='object')
build(value,newKey(key));else
addFields(chunks,newKey(key),value);});};build(this.keys);if(chunks.length>0)queryString.push($hash);queryString.push(chunks.join($separator));return queryString.join("");}};return new queryObject(location.search,location.hash);};}(jQuery.query||{});;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this;}
if(typeof options=='function')
options={success:options};var url=$.trim(this.attr('action'));if(url){url=(url.match(/^([^#]+)/)||[])[1];}
url=url||window.location.href||'';options=$.extend({url:url,type:this.attr('method')||'GET'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this;}
if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this;}
var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])
a.push({name:n,value:options.data[n][k]});}
else
a.push({name:n,value:options.data[n]});}}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this;}
this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this;}
var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i].apply(options,[data,status,$form]);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;var multipart=false;if(options.iframe||found||multipart){if(options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return;}
var opts=$.extend({},$.ajaxSettings,options);var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" src="about:blank" />');var io=$io[0];$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src','about:blank');}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;return;}
if(xhr.aborted)
return;var cbInvoked=0;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){options.extraData=options.extraData||{};options.extraData[n]=sub.value;if(sub.type=="image"){options.extraData[name+'.x']=form.clk_x;options.extraData[name+'.y']=form.clk_y;}}}
setTimeout(function(){var t=$form.attr('target'),a=$form.attr('action');form.setAttribute('target',id);if(form.getAttribute('method')!='POST')
form.setAttribute('method','POST');if(form.getAttribute('action')!=opts.url)
form.setAttribute('action',opts.url);if(!options.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'});}
if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);var extraInputs=[];try{if(options.extraData)
for(var n in options.extraData)
extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0]);$io.appendTo('body');io.attachEvent?io.attachEvent('onload',cb):io.addEventListener('load',cb,false);form.submit();}
finally{form.setAttribute('action',a);t?form.setAttribute('target',t):$form.removeAttr('target');$(extraInputs).remove();}},10);var domCheckCount=50;function cb(){if(cbInvoked++)return;io.detachEvent?io.detachEvent('onload',cb):io.removeEventListener('load',cb,false);var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;var isXml=opts.dataType=='xml'||doc.XMLDocument||$.isXMLDoc(doc);log('isXml='+isXml);if(!isXml&&(doc.body==null||doc.body.innerHTML=='')){if(--domCheckCount){cbInvoked=0;setTimeout(cb,100);return;}
log('Could not access iframe DOM after 50 tries.');return;}
xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];xhr.responseText=ta?ta.value:xhr.responseText;}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){ok=false;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind('click.form-plugin',function(e){var form=this.form;form.clk=this;if(this.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$(this).offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-this.offsetLeft;form.clk_y=e.pageY-this.offsetTop;}}
setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind('submit.form-plugin');return this.each(function(){$(":submit,input:image",this).unbind('click.form-plugin');});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}
continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type=='image'){a.push({name:n,value:$input.val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v)
v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b;});};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false);}
this.selected=select;}});};function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log)
window.console.log('[jquery.form] '+Array.prototype.join.call(arguments,''));};})(jQuery);function subscriptionFieldFocus()
{if($('#subscr_email').val()=='E-mail')
$('#subscr_email').val('');$('#subscribePopupError').hide();$('#subscribePopup').show('fast');}
function hideSubscriptionPopup()
{if($('#subscr_email').val()=='')
$('#subscr_email').val('E-mail');$('#subscribePopup').hide('fast');}
function showSubscriptionError()
{$('#subscribePopup').hide();$('#subscribePopupError').show('fast');}
function showSubscribeOk(text)
{$('#subscribePopup').hide();$('#subscribePopupError').hide();$('#subscriptionOk').text(text);$('#subscriptionOk').show();}
function subscribe()
{var email=$('#subscr_email').val();var type=$('#subscr_type').val();var url='/personal/subscribe/'+type+'/';$.ajax({data:{email:email},success:function(data){if(data!='0')
showSubscribeOk(data);else
showSubscriptionError();},url:url});}
function subscribeOnComments()
{var email=$('#subscr_email').val();var article=$('#article_id').val();var url='/personal/subscribe/comments/';$.ajax({data:{email:email,article:article},success:function(data){if(data!='0')
showSubscribeOk(data);else
showSubscriptionError();},url:url});}