(function(jq){
	jq.fn.cluster = function()
	{
		this.each(function(){

			var height = jq(this).height();
            var button = jq(this).find('span.plus');
            var self = this;
            
            button.click(plus_minus_clicked);
			
			function plus_minus_clicked(e) {
                if (jq(button).attr('class') == 'minus') {
                    hide();
                } else {
                    show();
                }
			}
			
			function show() {
                jq(self).stop(1,0).animate({'height': height}, 300);
                jq(button).attr('class', 'minus');
			}
			
			function hide(tempo) {
                tempo = tempo ? tempo : 300;
                jq(self).stop(1,0).animate({'height': 87}, tempo);
                jq(button).attr('class', 'plus');
			}
			
			var uid = this.id.split('-');
			if (document.location.hash.substring(1) != uid[1]) {
    			hide(0);
            } else {
                show(0);
            }
		})
			
	}
})(jQuery);
