function CatalogFilter(name){
	this.name=name;
	this.data={};
	this.avl_mode=false;
	this.cat_url='';

	this.inited_form=false;

	this.frmValid=new oValid();
	this.frmValid.frm_id='io_sf_form';

	this.debug=true;
	this.init_mode=false;

	this.init=function(){
		this.init_mode=u('#io_sf_init_mode').value;

		this.checkbox.init();
		this.sort.init(this);
		this.stars.init(this);
		this.amenities.init(this);
		this.chains.init(this);
		this.hotels.init(this);
		this.landmarks.init(this);
		this.map.init(this);
		this.name_suggester.init(this);

		this.inited_form=u('#io_sf_form').serialize();

		this.frmValid.parse_frm();

		//uHandlers.add('on_load', this.name+'.set_paytype();');

		if(this.init_mode=='map'){
			uHandlers.add('on_load', this.name+'.map.show(); '+this.name+'.landmarks.show_on_map();');
		}
		this.set_init_mode('');
	};

	this.set_init_mode=function(s){
		this.init_mode=u('#io_sf_init_mode').value=s;
	};

	this.init_cookies=function(){

	};

	this.submit_tmr=false;
	this.pre_submit_clear=function(){
		if(this.submit_tmr!==false) window.clearInterval(this.submit_tmr);
	};

	this.pre_submit=function(){
		this.pre_submit_clear();
		this.submit_tmr=setInterval(this.name+'.submit();', 20);
	};

	this.submit=function(){
		this.pre_submit_clear();

		if(!this.frmValid.validate()) return false;
		this.frmValid.clear_empty();

		if(!this.debug && this.inited_form==u('#io_sf_form').serialize()) return false;

		u('#io_sf_form').submit();
		show_wait(1);
	};

	this.paytype='';
	this.set_paytype=function(id,not_now){
		if(!this.debug && this.paytype==id) return false;
		if(id==undefined) {
			if (u('#io_pt-all-chk').checked) this.paytype=id='all';
			else if(u('#io_pt-www-chk').checked) this.paytype=id='www';
			else this.paytype=id='htl';
		}else{
			this.checkbox.set('io_pt-'+this.paytype, 'io_pt-'+this.paytype+'-chk',false);
			this.checkbox.set('io_pt-'+id, 'io_pt-'+id+'-chk',true);
			if (not_now==undefined) this.submit();
			else this.pre_submit();
		}
		if(!u('#io_sf_paytypes_pt_'+this.paytype)) return false;

		u('#io_sf_paytypes_pt_'+this.paytype).killClass('sfilter_top_sel');
		u('#io_sf_paytypes_pt_'+id).addClass('sfilter_top_sel');
		this.paytype=id;

		return false;
	};

	this.name_suggester={
		init : function(parent){
			this.parent=parent;
		},

		onkeyup : function(e){
			this.parent.pre_submit();
		}
	},

	this.checkbox={
		init : function(){
			var items=u('.master_recheckbox'), i, tmp;
			for(i in items.els){
				if(!items.els[i].checked) continue;
				tmp=items.els[i].id.split('-');
				this.set(tmp[0]+'-'+tmp[1], items.els[i].id, true);
			}
		},

		set : function(id, chk_id, checked){
			if(checked==undefined) checked=-1;
			if(checked===false || (checked<0 && u('#'+chk_id).checked)){
				u('#'+chk_id).checked=false;
				u('#'+id).killClass('master_block_item-checkbox-checked');
			}else{
				u('#'+chk_id).checked=true;
				u('#'+id).addClass('master_block_item-checkbox-checked');
			}
		},

		over : function(id, m){
			if(m==1) u('#'+id).addClass('master_block_item-checkbox-over');
			else if(m==2) u('#'+id).addClass('master_block_item-checkbox-down');
			else if(m==3) u('#'+id).killClass('master_block_item-checkbox-down');
			else{
				u('#'+id).killClass('master_block_item-checkbox-over');
				u('#'+id).killClass('master_block_item-checkbox-down');
			}
		}
	};

	this.sort={
		parent : null,
		prev : -1,
		items : [],
		cnt : 0,

		init : function(parent){
			this.parent=parent;
			var i;
			for(i=0; i<this.cnt; i++)
				if(u('#io_sf_sort-'+this.items[i].id+'-chk').checked){
					this.prev=this.items[i].id;
					break;
				}
		},

		add : function(a){
			this.items.push(a);
			this.cnt++;
		},

		set : function(id){
			var i, ok;
			for(i=0; i<this.cnt; i++){
				ok=false;
				if(this.prev!=id && id==this.items[i].id) ok=true;
				this.parent.checkbox.set('io_sf_sort-'+this.items[i].id, 'io_sf_sort-'+this.items[i].id+'-chk', ok);
			}
			if(this.prev==id) this.prev=-1;
			else this.prev=id;

			// not approx
			if(id!=5){
				this.parent.landmarks.set(false);
			}

			this.parent.pre_submit();
		}
	};

	this.stars={
		parent : null,
		type : 'checkbox',
		prev : -1,

		init : function(parent){
			var i;
			this.parent=parent;
			for(i=1; i<6; i++){
				if(u('#io_sf_stars-'+i+'-chk')===false) continue;
				if(u('#io_sf_stars-'+i+'-chk').type=='checkbox') break;
				this.type='radio';
				if(u('#io_sf_stars-'+i+'-chk').checked){
					this.prev=i;
					break;
				}
			}
		},

		set : function(id){
			var i, ok=false;
			if(this.type=='radio'){
				for(i=1; i<6; i++){
					ok=false;
					if(this.prev!=id && id==i) ok=true;
					this.parent.checkbox.set('io_sf_stars-'+i, 'io_sf_stars-'+i+'-chk', ok);
				}
				if(this.prev==id) this.prev=-1;
				else this.prev=id;
			}else{
				if(!u('#io_sf_stars-'+id+'-chk').checked) ok=true;
				this.parent.checkbox.set('io_sf_stars-'+id, 'io_sf_stars-'+id+'-chk', ok);
			}
			this.parent.pre_submit();
		}
	};

	this.landmarks={
		parent : null,
		cnt : 0,
		items : [],
		prev : -1,

		init : function(parent){
			if(u('#master_landmarks_hide_all')===false) return false;

			this.parent=parent;

			if(!this.cnt) return false;

			var i, checked_id=false, scrollto_id=false;

			if(this.cnt>10){
				for(i=0; i<this.cnt; i++){
					if(u('#io_sf_lm-'+this.items[i].id+'-chk').checked){
						checked_id=this.items[i].id;
						break;
					}
					scrollto_id=this.items[i].id;
				}
				this.prev=checked_id;
				if(i<6) checked_id=false;

				if(checked_id===false){
					for(i=6; i<this.cnt; i++)
						u('#io_sf_lm-'+this.items[i].id).hide();
				}else{
					if(scrollto_id===false) scrollto_id=checked_id;
					this.show_all();
					u('#io_sf_landmarks').scrollTop=u('#io_sf_lm-'+scrollto_id).absPos('offsetTop')-u('#io_sf_landmarks').absPos('offsetTop');
				}
			}else
				u('#master_landmarks_show_all').hide();
		},

		add : function(a){
			this.items.push(a);
			this.cnt++;
		},

		show_all : function(){
			var i, show=true;

			if(u('#master_landmarks_hide_all').visible()) show=false;

			if(show){
				u('#master_landmarks_show_all').hide();
				u('#master_landmarks_hide_all').show();
				u('#io_sf_landmarks').addClass('master_block_item-landmarks-scroll');
			}else{
				u('#master_landmarks_show_all').show();
				u('#master_landmarks_hide_all').hide();
				u('#io_sf_landmarks').killClass('master_block_item-landmarks-scroll');
			}

			for(i=6; i<this.cnt; i++){
				if(show) u('#io_sf_lm-'+this.items[i].id).show();
				else u('#io_sf_lm-'+this.items[i].id).hide();
			}
		},

		set : function(id){
			var i, ok, found=false;
			for(i=0; i<this.cnt; i++){
				ok=false;
				if(this.prev!=id && id==this.items[i].id) ok=true;
				if(id==this.items[i].id) found=true;
				this.parent.checkbox.set('io_sf_lm-'+this.items[i].id, 'io_sf_lm-'+this.items[i].id+'-chk', ok);
			}
			if(!found) id=-1;
			if(this.prev==id) this.prev=-1;
			else this.prev=id;

			if(id!==false && id!=-1) this.parent.pre_submit();
		},

		show_on_map : function(){
			if(!this.prev) return false;
			this.parent.map.show_elm_by_id(this.prev);
		}
	};

	this.amenities={
		parent : null,
		items : [],
		cnt : 0,
		limit : 99,

		init : function(parent){
			if(u('#master_amenities_hide_all')===false) return false;

			this.parent=parent;

			if(this.cnt<8){
				u('#master_amenities_show_all').hide();
				u('#master_amenities_hide_all').hide();
				return true;
			}

			var show=false;
			for(i=6; i<this.cnt; i++){
				if(u('#io_sf_am-'+this.items[i].id+'-chk').checked){
					show=true;
					break;
				}
			}
			this.show_all(show);
		},

		add : function(a){
			this.items.push(a);
			this.cnt++;
		},

		set : function(id){
			var i, c=0;
			this.parent.checkbox.set('io_sf_am-'+id, 'io_sf_am-'+id+'-chk');

			for(i=0; i<this.cnt; i++){
				if(u('#io_sf_am-'+this.items[i].id+'-chk').checked) c++;
				if(c>this.limit){
					this.parent.checkbox.set('io_sf_am-'+id, 'io_sf_am-'+id+'-chk', false);
					ShowAlert(uGLOBALS.msg.am_max);
					break;
				}
			}
			this.parent.pre_submit();
		},

		show_all : function(init){
			var i, show=true;

			if(init==undefined) show=!u('#master_amenities_hide_all').visible();
			else show=init;

			if(show){
				u('#master_amenities_show_all').hide();
				u('#master_amenities_hide_all').show();
			}else{
				u('#master_amenities_show_all').show();
				u('#master_amenities_hide_all').hide();
			}

			for(i=6; i<this.cnt; i++){
				if(show) u('#io_sf_am-'+this.items[i].id).show();
				else u('#io_sf_am-'+this.items[i].id).hide();
			}
		}
	};

	this.chains={
		parent : null,
		items : [],
		cnt : 0,

		init : function(parent){
			if(u('#master_chains_hide_all')===false) return false;

			this.parent=parent;
			if(this.cnt<8){
				u('#master_chains_show_all').hide();
				u('#master_chains_hide_all').hide();
				return true;
			}

			var show=false;
			for(i=6; i<this.cnt; i++){
				if(u('#io_sf_chain-'+this.items[i].id+'-chk').checked){
					show=true;
					break;
				}
			}
			this.show_all(show);
		},

		add : function(a){
			this.items.push(a);
			this.cnt++;
		},

		set : function(id){
			var i, c=0;
			this.parent.checkbox.set('io_sf_chain-'+id, 'io_sf_chain-'+id+'-chk');
			this.parent.pre_submit();
		},

		show_all : function(init){
			var i, show=true;

			if(init==undefined) show=!u('#master_chains_hide_all').visible();
			else show=init;

			if(show){
				u('#master_chains_show_all').hide();
				u('#master_chains_hide_all').show();
			}else{
				u('#master_chains_show_all').show();
				u('#master_chains_hide_all').hide();
			}

			for(i=6; i<this.cnt; i++){
				if(show) u('#io_sf_chain-'+this.items[i].id).show();
				else u('#io_sf_chain-'+this.items[i].id).hide();
			}
		}
	};

	this.ps={};
	this.set_page=function(w, a){
		this.ps[w]=a;
	};

	this.hotels={
		cnt : 0,
		items : [],
		parent : null,

		init : function(parent){
			this.parent=parent;
		},

		add : function(a){
			a.stars=parseInt(a.stars);
			if(a.stars<1) a.stars=0;
			if(parseInt(a.has_video)!=1) a.has_video=0;
			a.rate=parseInt(a.rate);
			this.items.push(a);
			this.cnt++;
		}
	};

	this.map={
		gmap : null,
		parent : null,
		inited : false,
		shown_types : {},
		map_mode : false,
		gmap_uniq_id : 1,
		marker_importance : 0,

		items : [],

		prev_selected : false,
		zoomed : false,

		init : function(parent){
			this.parent=parent;
		},

		show : function(){
			if(!GBrowserIsCompatible()){
				ShowAlert(uGLOBALS.msg.maps_not_supported);
				return false;
			}

			uClear();

			this.inited=false;
			this.zoomed=false;

			var tabs={}, callback_params={}, title_html='';
			if(this.parent.hotels.cnt) tabs['io_sf_map-hotels']='Отели';
			if(this.parent.landmarks.cnt){
				tabs['io_sf_map-landmarks']='Ориентиры';
				title_html=false;
			}

			callback_params['io_sf_map-hotels']={id : 'hotels'};
			callback_params['io_sf_map-landmarks']={id : 'landmarks'};

			popup_msg.show({
				width : 960,
				border : false,
				title_html : title_html,
				super_title : u('#io_sf_map-title').innerHTML,
				tabs : tabs,
				callback : ['oCF.map', 'popup_callback'],
				callback_params : callback_params
			});
		},

		popup_callback : function(prm){
			uHint.show(false);

			if(!this.inited && prm._action=='after_show'){
				popup_msg.prm.static_content=true;

				this.inited=true;
				this.prev_selected=false;
				this.select_elm(false);

				u('#io_sf_map-content').innerHTML=u('#io_sf_map').innerHTML;

				if(popup_msg.tabs.cnt==1)
					u('#io_sf_map_container').addClass('io_sf_map_container_bt');

				var items=[], i, j=0, shot, htl, num_class;
				// draw hotels
				for(i=0; i<this.parent.hotels.cnt; i++){
					htl=this.parent.hotels.items[i];

					this.items[j]={
						i : i,
						type : 'hotel',
						id : htl.id,
						history: 'hotel'
					};

					// draw hotel list
					num_class='io_sf_map_marker_hotel';
					if(htl.promo!=''){
						num_class='io_sf_map_marker_promo';
						this.items[j].history='hotel_promo';
					}

					shot='<div class="io_sf_map_list_htl" id="io_sf_map_list-'+j+'" onclick="oCF.map.select_elm('+j+', false); return false;">';
					shot+='	<table width="100%" border="0" cellpadding="0" cellspacing="0">';
					shot+='		<tr>';
					shot+='			<td class="htl_cnr_tl"><img src="/img/spacer.gif" /></td>';
					shot+='			<td colspan="2" class="htl_cnr_tr"><img src="/img/spacer.gif" /></td>';
					shot+='		</tr>';
					shot+='		<tr>';
					shot+='			<td width="40">';
					shot+='				<div class="htl_num">';
					shot+='					<div class="io_sf_map_marker '+num_class+'"><div class="io_sf_map_marker_num">'+(i+1)+'</div></div>';
					shot+='				</div>';
					shot+='			</td>';
					shot+='			<td>';
					shot+='				<div class="htl_name">';
					shot+='					<a href="javascript:void(0);">'+htl.name+'</a>';
					shot+='					<div class="h_stars"><div class="stars s'+htl.stars+'"></div></div>';
					shot+='				</div>';
					shot+='			</td>';
					shot+='			<td width="75">';

					if(htl.rate>0){
						shot+='				<div class="htl_rate">';
						shot+='					'+uGLOBALS.msg.maps.from+'<span>'+htl.rate+' '+htl.currency+'</span>'+uGLOBALS.msg.maps.per_night;
						shot+='				</div>';
					}else{
						shot+='&nbsp;';
					}

					shot+='			</td>';
					shot+='		</tr>';
					shot+='		<tr>';
					shot+='			<td class="htl_cnr_bl"><img src="/img/spacer.gif" /></td>';
					shot+='			<td colspan="2" class="htl_cnr_br"><img src="/img/spacer.gif" /></td>';
					shot+='		</tr>';
					shot+='	</table>';
					shot+='</div>';

					items.push(shot);
					j++;
				}
				u('#io_sf_map_hlist_in').innerHTML=implode(u('#io_sf_map-items-sep').innerHTML, items);

				// draw landmarks
				items=[];
				for(i=0; i<this.parent.landmarks.cnt; i++){
					lm=this.parent.landmarks.items[i];

					this.items[j]={
						i : i,
						type : 'landmark',
						id : lm.id,
						history: 'landmark'
					};

					shot='<div class="io_sf_map_list_htl io_sf_map_list_landmark" id="io_sf_map_list-'+j+'" onclick="oCF.map.select_elm('+j+', false); return false;">';
					shot+='	<table width="100%" border="0" cellpadding="0" cellspacing="0">';
					shot+='		<tr>';
					shot+='			<td class="htl_cnr_tl"><img src="/img/spacer.gif" /></td>';
					shot+='			<td class="htl_cnr_tr"><img src="/img/spacer.gif" /></td>';
					shot+='		</tr>';
					shot+='		<tr>';
					shot+='			<td width="40">';
					shot+='				<div class="htl_num">';
					shot+='					<div class="io_sf_map_marker io_sf_map_marker_landmark"><div class="io_sf_map_marker_num">'+(i+1)+'</div></div>';
					shot+='				</div>';
					shot+='			</td>';
					shot+='			<td>';
					shot+='				<div class="htl_name">';
					shot+='					<a href="javascript:void(0);">'+lm.name+'</a>';
					shot+='				</div>';
					shot+='			</td>';
					shot+='		</tr>';
					shot+='		<tr>';
					shot+='			<td class="htl_cnr_bl"><img src="/img/spacer.gif" /></td>';
					shot+='			<td class="htl_cnr_br"><img src="/img/spacer.gif" /></td>';
					shot+='		</tr>';
					shot+='	</table>';
					shot+='</div>';

					items.push(shot);
					j++;
				}
				u('#io_sf_map_lmlist_in').innerHTML=implode(u('#io_sf_map-items-sep').innerHTML, items);


				popup_msg.positionize();
				this.init_gmap();
				this.draw();

				this.toggle_items('landmark', false);

				this.history();
			}

			if(prm._action=='after_show'){
				u('#io_sf_map_hlist').scrollTop=0;

				if(prm.id=='hotels'){
					u('#io_sf_map_hlist_in').show();
					u('#io_sf_map_lmlist_in').hide();
					this.map_mode='hotels';
					this.toggle_items('landmark', false);
				}
				else if(prm.id=='landmarks'){
					u('#io_sf_map_hlist_in').hide();
					u('#io_sf_map_lmlist_in').show();
					this.map_mode='landmarks';
					this.toggle_items('landmark', true);
				}
			}

			return true;
		},

		toggle_items : function(type, vis){
			var i=0, j=this.items.length, types={}, itm;

			this.shown_types[type]=vis;

			for(i=0; i<j; i++){
				itm=this.items[i];
				if(itm.type!=type || itm.always_visible) continue;
				if(vis){
					itm.visible=true;
					u('#'+itm.label).show();
					this.gmap.addOverlay(itm.gmap_marker);
				}
				else{
					itm.visible=false;
					u('#'+itm.label).hide();
					this.gmap.removeOverlay(itm.gmap_marker);
				}
			}

			//this.history();
		},

		history : function(){
			var i=0, j=this.items.length, types={};
			for(i=0; i<j; i++){
				if(types[this.items[i].history]!=undefined) continue;
				types[this.items[i].history]=true;
			}
			for(i in types)
				if(u('#io_sf_map_'+i))
					u('#io_sf_map_'+i).show();
		},

		show_elm_by_id : function(id){
			var i;
			for(i in this.items){
				itm=this.items[i];
				if(itm.id==id){
					itm.always_visible=true;
					u('#'+itm.label).show();
					this.gmap.addOverlay(itm.gmap_marker);
					this.zoomed=true;
					this.select_elm(i, false);
					return true;
				}
			}
			return false;
		},

		select_elm : function(i, map_click){
			uHint.show(false);

			if(i===false){
				if(this.prev_selected!==false)
					i=this.prev_selected;
			}

			if(i===false) return false;

			var parent=this;

			if(this.prev_selected!==false && this.prev_selected==i){
				u('#io_sf_map_list-'+i).killClass('io_sf_map_list_htl_sel');
				this.prev_selected=false;
				return false;
			}
			else if(this.prev_selected!==false){
				u('#io_sf_map_list-'+this.prev_selected).killClass('io_sf_map_list_htl_sel');
			}

			if(this.items[i].type=='hotel' && u('#io_sf_map_list-'+i)){
				//if(map_click) popup_msg.tabs.set(0);

				u('#io_sf_map_list-'+i).addClass('io_sf_map_list_htl_sel');
				this.prev_selected=i;

				this.zoom2me(i);

				var htl=this.parent.hotels.items[ this.items[i].i ];

				var html='<div class="io_sf_map_htl">';
				html+='<div class="io_sf_map_htl-name"><a href="javascript:void(0);" onclick="redirect(\''+htl.link+'\'); return false;">'+htl.name+'</a></div>';
				if(htl.tmb!='') html+='<div class="io_sf_map_htl-tmb"><img src="'+htl.tmb+'" /></div>';
				if(htl.stars) html+='<div class="io_sf_map_htl-stars" align="center"><div class="h_stars" align="left"><div class="stars s'+htl.stars+'"></div></div></div>';
				html+='</div>';

				window.setTimeout(function(){
					var xy=parent.gmap.fromLatLngToContainerPixel(parent.items[i].gmap_point);
					var a=[GetElmAbsPos(u('#io_sf_map_view'), 'offsetLeft')+xy.x+5, GetElmAbsPos(u('#io_sf_map_view'), 'offsetTop')+xy.y-35];
					uHint.show(html, a);
				}, 10);
			}
			else if(this.items[i].type=='landmark' && u('#io_sf_map_list-'+i)){
				//if(map_click) popup_msg.tabs.set(1);

				u('#io_sf_map_list-'+i).addClass('io_sf_map_list_htl_sel');
				this.prev_selected=i;

				this.zoom2me(i);

				var lm=this.parent.landmarks.items[ this.items[i].i ];

				var html='<div class="io_sf_map_landmark">';
				html+='<div class="io_sf_map_landmark-name">'+lm.name+'</div>';
				html+='<div class="io_sf_map_landmark-show-hotels"><a href="javascript:void(0);" onclick="'+this.parent.name+'.set_init_mode(\'map\'); '+this.parent.name+'.landmarks.set('+lm.id+'); '+this.parent.name+'.submit(); hide_float_layer(false); return false;">показать отели рядом</a></div>';
				html+='</div>';

				window.setTimeout(function(){
					var xy=parent.gmap.fromLatLngToContainerPixel(parent.items[i].gmap_point);
					var a=[GetElmAbsPos(u('#io_sf_map_view'), 'offsetLeft')+xy.x+5, GetElmAbsPos(u('#io_sf_map_view'), 'offsetTop')+xy.y-35];
					uHint.show(html, a);
				}, 10);
			}

			if(map_click && this.prev_selected!==false){
				if(this.map_mode=='hotels' || (this.items[ this.prev_selected ].type=='landmark' && this.map_mode=='landmarks'))
					u('#io_sf_map_hlist').scrollTop=u('#io_sf_map_list-'+this.prev_selected).offsetTop-150;
			}
		},

		zoom2me : function(i){
			var bounds=new GLatLngBounds();
			bounds.extend(this.items[i].gmap_point);
			this.gmap.setCenter(bounds.getCenter());
			this.gmap.setLabelZIndex(this.items[i].label, this.marker_importance++);

			if(!this.zoomed){
				var zoom=this.gmap.getBoundsZoomLevel(bounds)-3;
				this.gmap.setZoom(zoom);
				this.zoomed=true;
			}
		},

		init_gmap : function(){
			this.map_elm=u('#io_sf_map_view');

			this.gmap=new GMap2(this.map_elm);
			this.gmap.addControl(new GLargeMapControl());
			this.gmap.enableScrollWheelZoom();
			this.gmap.addControl(new GMapTypeControl());
			this.gmap.enableDoubleClickZoom();
			this.gmap.enableContinuousZoom();

			// центр карты
			var center_found=false; var is_landmark=false;
			var point=false;
			for(var i in this.parent.landmarks.items){
				var lm=this.parent.landmarks.items[i];
				if(lm.a){
					point=new GLatLng(lm.lat, lm.lng);
					this.gmap.setCenter(point, 14); // show active landmark
					break;
				}
			}
			if(point===false){
				for(var i in this.parent.hotels.items){
					var htl=this.parent.hotels.items[i];
					if(htl.lat==0 && htl.lng==0) continue;
					var point=new GLatLng(htl.lat, htl.lng);
					this.gmap.setCenter(point, 12); // show first hotel
					break;
				}
			}
			this.gmap.setMapType(G_NORMAL_MAP);

			var parent=this;
			GEvent.addListener(this.gmap, 'movestart', function(){
				parent.select_elm(false);
			});
			GEvent.addListener(this.gmap, 'zoomstart', function(){
				parent.select_elm(false);
			});
		},

		draw : function(){
			var i=0, j=this.items.length, itm, details, point, marker, label, icon, baseIcon;

			baseIcon=new GIcon();
			baseIcon.shadow='/img/gmap/shadow.png';
			baseIcon.iconSize=new GSize(28, 29);
			baseIcon.shadowSize=new GSize(28, 29);
			baseIcon.iconAnchor=new GPoint(9, 34);
			baseIcon.infoWindowAnchor=new GPoint(9, 2);
			baseIcon.infoShadowAnchor=new GPoint(18, 25);

			icon=new GIcon(baseIcon);
			icon.image='/img/gmap/point_empty.gif';

			// draw items on map
			for(i=0; i<j; i++){
				itm=this.items[i], details=false;
				if(itm.type=='hotel')
					details=this.parent.hotels.items[itm.i];
				else if(itm.type=='landmark')
					details=this.parent.landmarks.items[itm.i];

				point=new GLatLng(details.lat, details.lng);
				marker=this.createMarker(point, icon, i);
				point.importance=marker.importance=this.marker_importance++;
				this.gmap.addOverlay(marker);
				itm.gmap_point=point;
				itm.gmap_marker=marker;

				label=new THotelLabel();
				label.anchorLatLng=new GLatLng(details.lat, details.lng);

				label.nid=this.gmap_uniq_id++;
				label.num=itm.i+1;

				if(itm.type=='hotel'){
					label.className='io_sf_map_marker_hotel';
					if(this.parent.hotels.items[itm.i].promo!='') label.className='io_sf_map_marker_promo';
				}
				else if(itm.type=='landmark'){
					label.className='io_sf_map_marker_landmark';

					if(this.parent.landmarks.prev==itm.id) itm.always_visible=true;
					//if(itm.name.toLowerCase().indexOf('airport')>=0) label.className='io_sf_map_marker_airport';
				}

				label.markerOffset=new GSize(20, 20);
				this.gmap.addHotelLabel(label);
				itm.label=label.id;
				this.gmap.setLabelZIndex(itm.label, i);
			}
		},

		createMarker : function(point, icon, i){
			var marker=new GMarker(point, icon), parent=this;
			GEvent.addListener(marker, 'click',
				function(){
					parent.select_elm(i, true);
				}
			);
			return marker;
		}
	};

	this.backlink=false;
	this.init_backlink=function(){
		if(this.backlink===false) this.backlink=_GET('sfb');
		if(this.backlink===false) return false;

		var goto_cat=_GET('sfb_set');

		if(this.hotels.cnt)
			for(var i in this.hotels.items) this.hotels.items[i].link+='?sfb='+this.backlink;

		var backlink=this.backlink;
		u('.htl_link_rpl').each(function(){
			this.href+='?sfb='+backlink;
			if(goto_cat!==false) this.href+='&sfb_set=1';
		});

		var a=u('#pmaster_frm_sfb');
		if(a!==false) a.value=this.backlink;
		var a=u('#sfb_val');
		if(a!==false) a.value=this.backlink;
	};
}
