function setOpacity(value,obj) {
 document.getElementById(obj).style.opacity = value / 10;
 document.getElementById(obj).style.filter = 'alpha(opacity=' + value * 10 + ')';
}

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

function fadeOutMyPopup(obj) {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ',"'+obj+'")' , 2 * i );
 }

 setTimeout('closeMyPopup("'+obj+'")', 800 );
}

function closeMyPopup(obj) {
 document.getElementById(obj).style.display = "none"
}

function fireMyPopup(obj) {
 setOpacity(0,obj);
 document.getElementById(obj).style.display = "block";
 fadeInMyPopup(obj);
}