(function($){$.fn.jqm=function(o){var p={overlay:50,overlayClass:'jqmOverlay',closeClass:'jqmClose',trigger:'.jqModal',ajax:F,ajaxText:'',target:F,modal:F,toTop:F,onShow:F,onHide:F,onLoad:F};return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};if(p.trigger)$(this).jqmAddTrigger(p.trigger);});};$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};$.jqm={hash:{},open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);if(c.modal){if(!A[0])L('bind');A.push(s);}
else if(c.overlay>0)h.w.jqmAddClose(o);else o=F;h.o=(o)?o.addClass(c.overlayClass).prependTo('#wrapper'):F;if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in{Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
if(c.ajax){var r=c.target||h.w,u=c.ajax,r=(typeof r=='string')?$(r,h.w):$(r),u=(u.substr(0,1)=='@')?$(t).attr(u.substring(1)):u;r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
else if(cc)h.w.jqmAddClose($(cc,h.w));if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);(c.onShow)?c.onShow(h):h.w.show();e(h);return F;},close:function(s){var h=H[s];if(!h.a)return F;h.a=F;if(A[0]){A.pop();if(!A[0])L('unbind');}
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();}return F;},params:{}};var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&/MSIE 6\.0/i.test(window.navigator.userAgent)&&!/MSIE 7\.0/i.test(window.navigator.userAgent)&&!/MSIE 8\.0/i.test(window.navigator.userAgent),F=false,i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i);f(h);},f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return!r;},hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function(){if(!this[c]){this[c]=[];$(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};})(jQuery);;(function($){$.fn.floatHeader=function(config){config=$.extend({fadeOut:250,faceIn:250,floatClass:'floatHeader'},config);if($.browser.msie&&typeof document.body.style.maxHeight==='undefined')return;return this.each(function(){var self=$(this);var table=self.clone();table.empty().removeAttr('id');self.floatBox=$('<div class="'+config.floatClass+'"style="display:none"></div>');self.floatBox.append(table);self.floatBoxVisible=false;self.IEWindowWidth=document.documentElement.clientWidth;self.IEWindowHeight=document.documentElement.clientHeight;createHeader(table,self,config);$(window).scroll(function(){var headerOutsideScreen=isHeaderOutsideScreen(self);if(self.floatBoxVisible&&!headerOutsideScreen){var offset=self.offset();self.floatBox.css('position','absolute');self.floatBox.css('top',offset.top);self.floatBox.css('left',offset.left);self.floatBoxVisible=false;if(config.cbFadeOut){config.cbFadeOut(self.floatBox)}else{setTimeout(function(){self.floatBox.hide();},0);}}else if(headerOutsideScreen){self.floatBoxVisible=true;if(config.cbFadeIn){config.cbFadeIn(self.floatBox)}else{setTimeout(function(){self.floatBox.show();},0);}}
if(self.floatBoxVisible){if($.browser.msie&&typeof document.body.style.maxHeight==='undefined'){self.floatBox.css({'position':'absolute','top':$(window).scrollTop()-265,'left':self.offset().left})}else{self.floatBox.css({'position':'fixed','top':0,'left':self.offset().left-$(window).scrollLeft()})}}});if($.browser.msie&&$.browser.version<=7){$(window).resize(function(){if(self.IEWindowWidth!=document.documentElement.clientWidth||self.IEWindowHeight!=document.documentElement.clientHeight){self.IEWindowWidth=document.documentElement.clientWidth;self.IEWindowHeight=document.documentElement.clientHeight;table.empty();createHeader(table,self,config)}})}else{$(window).resize(function(){table.empty();createHeader(table,self,config)})}
$(self).after(self.floatBox);if($.browser.safari){$(window).one('scroll',function(){table.empty();createHeader(table,self,config)})}})};function createHeader(target,template,config){target.width(template.outerWidth());if(template.children('thead').length===0){return}
var items=template.children('thead').eq(0).children();items.each(function(){var row=$(this);var floatRow=row.clone();floatRow.empty();row.children().each(function(){var cell=$(this);var floatCell=cell.clone();if($.browser.msie){floatCell.css('width',cell.outerWidth());floatCell.css('padding','0 0 0 0')}else{floatCell.css('width',cell.width())}
floatRow.append(floatCell)});target.append(floatRow)})}
function isHeaderOutsideScreen(element){var top=$(window).scrollTop();var y0=$(element).offset().top;return y0<=top&&top<=y0+$(element).height()}})(jQuery);;(function($){var opt;$.fn.jqprint=function(options){opt=$.extend({},$.fn.jqprint.defaults,options);var $element=(this instanceof jQuery)?this:$(this);if(opt.operaSupport&&$.browser.opera)
{var tab=window.open("","jqPrint-preview");tab.document.open();var doc=tab.document;}
else
{var $iframe=$("<iframe  />");if(!opt.debug){$iframe.css({position:"absolute",width:"0px",height:"0px",left:"-600px",top:"-600px"});}
$iframe.appendTo("body");var doc=$iframe[0].contentWindow.document;}
if(opt.importCSS)
{if($("link[media=print]").length>0)
{$("link[media=print]").each(function(){doc.write("<link type='text/css' rel='stylesheet' href='"+$(this).attr("href")+"' media='print' />");});}
else
{$("link").each(function(){doc.write("<link type='text/css' rel='stylesheet' href='"+$(this).attr("href")+"' />");});}}
if(opt.printContainer){doc.write($element.outer());}
else{$element.each(function(){doc.write($(this).html());});}
doc.close();(opt.operaSupport&&$.browser.opera?tab:$iframe[0].contentWindow).focus();setTimeout(function(){(opt.operaSupport&&$.browser.opera?tab:$iframe[0].contentWindow).print();if(tab){tab.close();}},1000);}
$.fn.jqprint.defaults={debug:false,importCSS:true,printContainer:true,operaSupport:true};jQuery.fn.outer=function(){return $($('<div></div>').html(this.clone())).html();}})(jQuery);;function MarkerClusterer(map,opt_markers,opt_opts){var clusters_=[];var map_=map;var maxZoom_=null;var me_=this;var gridSize_=60;var sizes=[53,56,66,78,90];var styles_=[];var leftMarkers_=[];var mcfn_=null;var i=0;for(i=1;i<=5;++i){styles_.push({'url':"http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/images/m"+i+".png",'height':sizes[i-1],'width':sizes[i-1]});}
if(typeof opt_opts==="object"&&opt_opts!==null){if(typeof opt_opts.gridSize==="number"&&opt_opts.gridSize>0){gridSize_=opt_opts.gridSize;}
if(typeof opt_opts.maxZoom==="number"){maxZoom_=opt_opts.maxZoom;}
if(typeof opt_opts.styles==="object"&&opt_opts.styles!==null&&opt_opts.styles.length!==0){styles_=opt_opts.styles;}}
function addLeftMarkers_(){if(leftMarkers_.length===0){return;}
var leftMarkers=[];for(i=0;i<leftMarkers_.length;++i){me_.addMarker(leftMarkers_[i],true,null,null,true);}
leftMarkers_=leftMarkers;}
this.getStyles_=function(){return styles_;};this.clearMarkers=function(){for(var i=0;i<clusters_.length;++i){if(typeof clusters_[i]!=="undefined"&&clusters_[i]!==null){clusters_[i].clearMarkers();}}
clusters_=[];leftMarkers_=[];};function isMarkerInViewport_(marker){return map_.getBounds().containsLatLng(marker.getLatLng());}
function reAddMarkers_(markers){var len=markers.length;var clusters=[];for(var i=len-1;i>=0;--i){me_.addMarker(markers[i].marker,true,markers[i].isAdded,clusters,true);}
addLeftMarkers_();}
this.addMarker=function(marker,opt_isNodraw,opt_isAdded,opt_clusters,opt_isNoCheck){if(opt_isNoCheck!==true){if(!isMarkerInViewport_(marker)){leftMarkers_.push(marker);return;}}
var isAdded=opt_isAdded;var clusters=opt_clusters;var pos=map_.fromLatLngToDivPixel(marker.getLatLng());if(typeof isAdded!=="boolean"){isAdded=false;}
if(typeof clusters!=="object"||clusters===null){clusters=clusters_;}
var length=clusters.length;var cluster=null;for(var i=length-1;i>=0;i--){cluster=clusters[i];var center=cluster.getCenter();if(center===null){continue;}
center=map_.fromLatLngToDivPixel(center);if(pos.x>=center.x-gridSize_&&pos.x<=center.x+gridSize_&&pos.y>=center.y-gridSize_&&pos.y<=center.y+gridSize_){cluster.addMarker({'isAdded':isAdded,'marker':marker});if(!opt_isNodraw){cluster.redraw_();}
return;}}
cluster=new Cluster(this,map);cluster.addMarker({'isAdded':isAdded,'marker':marker});if(!opt_isNodraw){cluster.redraw_();}
clusters.push(cluster);if(clusters!==clusters_){clusters_.push(cluster);}};this.removeMarker=function(marker){for(var i=0;i<clusters_.length;++i){if(clusters_[i].remove(marker)){clusters_[i].redraw_();return;}}};this.redraw_=function(){var clusters=this.getClustersInViewport_();for(var i=0;i<clusters.length;++i){clusters[i].redraw_(true);}};this.getClustersInViewport_=function(){var clusters=[];var curBounds=map_.getBounds();for(var i=0;i<clusters_.length;i++){if(clusters_[i].isInBounds(curBounds)){clusters.push(clusters_[i]);}}
return clusters;};this.getMaxZoom_=function(){return maxZoom_;};this.getMap_=function(){return map_;};this.getGridSize_=function(){return gridSize_;};this.getTotalMarkers=function(){var result=0;for(var i=0;i<clusters_.length;++i){result+=clusters_[i].getTotalMarkers();}
return result;};this.getTotalClusters=function(){return clusters_.length;};this.resetViewport=function(){var clusters=this.getClustersInViewport_();var tmpMarkers=[];var removed=0;for(var i=0;i<clusters.length;++i){var cluster=clusters[i];var oldZoom=cluster.getCurrentZoom();if(oldZoom===null){continue;}
var curZoom=map_.getZoom();if(curZoom!==oldZoom){var mks=cluster.getMarkers();for(var j=0;j<mks.length;++j){var newMarker={'isAdded':false,'marker':mks[j].marker};tmpMarkers.push(newMarker);}
cluster.clearMarkers();removed++;for(j=0;j<clusters_.length;++j){if(cluster===clusters_[j]){clusters_.splice(j,1);}}}}
reAddMarkers_(tmpMarkers);this.redraw_();};this.addMarkers=function(markers){for(var i=0;i<markers.length;++i){this.addMarker(markers[i],true);}
this.redraw_();};if(typeof opt_markers==="object"&&opt_markers!==null){this.addMarkers(opt_markers);}
mcfn_=GEvent.addListener(map_,"moveend",function(){me_.resetViewport();});}
function Cluster(markerClusterer){var center_=null;var markers_=[];var markerClusterer_=markerClusterer;var map_=markerClusterer.getMap_();var clusterMarker_=null;var zoom_=map_.getZoom();this.getMarkers=function(){return markers_;};this.isInBounds=function(bounds){if(center_===null){return false;}
if(!bounds){bounds=map_.getBounds();}
var sw=map_.fromLatLngToDivPixel(bounds.getSouthWest());var ne=map_.fromLatLngToDivPixel(bounds.getNorthEast());var centerxy=map_.fromLatLngToDivPixel(center_);var inViewport=true;var gridSize=markerClusterer.getGridSize_();if(zoom_!==map_.getZoom()){var dl=map_.getZoom()-zoom_;gridSize=Math.pow(2,dl)*gridSize;}
if(ne.x!==sw.x&&(centerxy.x+gridSize<sw.x||centerxy.x-gridSize>ne.x)){inViewport=false;}
if(inViewport&&(centerxy.y+gridSize<ne.y||centerxy.y-gridSize>sw.y)){inViewport=false;}
return inViewport;};this.getCenter=function(){return center_;};this.addMarker=function(marker){if(center_===null){center_=marker.marker.getLatLng();}
markers_.push(marker);};this.removeMarker=function(marker){for(var i=0;i<markers_.length;++i){if(marker===markers_[i].marker){if(markers_[i].isAdded){map_.removeOverlay(markers_[i].marker);}
markers_.splice(i,1);return true;}}
return false;};this.getCurrentZoom=function(){return zoom_;};this.redraw_=function(isForce){if(!isForce&&!this.isInBounds()){return;}
zoom_=map_.getZoom();var i=0;var mz=markerClusterer.getMaxZoom_();if(mz===null){mz=map_.getCurrentMapType().getMaximumResolution();}
if(zoom_>=mz||this.getTotalMarkers()===1){for(i=0;i<markers_.length;++i){if(markers_[i].isAdded){if(markers_[i].marker.isHidden()){markers_[i].marker.show();}}else{map_.addOverlay(markers_[i].marker);markers_[i].isAdded=true;}}
if(clusterMarker_!==null){clusterMarker_.hide();}}else{for(i=0;i<markers_.length;++i){if(markers_[i].isAdded&&(!markers_[i].marker.isHidden())){markers_[i].marker.hide();}}
if(clusterMarker_===null){clusterMarker_=new ClusterMarker_(center_,this.getTotalMarkers(),markerClusterer_.getStyles_(),markerClusterer_.getGridSize_());map_.addOverlay(clusterMarker_);}else{if(clusterMarker_.isHidden()){clusterMarker_.show();}
clusterMarker_.redraw(true);}}};this.clearMarkers=function(){if(clusterMarker_!==null){map_.removeOverlay(clusterMarker_);}
for(var i=0;i<markers_.length;++i){if(markers_[i].isAdded){map_.removeOverlay(markers_[i].marker);}}
markers_=[];};this.getTotalMarkers=function(){return markers_.length;};}
function ClusterMarker_(latlng,count,styles,padding){var index=0;var dv=count;while(dv!==0){dv=parseInt(dv/10,10);index++;}
if(styles.length<index){index=styles.length;}
this.url_=styles[index-1].url;this.height_=styles[index-1].height;this.width_=styles[index-1].width;this.textColor_=styles[index-1].opt_textColor;this.anchor_=styles[index-1].opt_anchor;this.latlng_=latlng;this.index_=index;this.styles_=styles;this.text_=count;this.padding_=padding;}
if(typeof GOverlay!='undefined')ClusterMarker_.prototype=new GOverlay();ClusterMarker_.prototype.initialize=function(map){this.map_=map;var div=document.createElement("div");var latlng=this.latlng_;var pos=map.fromLatLngToDivPixel(latlng);pos.x-=parseInt(this.width_/2,10);pos.y-=parseInt(this.height_/2,10);var mstyle="";if(document.all){mstyle='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+this.url_+'");';}else{mstyle="background:url("+this.url_+");";}
if(typeof this.anchor_==="object"){if(typeof this.anchor_[0]==="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_){mstyle+='height:'+(this.height_-this.anchor_[0])+'px;padding-top:'+this.anchor_[0]+'px;';}else{mstyle+='height:'+this.height_+'px;line-height:'+this.height_+'px;';}
if(typeof this.anchor_[1]==="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_){mstyle+='width:'+(this.width_-this.anchor_[1])+'px;padding-left:'+this.anchor_[1]+'px;';}else{mstyle+='width:'+this.width_+'px;text-align:center;';}}else{mstyle+='height:'+this.height_+'px;line-height:'+this.height_+'px;';mstyle+='width:'+this.width_+'px;text-align:center;';}
var txtColor=this.textColor_?this.textColor_:'black';div.style.cssText=mstyle+'cursor:pointer;top:'+pos.y+"px;left:"+
pos.x+"px;color:"+txtColor+";position:absolute;font-size:11px;"+'font-family:Arial,sans-serif;font-weight:bold';div.innerHTML=this.text_;map.getPane(G_MAP_MARKER_PANE).appendChild(div);var padding=this.padding_;GEvent.addDomListener(div,"click",function(){var pos=map.fromLatLngToDivPixel(latlng);var sw=new GPoint(pos.x-padding,pos.y+padding);sw=map.fromDivPixelToLatLng(sw);var ne=new GPoint(pos.x+padding,pos.y-padding);ne=map.fromDivPixelToLatLng(ne);var zoom=map.getBoundsZoomLevel(new GLatLngBounds(sw,ne),map.getSize());map.setCenter(latlng,zoom);});this.div_=div;};ClusterMarker_.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_);};ClusterMarker_.prototype.copy=function(){return new ClusterMarker_(this.latlng_,this.index_,this.text_,this.styles_,this.padding_);};ClusterMarker_.prototype.redraw=function(force){if(!force){return;}
var pos=this.map_.fromLatLngToDivPixel(this.latlng_);pos.x-=parseInt(this.width_/2,10);pos.y-=parseInt(this.height_/2,10);this.div_.style.top=pos.y+"px";this.div_.style.left=pos.x+"px";};ClusterMarker_.prototype.hide=function(){this.div_.style.display="none";};ClusterMarker_.prototype.show=function(){this.div_.style.display="";};ClusterMarker_.prototype.isHidden=function(){return this.div_.style.display==="none";};;function Map(elid,points,engine){this.elid=elid;this.gmap_el=document.getElementById(elid);this.engine=(engine!=null)?engine:'google';this.points=points;this.map_zoom=0;this.map_center;this.min_zoom=10;this.max_zoom=16;this.minLat;this.minLon;this.maxLat;this.maxLon;this.points_on_map=0;this.map;this.marker_cluster;this.dirty=true;}
Map.prototype.show=function(){if(this.map){this.map.checkResize();}
if(GBrowserIsCompatible()&&this.dirty){if(this.gmap_el.innerHTML==''){this.init(true);}else{this.init(false);}}
this.gmap_el.className='';}
Map.prototype.hide=function(){this.gmap_el.className='hidden';}
Map.prototype.init=function(start){if(start){var first_step=0;for(i in this.points){if(this.points[i].GMapsTargetLat&&this.points[i].GMapsTargetLng&&!this.points[i].hidden){var lat=Number(this.points[i].GMapsTargetLat);var lon=Number(this.points[i].GMapsTargetLng);if(first_step==0){first_step=i;this.minLat=lat;this.minLon=lon;this.maxLat=lat;this.maxLon=lon;}else{this.minLat=(lat>this.minLat)?lat:this.minLat;this.minLon=(lon<this.minLon)?lon:this.minLon;this.maxLat=(lat<this.maxLat)?lat:this.maxLat;this.maxLon=(lon>this.maxLon)?lon:this.maxLon;}
this.points_on_map++;}}
this.minLat+=0.004;this.minLon-=0.008;this.maxLat-=0.004;this.maxLon+=0.008;this.map=new GMap2(this.gmap_el);this.map.setUIToDefault();if(this.points_on_map>1){var bounds=new GLatLngBounds();bounds.extend(new GLatLng(this.minLat,this.minLon));bounds.extend(new GLatLng(this.maxLat,this.maxLon));var zoom=this.map.getBoundsZoomLevel(bounds);zoom=(zoom<this.min_zoom)?this.min_zoom:(zoom>this.max_zoom)?this.max_zoom:zoom;this.map_zoom=zoom;this.map_center=bounds.getCenter();}
else if(this.points_on_map==1){this.map_zoom=this.max_zoom;this.map_center=new GLatLng(Number(this.points[first_step].GMapsTargetLat),Number(this.points[first_step].GMapsTargetLng));}
this.centerMap();this.addPoints();$(window).unload(function(){GUnload();});}
else{this.updatePoints();}
this.dirty=false;}
Map.prototype.centerMap=function(){this.map.setCenter(this.map_center,this.map_zoom);}
Map.prototype.createMarker=function(lat,lng,HTML){var icon=new GIcon(G_DEFAULT_ICON);icon.image=calc_url+"/i/marker.png";icon.printImage=calc_url+"/i/markerPrint.gif";icon.shadow=calc_url+"/i/marker-shadow.png";icon.printShadow=calc_url+"/i/shadowPrint.gif";icon.iconSize=new GSize(23,39);icon.shadowSize=new GSize(43,39);icon.iconAnchor=new GPoint(11,38);var marker=new GMarker(new GLatLng(lat,lng),icon);if(HTML!=''){GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(HTML);});}
return marker;}
Map.prototype.addPoints=function(){var gpoints=[];for(i in this.points){if(this.points[i].GMapsTargetLat&&this.points[i].GMapsTargetLng&&!this.points[i].hidden){gpoints.push(this.createMarker(Number(this.points[i].GMapsTargetLat),Number(this.points[i].GMapsTargetLng),'<div style="margin-top:-0.3em"><strong><a onclick="point_click_on_map('+this.points[i].Bank_ID+');return false" href="#point-info" rel="'+this.points[i].Bank_ID+'" class="map-point-trigger">'+this.points[i].Address+'</a></strong><div class="note">'+this.points[i].Name+'</div><div>'+this.points[i].Worktime.replace(/closed/i,'выходной')+'</div></div>'));}}
var mcStyles=[{url:calc_url+'/i/marker.png',height:39,width:23,opt_anchor:[6,0],opt_textColor:'#ffffff'}];var mcOptions={gridSize:30,maxZoom:13,styles:mcStyles};this.marker_cluster=new MarkerClusterer(this.map,gpoints,mcOptions);}
Map.prototype.updatePoints=function(){var gpoints=[];for(i in this.points){if(this.points[i].GMapsTargetLat&&this.points[i].GMapsTargetLng&&!this.points[i].hidden){gpoints.push(this.createMarker(Number(this.points[i].GMapsTargetLat),Number(this.points[i].GMapsTargetLng),'<div style="margin-top:-0.3em"><strong><a onclick="point_click_on_map('+this.points[i].Bank_ID+');return false" href="#point-info" rel="'+this.points[i].Bank_ID+'" class="map-point-trigger">'+this.points[i].Address+'</a></strong><div class="note">'+this.points[i].Name+'</div><div>'+this.points[i].Worktime.replace(/closed/i,'выходной')+'</div></div>'));}}
this.marker_cluster.clearMarkers();this.marker_cluster.addMarkers(gpoints);};var comission_timer=60,comission_timer_id,baloon;if($('#calc-submit-summ').length){calc_update_summ_button();$('#calc-block .content').css('min-height',$('#filter-block').height()-4);var calc_block=$('#calc-block');var calc_top=calc_block.offset().top;if(calc_top<0)calc_top=180;var win_block=$(window);var win_top=win_block.scrollTop();if(win_top>calc_top){calc_block.animate({'top':win_top+20});}
$(window).scroll(function(){win_top=win_block.scrollTop();if((win_top>calc_top&&win_top>180)||win_top==0){win_top=win_top?win_top+20:calc_top;if(this.timer){clearTimeout(this.timer);}
this.timer=setTimeout(function(){if(win_top>180){calc_block.animate({'top':win_top});}else{calc_block.animate({'top':calc_top});}},300);}});}
$('#calc-submit-summ').click(function(){var sender=getCookie('calc_1');var receiver=getCookie('calc_2');var calc_summ=$('#calc-summ-value');$('#comission-error').remove();calc_summ.removeClass('hidden').html('<span class="spinner">'+_t['JS_LOADING']+'</span>');$('#calc-submit-summ').attr('disabled','disabled');$.ajax({url:'ajax_load',data:'func=comission&sender='+sender+'&receiver='+receiver+'&currency='+$('#field-calc-currency').val()+'&summ='+$('#field-calc-summ').val(),dataType:'json',timeout:30000,success:function(data){data=new String(data);if(data.indexOf('Error: too many requests')!=-1){calc_summ.html(_t['CALC_QUERY_LIMIT']);$('.calc-submit-summ-wrapper').after('<p id="comission-error">'+_t['CALC_QUERY_LIMIT_1']+' <strong><span id="timer-comission">'+comission_timer+'</span> '+_t['CALC_QUERY_LIMIT_2']+'</p>');comission_timer_id=setInterval(function(){update_comission_timer();},1000);}
else if(data!='0'){calc_summ.html('= '+data);}
else{calc_summ.html('= '+_t['CALC_QUERY_UNKNOWN']);$('.calc-submit-summ-wrapper').after('<p id="comission-error">'+_t['CALC_QUERY_UNKNOWN_DESC']+'</p>');}},error:function(XMLHttpRequest,textStatus,errorThrown){calc_summ.html(_t['ERROR']);$('.calc-submit-summ-wrapper').after('<p id="comission-error">'+_t['CALC_QUERY_ERROR']+'</p>');$('#calc-submit-summ').attr('disabled',false);}});return false;});$('#field-calc-summ').keyup(function(){if(this.timer){clearTimeout(this.timer);}
this.timer=setTimeout(function(){calc_update_summ_button();$('#calc-summ-value').html('');},300);});$('#field-calc-currency').change(function(){calc_update_summ_button();$('#calc-summ-value').html('');});function update_comission_timer(){$('#timer-comission').html(comission_timer--);if(comission_timer==0){clearInterval(comission_timer_id);$('#calc-submit-summ').attr('disabled',false);$('#comission-error').remove();$('#calc-summ-value').html('');comission_timer=60;}}
function calc_trigger_click(target){if(baloon==undefined){$('body').append('<div id="calc-baloon" style="display:none"></div>');baloon=$('#calc-baloon');}else{baloon.hide();}
if(!target.href){var point=(target.className=='i-send')?1:2;var point_id=target.parentNode.parentNode.getAttribute('id').replace('row-','');var point_info=points[point_id];calc_choose_point(point_info,point);return false;}
var point_id=target.href.split('/');point_id=point_id.slice(-1);var point_info=points[point_id];var position=$(target).offset();position.top+=5;position.left+=5;var bank_name=point_info.Name;var send_html=(point_info.canSendTransfers=='True')?'<a id="trigger-send" href="#"><span class="icon"></span>'+_t['JS_CALC_BALOON_FROM']+'</a>':'';var receive_html=(point_info.canAcceptTransfers=='True')?'<a id="trigger-receive" href="#"><span class="icon"></span>'+_t['JS_CALC_BALOON_TO']+'</a>':'';baloon.css({'top':position.top+'px','left':position.left+'px'}).html('<div><p>'+_t['JS_CALC_BALOON']+':</p><p>'+send_html+' '+receive_html+'</p></div><span id="baloon-close">'+_t['CLOSE_LINK']+'</span>');if($.browser.msie){baloon.show();}else{baloon.fadeIn();}
$('#baloon-close',baloon).click(function(){baloon.hide();});$('#trigger-send').click(function(){calc_choose_point(point_info,1);return false;});$('#trigger-receive').click(function(){calc_choose_point(point_info,2);return false;});}
function calc_choose_point(point_info,point){$('#calc-summ-value').html('');var el_id=(point==1)?'#point-out-element':'#point-in-element';var el_text=(point==1)?_t['LIST_TABLE_SEND_DESC']:_t['LIST_TABLE_RECEIVE_DESC'];$('#calc-points').removeClass('hidden');$(el_id).hide().attr('rel',point_info.Country_ID).html('<span class="icon">&nbsp;</span><h3>'+el_text+'</h3><p class="addr">'+point_info.Address+'</p><p class="note">'+point_info.Name+'</p><a href="'+calc_url+lang_prefix+'/calc/'+point_info.Bank_ID+'?del='+point+'" title="'+_t['REMOVE_LINK']+'" class="del-trigger">'+_t['REMOVE_LINK']+'</a>').removeClass('empty').fadeIn('slow');$('.calc-intro-text').addClass('hidden');setTimeout(function(){calc_update_summ_button();setCookie('calc_'+point,point_info.Bank_ID,null,calc_url+lang_prefix);baloon.hide();},0);}
function calc_update_summ_button(){var field_summ=$('#field-calc-summ').val();var disabled;var empty_points=$('#calc-points .empty').length;if(empty_points){$('#calc-summ-form').addClass('hidden');}else{$('#calc-summ-form').removeClass('hidden');}
if(empty_points||field_summ==''||field_summ<=0){$('#calc-submit-summ').attr('disabled','disabled');disabled=true;}else{$('#calc-submit-summ').attr('disabled',false);disabled=false;}
if(!empty_points){$.ajax({url:'ajax_load',data:'func=correct_currency&country1='+$('#point-out-element').attr('rel')+'&country2='+$('#point-in-element').attr('rel'),dataType:'json',timeout:5000,success:function(data){$('#field-calc-currency option').attr('disabled','disabled');var l=data.length;while(l--){$('#field-calc-currency option[value='+data[l]+']').attr('disabled',false);}
if($('#field-calc-currency option:selected').is(':disabled')){$('#field-calc-currency option:not(:disabled):first').attr('selected','selected');}},error:function(XMLHttpRequest,textStatus,errorThrown){$('#field-calc-currency option').attr('disabled',false);}});}else{$('#field-calc-currency option').attr('disabled',false);}}
$('#calc-points .del-trigger').live('click',function(){var parent_li=$(this).parent('li');parent_li.removeAttr('rel');var block_id=(parent_li.attr('id')=='point-out-element')?'calc_1':'calc_2';if(block_id=='calc_1'){var block_text=_t['CALC_SELECT_SEND'];}else{var block_text=_t['CALC_SELECT_RECEIVE'];}
parent_li.html(block_text).addClass('empty');setCookie(block_id,'',0,calc_url+lang_prefix);$('#calc-submit-summ').attr('disabled','disabled');$('#calc-summ-value').html('');calc_update_summ_button();return false;});;var list_map,points_cache,points_table,trigger_list,trigger_map;jQuery.extend(jQuery.expr[':'],{inContains:function(a,b,m){return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;}});$('#point-list-table').click(function(e){e=e||window.event();var target=e.target||e.srcElement;var target_class=target.className;delete e;if(target_class=='point-title'){$('#point-placeholder').jqm({ajax:target.getAttribute('rel'),target:$('#point-placeholder .content'),ajaxText:'<div class="spinner">'+_t['JS_LOADING']+'</div>'}).jqmShow();return false;}else if((target_class=='calc-trigger'||target_class=='i-send'||target_class=='i-accept')&&calc_trigger_click){calc_trigger_click(target);return false;}});$(function(){if(!points_table)points_table=document.getElementById('point-list-table');if($('#gmap').length){list_map=new Map('gmap',points);show_map_trigger();}
if(points_table&&document.location.hash!=''){js_filter_table(true);}
if($('#metro_list').length){show_metro_trigger();}
if($('#region-trigger').length&&!$('#region-placeholder').length){$('#wrapper').after('<div class="jqmWindow" id="region-placeholder"><div class="content"></div><span class="jqmClose">'+_t['CLOSE_LINK']+'</span><!--[if lte IE 6.5]><iframe class="ie6-iframe"></iframe><![endif]--></div>');$('#region-placeholder').jqm({ajax:'@rel',target:$('#region-placeholder .content'),trigger:$('#region-trigger'),ajaxText:'<div class="region-loader spinner">'+_t['JS_LOADING']+'</div>',onLoad:region_loaded_callback});}
$('.toggle-hidden').click(function(){$('#'+$(this).attr('rel')).slideToggle();return false;});$('#address-field').keyup(function(){if($(this).val().length>2){$('#table-overlay').removeClass('hidden');}
if(this.timer){clearTimeout(this.timer);}
this.timer=setTimeout(function(){js_filter_table();},800);});$('#check-unistream').add('#check-payments').add('#check-credits').add('#check-daily').add('#check-hourly').click(function(){if(typeof document.body.style.maxHeight==='undefined'){$('#table-overlay').removeClass('hidden');}
setTimeout(function(){$('#address-field').val('');js_filter_table();},0);});if(points_table){$('#point-list-table').floatHeader({fadeOut:0,faceIn:0});}
$('#wrapper').after('<div class="jqmWindow" id="help-placeholder"><div class="content"></div><span class="jqmClose">'+_t['CLOSE_LINK']+'</span><!--[if lte IE 6.5]><iframe class="ie6-iframe"></iframe><![endif]--></div>');$('#help-placeholder').jqm({ajax:'@rel',target:$('#help-placeholder .content'),trigger:$('#help-icon-trigger'),ajaxText:'<div class="spinner">'+_t['JS_LOADING']+'</div>',onLoad:region_loaded_callback});$('#print-list-icon').click(function(){window.print();return false;});});var loadInIframeModal=function(hash){var $trigger=$(hash.t);var $modal=$(hash.w);var myUrl='/geo/status-frame';var $modalContent=$("iframe",$modal);$modalContent.html('').attr('src',myUrl);hash.w.show();}
$(window).load(function(){if(!getCookie('gzip_support')){setTimeout(function(){$('body').append('<iframe src="'+calc_url+lang_prefix+'/gzip_test" style="display:none"></iframe>');},100);}
setCookie('test',1,1,'/');if(!getCookie('test')&&$('#filter-block').length){$('#filter-block').after('<p style="background:#FFFF69;border:1px solid #ccc;padding:7px">'+t['JS_COOKIE_WARINIG']+'</p><br />');}
setCookie('test',0,0,'/');});function region_loaded_callback(hash){$('#country_list').change(function(){$('#country_list').attr('disabled','disabled').addClass('disabled');if(!$('#city-loader').length){$('#country_list').after('<p id="city-loader" class="spinner city-loader">'+_t['JS_LOADING']+'</p>');}
$('#submit-city').attr('disabled','disabled');$('#city_list').html('<option disabled="disabled">'+_t['JS_LOADING']+'</option>');var country_id=$(this).val();$.ajax({url:calc_url+lang_prefix+'/ajax_load',data:'func=city_list&country='+country_id,dataType:'json',timeout:30000,success:function(data){var opts='';var j=0,item;while(item=data[j++]){opts+='<option value="'+item.key+'">'+item.value+'</option>';}
$('#city_list').empty().html(opts);delete opts;$('#country_list').removeAttr('disabled').removeClass('disabled');$('#city-loader').remove();},error:function(XMLHttpRequest,textStatus,errorThrown){$('#country_list').removeAttr('disabled').removeClass('disabled');$('#city-loader').remove();$('#city_list').html('<option disabled="disabled">'+t['JS_ERROR_LOADING_DESC']+'</option><option disabled="disabled">'+t['JS_ERROR_LOADING_DESC']+'</option>');}});});$('#city_list').click(function(){$('#submit-city').attr('disabled',false);});if($('#region-trigger').length){$('#city_list').dblclick(function(){$('#submit-city').attr('disabled','disabled');$('#region-select-form').submit();})
$('#submit-city').click(function(){$(this).attr('disabled','disabled');$('#region-select-form').submit();});}
$('#submit-city').parent().removeClass('hidden');}
function show_map_trigger(){if(!trigger_list)trigger_list=document.getElementById('list-trigger');if(!trigger_map)trigger_map=document.getElementById('map-trigger');var map_spinner=$('#map-loading');map_spinner.removeAttr('style');$('#list-trigger:not(.active) .trigger').live('click',function(){map_spinner.removeClass('hidden');setTimeout(function(){points_table.style.display='block';$('#point-list-table').floatHeader({fadeOut:0,faceIn:0});map_spinner.addClass('hidden');},0);list_map.hide();trigger_list.className='active';trigger_map.className='';});$('#map-trigger:not(.active.disabled) .trigger').live('click',function(){map_spinner.removeClass('hidden');points_table.style.display='none';trigger_map.className='active';trigger_list.className='';setTimeout(function(){list_map.show();map_spinner.addClass('hidden');$('div.floatHeader').remove();},0);});$('#map-trigger.disabled').live('click',function(){return false;});}
function show_metro_trigger(){if($('#metro_list').length){$('#metro_list').clone().attr('id','metro_list_popup').insertBefore('#metro-selected-list-popup');$('#metro-map-block').jqm({trigger:$('#metro-trigger .trigger'),onHide:metro_close_callback}).append('<span class="jqmClose">'+_t['CLOSE_LINK']+'</span>');$('#metro-panel .submit-button').click(function(){return false;});$('#metro-layer .metro-station.active').click(function(){update_selected_metro($(this));});$('#metro_list_popup').change(function(){if($(this).val()!=''){update_selected_metro($(this));}});if(document.location.hash!=''){update_selected_metro();}}}
function update_selected_metro(point){var metro_arr=[]
if($('#metro_list2').val()!=''){metro_arr=$('#metro_list2').val().split(',');}
for(metro in metro_arr){if(metro_arr[metro]==''){metro_arr.splice(metro,1);}}
if(point){point_id=(point.attr('rel')!=undefined)?point.attr('rel'):point.val();if(in_array(point_id,metro_arr)){for(metro in metro_arr){if(metro_arr[metro]==point_id){metro_arr.splice(metro,1);}}}else{metro_arr=metro_arr.concat(point_id);}}
$('#metro_list2').val(metro_arr.join(','));$('#metro-layer .metro-station.selected').removeClass('selected');$('#metro-selected-list-popup, #metro-trigger-list').html('');if(metro_arr.length>0){for(metro in metro_arr){var station_point=$('#metro-layer .metro-station[rel="'+metro_arr[metro]+'"]').addClass('selected');$('#metro-selected-list-popup, #metro-trigger-list').append('<div class="metro-icon"><span>'+station_point.slice(0,1).text()+'</span> <span title="'+_t['JS_REMOVE_STATION']+'" class="remove" rel="'+metro_arr[metro]+'">'+_t['REMOVE_LINK']+'</span></div> ');$('.metro-icon span.remove').click(function(){update_selected_metro($('#metro-layer .metro-station[rel="'+$(this).attr('rel')+'"]'));js_filter_table();});}}}
function metro_close_callback(hash){hash.w.hide();hash.o.remove();$('#address-field').val('');js_filter_table();}
function point_click_on_map(pid){$('#point-placeholder').jqm({trigger:false,target:$('#point-placeholder .content'),ajax:$('#row-'+pid+' .point-title').attr('rel'),ajaxText:'<div class="spinner">'+_t['JS_LOADING']+'</div>'}).jqmShow();}
function js_filter_table(init){var doc=document;var loc=doc.location.hash;if(init&&loc!=''){var hash=loc.substr(1).split('&');for(i in hash){var variable=hash[i].split('=');switch(variable[0]){case'pmetro':if(variable[1]!=''){$('#metro_list2').val(unescape(variable[1]));}
break;case'paddress':if(variable[1]!=''){$('#address-field').val(unescape(variable[1]));}
break;case'punistream':$('#check-unistream').attr('checked','checked');break;case'ppayments':$('#check-payments').attr('checked','checked');break;case'pcredits':$('#check-credits').attr('checked','checked');break;case'pdaily':$('#check-daily').attr('checked','checked');break;case'phourly':$('#check-hourly').attr('checked','checked');break;}}}
var addr_field=$('#address-field').val();if(addr_field!=''&&addr_field.length>2){var addr_str=new RegExp(addr_field.toUpperCase());}
var metro_arr=[];var metro_field=$('#metro_list2').val();if(metro_field&&metro_field!=''){metro_arr=metro_field.split(',');}
var check_unistream=$('#check-unistream').is(':checked');var check_payments=$('#check-payments').is(':checked');var check_credits=$('#check-credits').is(':checked');var check_daily=$('#check-daily').is(':checked');var check_hourly=$('#check-hourly').is(':checked');var points_list=points;var points_arr=[];var hidden_obj={};var hidden_count=0;var withMap=0;for(point in points_list){points_arr.push(point);var cur=points_list[point];var include=true;if(isNaN(point))continue;if(metro_field&&metro_field!=''){include=false;var point_metro=cur.metroStationsIDList.split(',');var l=point_metro.length;while(l--){if(in_array(point_metro[l],metro_arr)==true){include=true;}}}
if(addr_str&&addr_str.test(cur.Address.toUpperCase())==false){include=false;}
if(check_unistream&&cur.isOwnBranch!='True'){include=false;}
if(check_payments&&cur.canAcceptPhonePayments!='True'){include=false;}
if(check_credits&&cur.canAcceptCreditRepayments!='True'){include=false;}
if(check_daily&&/CLOSED|выходной/i.test(cur.Worktime)){include=false;}
if(check_hourly&&!/круглосуточно/i.test(cur.Worktime)){include=false;}
if(include==false){hidden_count++;hidden_obj[cur.Bank_ID]=1;points_list[point].hidden=true;}else{delete cur.hidden;if(cur.GMapsTargetLng||cur.GMapsTargetLat){withMap++;}}}
delete points_list;if(list_map){if(withMap==0){$('#map-trigger').addClass('disabled');}else{$('#map-trigger').removeClass('disabled');}
list_map.dirty=true;if($('#map-trigger').hasClass('active')){list_map.show();}}
if(!points_cache){points_cache={};var count=points_arr.length;while(count--){var point_id=points_arr[count];points_cache[point_id]=doc.getElementById('row-'+point_id);}}
var count=points_arr.length;while(count--){var point_id=points_arr[count];var el=points_cache[point_id];var el_class=el.className;if(el_class!='hidden'&&hidden_obj[point_id]){el.className='hidden';}else if(el_class=='hidden'&&!hidden_obj[point_id]){el.className='';}}
delete hidden_obj;$('#table-overlay').addClass('hidden');var visible_count=points_arr.length-hidden_count;$('#point-count').html(visible_count);if(visible_count==0){if(!$('#nopoints-message').length){$('#point-list-table').after('<p id="nopoints-message"><big>'+_t['LIST_NOT_FOUND']+'</big></p>');}}else{$('#nopoints-message').remove();}
if(loc!=''){doc.location.hash='';}
var url_str=[];if(metro_field&&metro_field!=''){url_str.push('pmetro='+escape(metro_field));}
if(addr_field!=''){url_str.push('paddress='+escape(addr_field));}
if(check_unistream){url_str.push('punistream');}
if(check_payments){url_str.push('ppayments');}
if(check_credits){url_str.push('pcredits');}
if(check_daily){url_str.push('pdaily');}
if(check_hourly){url_str.push('phourly');}
if(url_str.length>0){doc.location.hash=url_str.join('&');}
delete doc;}
function setCookie(c_name,value,expiredays,path){document.cookie=c_name+"="+escape(value)+
((expiredays||expiredays==0)?";max-age="+(expiredays*24*60*60):"")+
((path==null)?"":";path="+path);}
function getCookie(name){var cookie=" "+document.cookie;var search=" "+name+"=";var setStr=null;var offset=0;var end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=cookie.indexOf(";",offset)
if(end==-1){end=cookie.length;}
setStr=unescape(cookie.substring(offset,end));}}
return(setStr);}
function in_array(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}
return false;}