if( typeof ee == 'undefined' ) var ee = new function(){};
if( typeof ee.indicator == 'undefined' ) ee.indicator = new function(){};

Event.onDOMReady(function(){
	
	document.body.appendChild( Builder.node('div',{id:'indicator'}) );

	/*
	 * after resizing window we have to resize all active indicators ( visible indicators ) 
	 */	
	Event.observe(window,'resize',function(){
		for( cc in ee.indicator._activeIndicators ){
			if(ee.indicator._activeIndicators[cc]!=null) ee.indicator.show(cc);		
		}
	});
	
});

Object.extend( ee.indicator, {

	_activeIndicators : {},
	
	_getIndicator : function(id){
		var indicator = null;		
		if( typeof (indicator = $(id.id+'-indicator')) == 'undefined' )	{
			
			$('indicator').appendChild( indicator = Builder.node('div',{ 
				'id': id.id+'-indicator',
				'className' : 'indicator' 
			}));
			
			Event.observe(indicator, 'click', function(e){
				Event.stop(e);
			})	

		}
		return indicator;
	},
	
	show : function(id){
		
		var el = $(id);
		var it = this._getIndicator(el);
		
		Position.clone(el,it);
		it.show();
		this._activeIndicators[el.id] = el;
		
	},
	
	hide : function(id){
		var el = $(id);
		
		this._getIndicator(el).hide();
		this._activeIndicators[el.id] = null;
}
	
})
