/*var TIMER = 0;
var popup = function ()
{
	var SELF = this;
	this.activeElements = [];
	this.timer = 0;
	this.flag = [];
	this.theTarget = {};
	this.onmouseover = function(event){
			// self = window //SELF = popup //event||window.event = Evenet //this = node	
			
			var e = event||window.event;			
			clearTimeout(TIMER)			
			SELF.theTarget = e.target ? e.target : e.srcElement;
			if( SELF.theTarget && ( SELF.theTarget.nodeType == 3 || SELF.theTarget.nodeType == 4 ) ) {
			  SELF.theTarget = SELF.theTarget.parentNode;
			}
			if( 'object' != typeof SELF.theTarget.getAttribute('rel') && 
				'undefined' != typeof SELF.flag[SELF.theTarget.getAttribute('rel')]){
				if(SELF.flag[SELF.theTarget.getAttribute('rel')] == 0 ){						
					SELF.decorate();
				}				
				SELF.flag[SELF.theTarget.getAttribute('rel')] = 1;
			}	
	}
	this.onmouseout = function(event){
		var e = event||window.event;					
		SELF.theTarget = e.target ? e.target : e.srcElement;
		if( SELF.theTarget && ( SELF.theTarget.nodeType == 3 || SELF.theTarget.nodeType == 4 ) ) {
		  SELF.theTarget = SELF.theTarget.parentNode;
		}
		if( 'object' != typeof SELF.theTarget.getAttribute('rel') && 
			'undefined' != typeof SELF.flag[SELF.theTarget.getAttribute('rel')]){
			
			
			SELF.flag[SELF.theTarget.getAttribute('rel')] = 2;
			TIMER = setTimeout(
				function(){ 
					if(SELF.flag[SELF.theTarget.getAttribute('rel')] == 2)
					{
						SELF.flag[SELF.theTarget.getAttribute('rel')] = 0;
						SELF.undecorate();								
					}
				},
			50);
		
			}
	}
	this.exec = function(){
		for(var i  in SELF.flag)
		{
			if('function' != typeof SELF.flag[i])
				document.getElementById('ff').innerHTML +='-i = '+i+' flag'+SELF.flag[i];
		}
	}
	
}
popup.prototype.setActiveElements = function(object){	
	try{
		if('object' != typeof object) throw 'Error:не передан ни один элемент для работы с объектом';
		for(var i = 0; i < object.length; i++){
			this.activeElements[i] = object[i];
			for(var j = 0; j<this.activeElements[i].DOMActions.length; j++){
				this.flag[this.activeElements[i].DOMNode.getAttribute('rel')] = 0;
			
				if (this.activeElements[i].DOMNode.addEventListener){
						this.activeElements[i].DOMNode.addEventListener(
							this.activeElements[i].DOMActions[j].substr('2'),
							eval('this.'+this.activeElements[i].DOMActions[j]), 
							false
						);
				}
				else if(this.activeElements[i].DOMNode.attachEvent){
					this.activeElements[i].DOMNode.attachEvent(
						this.activeElements[i].DOMActions[j], 
						eval('this.'+this.activeElements[i].DOMActions[j])
						);
				} 
				else {
					alert('SOME ELSE BROWSER! SCRIPT WILL NOT WORK CORRECTLY!')
				    return false;
				 }
			}
		}
	}
	catch(e){
		alert('ERROR in "setActiveElements" method: '+e)
	}	
}

popup.prototype.decorate = function(){	
	try	{
		//this.undecorate();	// очистить дейсвия для нового элемента
		userAction(this.theTarget);	// вызов пользовательской функции
	}
	catch(e){
		alert('ERROR in "decorate" method: '+e)
	}
}
popup.prototype.undecorate = function(){
	try{
		for(var i = 0; i < this.activeElements.length; i++){
			this.flag[this.activeElements[i].DOMNode.getAttribute('rel')] = 0;
			userUnAction(this.theTarget);	// вызов пользовательской функции
		}
	}
	catch(e){
		alert('ERROR in "undecorate" method: '+e)
	}
}

popup.prototype.addProperties = function(data){
	return this[data.key]  = data.value;
}
*/
var popup = function ()
{
	this.data = [];
	this.timeout = 0;
	this.active = false;
}

popup.prototype.exec = function(){	
	var self = this;
	var e = this.root.select('li');
	for(var i=0; i<e.length; i++)
	{
		e[i].onmouseover = function(event)
		{
			if(self.active)
			{
				var t = self.root.select('[rel="'+self.active+'"]');
				t[0].className='action-element';
			}
			clearTimeout(self.timeout);
			this.className = 'action-element active';
			self.active= this.getAttribute('rel');
			
		}
		e[i].onmouseout = function()
		{
			eThis = this;	
			self.timeout = setTimeout(
				function()
				{
					eThis.className = 'action-element';
				}, 30);
		}
	}
}

popup.prototype.addProperties = function(data){
	return this[data.key]  = data.value;
}


popup.prototype.addData = function(data){
	return this.data.push({'title':data.title, 'text':data.text});
}
