var nLastPartShown = 1

//--------------------------------------------------
function ChangePartOfStory(nParts,nPartShown,nHero,lang)
{
  StopSound(nHero);
  nLastPartShown = nPartShown;
  var oPic = document.getElementById("HeroPic")
  var oTitle = document.getElementById("HeroPartTitle")
  for (i=1; i<=nParts; i++)
    {
      sPart = "part" + i;
      oPart = document.getElementById(sPart);
      
      sToolBar = "ToolBar" + i;
      oToolBar = document.getElementById(sToolBar);
      
      if (i == nPartShown)
       {
         oPart.style.display = "block";
         oToolBar.style.display = "block";
       }
      else
       {
         oPart.style.display = "none";
         oToolBar.style.display = "none";
       }
    }
    if(lang == "Ar")
     oPic.src="../images/hero" + nHero + "_pic" + nPartShown + "BAr.gif" 
    else
     oPic.src="../images/hero" + nHero + "_pic" + nPartShown + "B.gif" 
   oTitle.src="images/hero" + nHero + "Title" + nPartShown + ".gif"
}

//--------------------------------------------------
  function ChangePicture(nHero,nPic,sSize)
  {
    if(sSize == "H")
    {
      HeroPicWinH.Show();
      oHeroPicH = HeroPicWinH.oWin.contentWindow.document.getElementById("HeroPicH");
      oHeroPicH.innerHTML = "<img src='../images/hero" + nHero + "_pic" + nPic + "B.jpg'>" 
    }
    else
    {
      HeroPicWinW.Show();
      oHeroPicW = HeroPicWinW.oWin.contentWindow.document.getElementById("HeroPicW");
      oHeroPicW.innerHTML = "<img src='../images/hero" + nHero + "_pic" + nPic + "B.jpg'>" 
   }
  }
//--------------------------------------------------
  function GetPollAns(nStory)
  {
    qArray = "q" + nStory;

	  for (var i=0; i<document.getElementsByName(qArray).length;i++)
	    if (document.getElementsByName(qArray).item(i).checked)
        location.href="shaniResults.aspx?nStory=" + nStory + "&nAns=" + (i+1);
  }
//--------------------------------------------------
  function StopSound(nHero)
  {
    TextHero = "Text_hero" + nHero + nLastPartShown;
    if (document.getElementById(TextHero)!=null)
      TEXTSOUND_MngSound(TextHero, 'stop', '')
  }
//--------------------------------------------------
  function changeBtnState(Obj,sState)
  {
    if (sState=="on")
     Obj.src = "/images/" + Obj.id + "_s.gif"
    else
     Obj.src = "/images/" + Obj.id + ".gif"
  }