var _name;
var _description;
var _i = 1;
var _sentOut = false;

function showEvents( name, description ) {
  document.getElementById("downloadDescriptionCallout").innerHTML = "<ul><li><b>Name:</b> " + name + "</li><li><b>Description:</b> " + description + "</li></ul>";
  document.getElementById("downloadDescriptionCallout").style.top= "250px";
  document.getElementById("downloadDescriptionCallout").style.left = (pageWidth()/2)-370+"px";
  document.getElementById("downloadDescriptionCallout").style.display = "block";

  if (! _sentOut ) {
    _i = 1;
    phaseInEvents();
  }
}

function pageWidth() {
  return document.body.clientWidth != null 
    ? ( document.body.clientWidth -12) 
    : doucment.documentElement.clientWidth;
}

onresize = function() { 
  document.getElementById("downloadDescriptionCallout").style.left = (pageWidth()/2)-370+"px";
}

onload = function() { 
  if ( _name != null )
    showEvents( _name, _description );
}

// Deprecated for hideEvents();
//function clearData() {
//  document.getElementById("downloadDescriptionCallout").innerHTML = "";
//}
function hideEvents() {
      document.getElementById("downloadDescriptionCallout").style.display = "none";
 }

function phaseInEvents() {
    document.getElementById("downloadDescriptionCallout").style.opacity = _i/100;
    document.getElementById("downloadDescriptionCallout").style.filter = "alpha(opacity="+_i+")";
    setTimeout("phaseInEvents();", 100);
    _i = _i + 10;
}

function phaseOutEvents() {
    document.getElementById("downloadDescriptionCallout").style.opacity = _i/100;
    document.getElementById("downloadDescriptionCallout").style.filter = "alpha(opacity="+_i+")";
    setTimeout("phaseOutEvents();", 100);
    _i = _i - 10;
    
    if ( _i == 0 ) {
      document.getElementById("downloadDescriptionCallout").style.display = "none";
    }
}
