// JavaScript Document

function PopupFeature(id) {
	$E.onAvailable(id, this.handleOnAvailable, this); 
}

PopupFeature.prototype.cancelTimer = function(e) {
	var div = Event.findElement(e, 'div');
	if(this.nTimeoutId) window.clearTimeout(this.nTimeoutId);
	if(div.animDown && div.animDown.isAnimated() ) div.animDown.stop();
	if(div.animUp) div.animUp.animate(); 
};

PopupFeature.prototype.onButtonMouseOut = function(e) {
	var thisObj = this;
	this.cancelTimer(e);
	this.nTimeoutId = window.setTimeout(function(){ thisObj.featurePopup.animDown.animate(); }, 1000);
};

PopupFeature.prototype.handleOnAvailable = function(me) {   
	me.featurePopup = this;
	this.me = me;
	
	/*
	var oIFrame = document.createElement("iframe");
	oIFrame.src = this._iFrameSrc;
	oIFrame.frameBorder = 0;
	oIFrame.scrolling = "no";
	oIFrame.style.position = "absolute";
	oIFrame.style.width = "100%";
	oIFrame.style.height = "100%";
	oIFrame.tabIndex = -1;
	this._oIFrame = this.appendChild(oIFrame);
		
	*/
	
	this.attributesUp = { height: { to: 170 } };
	this.attributesDown = { height: { to: 42 } };
	this.durationUp = 1; 
	this.durationDown = 0.75; 
	this.easingUp = YAHOO.util.Easing.elasticOut;
	this.easingDown = YAHOO.util.Easing.elasticIn;

	this.animUp = new $Anim(this, this.attributesUp, this.durationUp ,this. easingUp);
	this.animDown = new $Anim(this, this.attributesDown, this.durationDown , this.easingDown );
	$E.on(this, 'mouseover', this.animUp.animate, this.animUp, true);
	var children = this.childNodes;
   	for (var i = 0; i < children.length; i++) {
		$E.on(children[i], 'mouseover', me.cancelTimer, this, true);	
	}
	$E.on(this, 'mouseover', me.cancelTimer, me, true);
	$E.on(me.featurePopup, 'mouseout', me.onButtonMouseOut, me, true);
	$E.on(document, 'click', this.animDown.animate, this.animDown, true);
};