/*	Invisalign Patient Story Javascript */

var _PSIntro;

function storePSIntro()
{
  //Store Intro Html
  var PSPlaceHolder = document.getElementById("PSPlaceHolder");
  _PSIntro = PSPlaceHolder ? PSPlaceHolder.innerHTML : null;
}

function restorePSIntro()
{
  setPSMenu(new Array("psMenu1", "psMenu2"), false);
  //Restore Intro Html
  var PSPlaceHolder = document.getElementById("PSPlaceHolder");
  if (PSPlaceHolder)
  {
    PSPlaceHolder.innerHTML = _PSIntro;
  }
}

function showPSVideo(swf)
{
  if (_PSIntro)
  {
    restorePSIntro();
  }
  else
  {
    storePSIntro();
  }
  setPSMenu(new Array("psMenu2"), true);
  var flashvars = {};
  var params = {};
  params.base = "/SiteCollectionImages/media";
  var attributes = {};
  swfobject.embedSWF(swf, "PSContent", "530", "390", "9.0.0","/SiteCollectionImages/media/expressInstall.swf", flashvars, params, attributes);
}

function showPSActualResults(swf)
{
  if (_PSIntro)
  {
    restorePSIntro();
  }
  else
  {
    storePSIntro();
  }
  setPSMenu(new Array("psMenu1"), true);
  var flashvars = {};
  var params = {};
  params.base = "/SiteCollectionImages/media";
  var attributes = {};
  swfobject.embedSWF(swf, "PSContent", "530", "400", "9.0.0","/SiteCollectionImages/media/expressInstall.swf", flashvars, params, attributes);
}

function setPSMenu(showItems, showBack)
{
  //Get all menu items
  var psMenu1 = document.getElementById("psMenu1");
  var psMenu2 = document.getElementById("psMenu2");
  //Hide all menu items
  if (psMenu1) psMenu1.style.display = "none";
  if (psMenu2) psMenu2.style.display = "none";
  //Show menu items
  for (var i=0; i<showItems.length; i++)
  {
  	var item = document.getElementById(showItems[i]);
  	if (item) item.style.display = "block";
  }
  //Show/hide back button
  var psMenuBack = document.getElementById("psMenuBack");
  if (psMenuBack) psMenuBack.style.display = showBack ? "block" : "none";
}