var currentlyHidingDiv = "";

pageInit = function() {
	/* Popup summary */
	/* We find all items with the articleTitle class */
	var els = YAHOO.util.Dom.getElementsByClassName('articleTitle', 'a');
	for( var i=0; i < els.length; i++ )
	{
		/* Get the hover div */
		sDivId = els[i].getAttribute('hoverId');
		sDiv = document.getElementById( sDivId ); 
		YAHOO.util.Dom.setStyle( sDiv , 'opacity', '0');
		
		/* Unhide the Summary layer when mouse over/ out*/
		YAHOO.util.Event.addListener( els[i], "mouseover", hoverOver ); 
		YAHOO.util.Event.addListener( els[i], "mouseout", hoverOut ); 
	}
}


/* This function is to unhide the div, then do a smooth very web2.0 fade-in effect */
function hoverOver()
{
	var sDivId = this.getAttribute('hoverId');
	var sDiv = document.getElementById( sDivId ); 
	var sW = YAHOO.util.Dom.getViewportWidth();
	
	onDivId = sDiv;
	sDiv.style.left  = ( YAHOO.util.Dom.getX( this ) - ( sW - 800 )/2 ) + 'px';	
	sDiv.style.top  = (YAHOO.util.Dom.getY( this ) + this.offsetHeight - 130 ) +'px';
	sDiv.style.display = '';
	var animIn = new YAHOO.util.Anim( sDiv, { opacity: { to: 1 } }, 0.25, YAHOO.util.Easing.easeOut);
	animIn.animate();
}

/* This function is to hide the div with a dramatic web2.0 fade effect */
function hoverOut()
{
	var sDivId = this.getAttribute('hoverId');
	var sDiv = document.getElementById( sDivId ); 	
	currentlyHidingDiv = sDivId ;
	var animOut = new YAHOO.util.Anim( sDiv, { opacity: { to: 0 } }, 0.25, YAHOO.util.Easing.easeOut);
	animOut.animate();
	animOut.onComplete.subscribe( hoverHide );
}

/* Call back function used in hoverOut() */
function hoverHide()
{
	//alert( this.getEl().id );
	this.getEl().style.display = 'none';
}

YAHOO.util.Event.addListener( window, "load", pageInit ); 

