function closeWin()
{
  self.close();
}

function transcript(TRANSCRIPT)
{
 var transcript = window.open(TRANSCRIPT,"transcript",config="left=430,screenx=0,top=20,screeny=0,height=530,width=370,menubar=yes,toolbar=no,status=yes,location=no,resizable=yes,scrollbars=yes");
 if (transcript==null) // Detect pop-up blocker
 {
    alert('The transcript pop-up window cannot open.\n\nPlease make sure you allow pop-up windows at this site!');
 }
 else
 {
    transcript.focus();
 }
}


function debug(msg) 
{
  if(location.search.search(/debug/) > 0) {
    alert(msg);
  }
}


//
//  Flash Media Player specific code
//
function createFlashObject()
{
  var fo = new FlashObject("/nlmVideoPlayer.swf", "video", 
              "100%", "100%", "7", "#FFFFFF"
              );
  fo.addVariable("playerLogo","/images/SeniorHealthLogo.swf");
  fo.addVariable("colorTheme",'0x513484');
  
  return fo;
}

var FLASH_MAPPINGS = {
      "www.nlm.nih.gov"         : "rtmp://fms.nlm.nih.gov/sites/nlm",
      "nihseniorhealth.gov"     : "rtmp://fms.nlm.nih.gov/sites/nihseniorhealth",
      "qa.nihseniorhealth.gov"  : "rtmp://130.14.17.126/sites/qanihseniorhealth"
      };

function getFlvPath(path)
{
  var lhostname = location.hostname.toLowerCase();
  var pathname = location.pathname;
  var port = location.port;
  var flvPath;
  var teamsiteRE = /.\/main(\/.*\/(STAGING|WORKAREA\/[^\/]+|EDITION\/[^\/]+))(\/.*)\//;
  
  if(FLASH_MAPPINGS[lhostname]) {
    flvPath = FLASH_MAPPINGS[lhostname];
    if(path) {
      if(path.charAt(0) == '/') {
        flvPath += path; 
      } else {
        pathname.match(/(.*\/)/);
        flvPath += RegExp.$1 + path;
      }
    } else {
      pathname.match(/(.*\/)/);
      flvPath += RegExp.$1;
    }
    
  } else if(teamsiteRE.test(pathname))  {
    var hostpart = lhostname.split(".")[0];                
    flvPath = "rtmp://130.14.17.126/" + hostpart + RegExp.$1;
    if(path) {
      if(path.charAt(0) == '/') {
        flvPath += path + "/";
      } else {
        flvPath += RegExp.$3 + "/" + path;
      }
    } else {
      flvPath += RegExp.$3 + "/";
    }
  }

  debug("Mapping " + lhostname + " to " + flvPath );

  return flvPath;
}


function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}


//
// Windows Media Player specific code
//


var Stop ="n";
function StopPlay()
{
 if (Stop == "y")
  {
 document.WinMedia.Play();
 document.PlayStop.src="/images/StopButton.jpg";
 if (navigator.appName.substring(0,8) != "Netscape")
 {
  document.images["PlayStop"].src="/images/StopButton_down.jpg";
 }
 Stop = "n";
 }
 else
 {
 document.WinMedia.Pause();
 document.PlayStop.src="/images/PlayButton.jpg";
 if (navigator.appName.substring(0,8) != "Netscape")
 {
 document.images["PlayStop"].src="/images/PlayButton_down.jpg";
 }
 Stop = "y";
 }
}
function Rewind()
{
 document.WinMedia.Stop();
 document.WinMedia.Play();
 document.PlayStop.src="/images/StopButton.jpg";
 Stop = "n";
}
function rollOver(imageTagName, imageFileName)
{
 document.images[imageTagName].src=imageFileName;
}
function mouseIn(imageTagName, stopImageFileName, playImageFileName)
{
 if (Stop == "y")
 {
 document.images[imageTagName].src=playImageFileName;
 }
 else
 {
  document.images[imageTagName].src=stopImageFileName;
 }
}
function mouseOut(imageTagName, stopImageFileName, playImageFileName)
{
 if (Stop == "y")
 {
 document.images[imageTagName].src=playImageFileName;
 }
 else
 {
 document.images[imageTagName].src=stopImageFileName;
 }
}

function Mp300Td1()
{
if (navigator.appName.substring(0,8) == "Netscape")
  document.write("<td valign=top bgcolor=black><img src=/images/leftside.jpg height=334 alt='' width=12></td>");
 else
 {
  document.write("<td valign=top bgcolor=black><img src=/images/leftside.jpg height=330 alt='' width=12></td>");
 }
}

function Mp300Td2()
{
if (navigator.appName.substring(0,8) == "Netscape")
{
document.write("<td valign=top width=16><img src=/images/rightside.jpg height=334 alt='' width=16></td>");
}
else
{
 document.write("<td valign=top align=right width=16><img src=/images/rightside.jpg height=330 alt='' width=16></td>");
}
}

function Mp38Td1()
{
if (navigator.appName.substring(0,8) == "Netscape")
{
document.write("<td valign=top bgcolor=black><img src=/images/leftside.jpg height=274 alt='' width=12></td>");
}
else
{
 document.write("<td valign=top bgcolor=black><img src=/images/leftside.jpg height=270 alt='' width=12></td>");
}
}

function Mp38Td2()
{
if (navigator.appName.substring(0,8) == "Netscape")
{
document.write("<td valign=top width=16><img src=/images/rightside.jpg height=274 alt='' width=16></td>");
}
else
{
 document.write("<td valign=top align=right width=16><img src=/images/rightside.jpg height=270 alt='' width=16></td>");
}
}


var image30 = new Image();
image30.src = "/images/top.jpg";
var image31 = new Image();
image31.src = "/images/leftside.jpg";
var image32 = new Image();
image32.src = "/images/rightside.jpg";
var image33 = new Image();
image33.src = "/images/middle.jpg";
var image34 = new Image();
image34.src = "/images/leftMiddleLeft.jpg";
var image35 = new Image();
image35.src = "/images/leftMiddleRight.jpg";
var image36 = new Image();
image36.src = "/images/rightMiddleLeft.jpg";
var image37 = new Image();
image37.src = "/images/rightMiddleRight.jpg";
var image37 = new Image();
image37.src = "/images/bottom.jpg";

image38 = new Image();
image38.src = "/images/StopButton_down.jpg";
image39 = new Image();
image39.src = "/images/PlayButton_down.jpg";
image40 = new Image();
image40.src = "/images/PlayButton.jpg";
image41 = new Image();
image41.src = "/images/RestartButton_down.jpg";
image42 = new Image();
image42.src = "/images/CloseButton_down.jpg";
image43 = new Image();
image43.src = "/images/transcriptButton_down.jpg";