// Browser safe opacity handling function
function setOpacity( value ) {
 document.getElementById(popupID).style.opacity = value / 10;
 document.getElementById(popupID).style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 90 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 90 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }

 setTimeout('closeMyPopup()', 800 );
}


// open the popup
function fireDiv(divid){
	
	// assign string value to global variable
	popupID = divid
	//call the opacity function
	setOpacity( 0 );
	//start the display of the popup
	//document.getElementById(divid).style.top = topOffset + "px";
  	//document.getElementById(divid).style.left = leftOffset + "px";
	document.getElementById(divid).style.display = 'block';
	// call the fade in function to alter the opacity
	fadeInMyPopup();
}

// close the popup
function closeMyPopup(divid) {
 	document.getElementById(divid).style.display = 'none';
}