var StoresSelector = new Class({
	
	//implements
	Implements: [Options],

	//options
	options: {
		storesSelector: 'stores',
		storesList: '',
		storesSlide:$empty,
		storesItems: [],
		storesItemsSlides:[],
		storesItemsLinks:[],
		storesSubItems: [],
		storesSubItemsSlides:[],
		storesSubItemsLinks:[]
	},
	
	//initialization
	initialize: function(options) {
		//set options
		var thisInstance = this;
		this.setOptions(options);
		this.options.storesList = this.options.storesSelector.getNext();
		this.options.storesItems = this.options.storesList.getChildren();
		this.options.storesItems.each(function(thisStoreItem){
											   this.options.storesItemsLinks.push(thisStoreItem.get('rel'));
											   thisStoreItem.addEvent('click',function(){thisInstance.toggleSecondListItem(this.get('rel'))})
											   new Accordion($(thisStoreItem.get('rel')).getElements('.selectStoreDropDownItemName'),$(thisStoreItem.get('rel')).getElements('.selectStoreDropDownItemAddress'),{show:'-1',onComplete:function(toggler,element){thisInstance.toggleSecondListItem(toggler.getParent().get('id'))}});
											   this.options.storesItemsSlides[thisStoreItem.get('rel')] = new Fx.Slide(thisStoreItem.get('rel')).cancel().hide();
										}.bind(this))
		this.options.storesSlide = new Fx.Slide(this.options.storesList).hide();
		$(this.options.storesSelector).addEvent('click',this.toggleFirstList.bind(this))
	},
	
	//a method that does whatever you want
	yourMethod: function() {
		
	},
	
	//a method that does whatever you want
	toggleFirstList: function() {
		this.options.storesSlide.toggle();
	},
	
	//a method that does whatever you want
	toggleSecondListItem: function(thisListItem) {
		this.options.storesItemsLinks.each(function(thisLink){this.options.storesItemsSlides[thisLink].slideOut();}.bind(this))
		this.options.storesItemsSlides[thisListItem].cancel().slideIn();
	}	
});
