if(!FS.apps.main.building){FS.apps.main.building={}}FS.apps.main.building.FVBCookie=function(A){this._id=A;this._cookieName="fvb";this._cookiePrefix="fvb_"};FS.apps.main.building.FVBCookie.prototype.count=function(D){var B=FS.util.cookie.read(this._cookieName);var C=0;if(B!=null&&B!=""&&B){var A=$A(B.split(","));C=A.size()}return C};FS.apps.main.building.FVBCookie.prototype.exists=function(D){var B=FS.util.cookie.read(this._cookieName);var C=false;if(B){var A=$A(B.split(","));C=A.find(function(E){return((0+D)==(0+E))})}return C};FS.apps.main.building.FVBCookie.prototype.add=function(C){if(!this.exists(C)){var B=FS.util.cookie.read(this._cookieName);var A=B!=null&&B?",":"";B=B!=null?B:"";B+=A+C;FS.util.cookie.create(this._cookieName,B,3650);if($(this._cookiePrefix+C)){$(this._cookiePrefix+C).innerHTML=this.removeHTML(C)}this.drawTop()}};FS.apps.main.building.FVBCookie.prototype.remove=function(C){if(this.exists(C)){var B=FS.util.cookie.read(this._cookieName);var A=$A(B.split(","));A=A.without(C);B="";comma="";A.each(function(D){B+=comma+D;comma=","});FS.util.cookie.create(this._cookieName,B,3650);if($(this._cookiePrefix+C)){$(this._cookiePrefix+C).innerHTML=this.addHTML(C)}this.drawTop()}};FS.apps.main.building.FVBCookie.prototype.draw=function(A){if(this.exists(A)){$(this._cookiePrefix+A).innerHTML=this.removeHTML(A)}else{$(this._cookiePrefix+A).innerHTML=this.addHTML(A)}};FS.apps.main.building.FVBCookie.prototype.removeHTML=function(A){return'<img src="/images/stars/star.gif" title="удалить из избранного" onclick="favoriteItems.remove('+A+');"/>'};FS.apps.main.building.FVBCookie.prototype.addHTML=function(A){return'<img src="/images/stars/star-half.gif" title="добавить в избранное" onclick="favoriteItems.add('+A+');"/>'};FS.apps.main.building.FVBCookie.prototype.drawTop=function(){var A="";var B=this.count();if(this.count()>0){A='<img src="/images/stars/star.gif" title="'+B+' новостроек в избранном" style="margin-bottom:-5px;padding-right:5px;"/>'}else{A='<img src="/images/stars/star-half.gif" title="нет избранных новостроек" style="margin-bottom:-5px;padding-right:5px;"/>'}if($(this._id)){$(this._id).innerHTML=A}}
