// Video Window

var VidWind;

function VidWindow(Viddoc){
  if (navigator.appName.toUpperCase()=="NETSCAPE") {
    var posX = "screenX=" + Math.floor((screen.width/2 - 620/2));
    var posY = "screenY=" + Math.floor((screen.height/2 - (450/2+48)));
  } else {
    var posX = "left=" + Math.floor((screen.width/2 - 620/2));
    var posY = "top=" + Math.floor((screen.height/2 - (450/2+48)));
  }
  VidWind=window.open(Viddoc,"subW3","HEIGHT=450,WIDTH=620,menubar,resizable,"+posX+","+posY+'"');
  self.blur();
  VidWind.focus();
}
function closeVidWindow(){
  if (VidWind && !VidWind.closed) {
    VidWind.blur();
    self.focus();
    VidWind.close();
  }
}
function closeAllWindows(){
  if (VidWind && !VidWind.closed) {
    VidWind.close();
  }
}

// Insert QT Video (Avoids Security Issue - See http://www.apple.com/quicktime/tutorials/embed.html)

function InsertQTMovie() {
  document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="260">\n');
  document.write('<param name="src" value="media/cttw.mov" />\n');
  document.write('<param name="autoplay" value="true" />\n');
  document.write('</object>\n');
}

// Center Content in the Video Window

var isIE = (navigator.userAgent.toLowerCase().indexOf("msie") != -1)
var isNetscape = (navigator.appName.toLowerCase() == "netscape")
var bVer = parseInt(navigator.appVersion)
var isIE3 = (isIE && (bVer < 4))
var isIE4 = (isIE && (navigator.userAgent.toLowerCase().indexOf("msie 4.") !=-1))
var isIE5 = (isIE && (navigator.userAgent.toLowerCase().indexOf("msie 5.") !=-1))
var isIE5up = (isIE && !isIE3 && !isIE4)
var isNetscape2 = (isNetscape && (bVer == 2))
var isNetscape3 = (isNetscape && (bVer == 3))
var isNetscape4 = (isNetscape && (bVer == 4))
var isNetscape6 = (isNetscape && (navigator.userAgent.toLowerCase().indexOf("6.") != -1))
var isNetscape6up = (isNetscape && !isNetscape2 && !isNetscape3 && !isNetscape4)
var coll = ""
var endExp = ""
if (isIE4) coll = "all."
if (isIE5up || isNetscape6up) {
  isDOM = true
  coll = "getElementById(\""
  endExp = "\")"
}
function getObjHeight(vObj) {
  if (isNetscape4) return vObj.clip.height
  else if (isIE4 || isDOM) return vObj.offsetHeight
}
function getObjWidth(vObj) {
  if (isNetscape4) return vObj.clip.width
  else if (isIE4 || isDOM) return vObj.offsetWidth
}
function getInsideWindowWidth() {
  if (isNetscape) return window.innerWidth
  else if (isIE) return document.body.clientWidth
}
function getInsideWindowHeight() {
  if (isNetscape) return window.innerHeight
  else if (isIE) return document.body.clientHeight
}
function shiftTo(vObj, y) {
  if (isNetscape4) vObj.moveTo((0.05*window.innerWidth),y)
  else if (isIE4) vObj.style.pixelTop = y
  else if (isDOM) vObj.style.top = y
}
function reCenter() {
  centerIt('sBody','sFooter')
}
function centerIt(SlideBody,SlideFooter,LoadingMsg) {
  oSlideBody = eval("document." + coll + SlideBody + endExp)
  oSlideFooter = eval("document." + coll + SlideFooter + endExp)
  oLoadingMessage = eval("document." + coll + LoadingMsg + endExp)
  if (isNetscape4) oSlideBodyContent = eval("document."+ SlideBody)
  else if (isIE4) {
    oSlideBodyContent = document.all[SlideBody].children[0]
    oSlideBody.style.pixelHeight = oSlideBodyContent.offsetHeight
  }
  else if (isDOM) oSlideBodyContent = document.getElementById(SlideBody)
  if (isNetscape4) oSlideFooterContent = eval("document."+ SlideFooter)
  else if (isIE4) {
    oSlideFooterContent = document.all[SlideFooter].children[0]
    oSlideFooter.style.pixelHeight = oSlideFooterContent.offsetHeight
  }
  else if (isDOM) oSlideFooterContent = document.getElementById(SlideFooter)
  oSlideBodyPosY = Math.round((getInsideWindowHeight()/2) - (getObjHeight(oSlideBodyContent)/2)) ;
  oSlideFooterPosY = Math.round(getInsideWindowHeight() - (getObjHeight(oSlideFooterContent)+12)) ;
  shiftTo(oSlideBody, oSlideBodyPosY)
  shiftTo(oSlideFooter, oSlideFooterPosY)
  if (isNetscape4) {
    if (oLoadingMessage!=null) oLoadingMessage.visibility = "hide"
    oSlideFooter.visibility = "show"
    oSlideBody.visibility = "show"
  }
  else if (isIE4 || isDOM) {
    if (oLoadingMessage!=null) oLoadingMessage.style.visibility = "hidden"
    oSlideFooter.style.visibility = "visible"
    oSlideBody.style.visibility = "visible"
  }
  onresize = reCenter;
}

// Status Bar Handler

var    ns4 = (document.layers)? true:false;
var    ie4 = (document.all)? true:false;
var    dom = (document.getElementById)? true:false;
var    ns6 = ((!(ns4||ie4))&&dom);
var    linkTxt;
function statusTextNS6() {
  window.status=linkTxt; return true;
}
function showStatus(msg) {
  linkTxt=msg;
  if (ns6) { document.addEventListener("mousemove",statusTextNS6,false); }
  else { window.status=msg; return true; }
}
function hideStatus() {
  linkTxt="";
  if (ns6) { document.removeEventListener("mousemove",statusTextNS6,false); }
  else { window.status=linkTxt; return true; }
}