window.onload = init

function init()
{ if (document.getElementById("video"))
  { setMask()
  }
}




var caption = new Array(10)

function showCaption(which)
{ document.getElementById("caption").innerHTML = caption[which]
}

function hideCaption()
{ document.getElementById("caption").innerHTML = " "
}

function thumbOn(which,obj)
{ obj.className = "selected"
  objUL = obj.parentNode
  objLI = objUL.getElementsByTagName("li")
  numLI = objLI.length
  
  for (i=0;i<numLI;i++)
  { if (i == which)
    { objLI[i].className = "selected"
      objIMG = document.getElementById("largePicImage")
      srcIMG = objIMG.getAttribute("src")
      srcLOC = srcIMG.indexOf("large")
      srcPTH = srcIMG.substring(0,srcLOC)
      srcIMG = srcPTH + "large" + which + ".jpg"
      objIMG.setAttribute("src",srcIMG)
      document.getElementById("caption").innerHTML = caption[which]
    }
    else
    { objLI[i].className = ""
    }
  }
}




/*

play video in pop-up window.

*/


function setMask()
{ newElement = document.createElement("div")
  newElement.setAttribute("id","mask")
  //document.getElementsByTagName("body")[0].appendChild(newElement)
  obj = document.getElementById("popVideo")
  document.getElementsByTagName("body")[0].insertBefore(newElement,obj)
  
  x = document.getElementsByTagName("body")[0].clientHeight + 20
  y = getWindowHeight()

  if (y > x)
  { x = y
  }
  
  document.getElementById("mask").style.height = x + "px"
}

/*

Popup Layer functions.

*/

function showVid()
{ document.getElementById("mask").style.display = "block"
  document.getElementById("popVideo").style.display = "block"
/*
  var yPos = document.body.scrollTop
  
  if (yPos == 0)
  { if (window.pageYOffset)
    { yPos = window.pageYOffset;
    }
    else
    { yPos = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
    }
  }
  
  document.getElementById("popVideo").style.marginTop = (yPos-100) + "px"
*/  
}

function hideVid()
{ document.getElementById("mask").style.display = "none"
  document.getElementById("popVideo").style.display = "none"
  window.location.reload()
}


 
function getWindowHeight()
{ var myHeight = 0
  if( typeof( window.innerWidth ) == 'number' )
  { myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  { myHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  { myHeight = document.body.clientHeight;
  }
  return myHeight;
}
