﻿/***********************************************
* Displays a modal window with various options.
***********************************************/
function showModal(sViewID, iWidth, bIsCrimson, sTitle)
{
  //Find the modal "window"
  var divWindow = document.getElementById(sViewID);
  if (divWindow != null && parseInt(iWidth) != NaN)
  {
    divWindow.style.width = parseInt(iWidth) + "px";
    divWindow.style.marginLeft = -1 * (parseInt(iWidth) / 2) + "px";
  }
  
  //Set the title of the modal "window"
  var divTitle = document.getElementById("divFAQTitle");
  if (divTitle != null)
  {
    var spanTitle = document.getElementById("spanFAQTitle");
    if (spanTitle != null && sTitle != null)
      setElementText(spanTitle, sTitle);
  }
  
  if (bIsCrimson == null || !bIsCrimson)
  {
    divTitle.style.backgroundImage = "url(images/backgrounds/gray_header.png)";
    divTitle.style.backgroundRepeat = "repeat-x";
  }
  else
  {
    divTitle.style.backgroundImage = "url(images/backgrounds/crimson_header.png)";
    divTitle.style.backgroundRepeat = "repeat-x";
  }

  Effect.Appear(divWindow, {to:1.0, duration:1.0});
}

/*******************************
* Hides the modal-style dialog.
*******************************/
function hideModal(divModal)
{
  if (divModal != null)
    Effect.Fade(divModal);
}