
/*
 * Establish directory prefixes based on document title.
 */
var prefix1;
var prefix2;

if (document.title=="About Us")
{
  prefix1='';
  prefix2='index_files/'
}
else
{
  prefix1='../';
  prefix2='';
}


/*
 * Function to output header
 */
function header()
{
  document.write('<DIV style="MARGIN-BOTTOM: 50px">');
  document.write('<IMG class=stave alt="Camberwell Choir School logo - writing along musical stave of 5 lines, incorporating musical notation and charity number, 1002667" src="' + prefix2 + 'image3421.jpg">');
  document.write('</DIV>');
}


/*
 * Function to output menu
 */
function menu(pg)
{
  document.write('<DIV class=menuBar>');
  document.write('<P class=NormalL style="FONT-WEIGHT: bold">');
  document.write('<A class=menuButton style="TOP: 0px"');
  if (pg!="About")
  {
    document.write(' href="' + prefix1 + 'index.htm"');
  }
  document.write('>About Us</A>');
  document.write('<A class=menuButton style="TOP: 50px" href="' + prefix2 + 'Page1694.htm">When/where?</A>');
  document.write('<A class=menuButton style="TOP: 100px" href="' + prefix2 + 'Page1672.htm">Contact us</A>');
  document.write('<A class=menuButton style="TOP: 150px" href="' + prefix2 + 'Page309.htm">Videos & Photos</A>');
  document.write('<A class=menuButton style="TOP: 200px" href="' + prefix2 + 'Page418.htm">What people say</A>');
  document.write('<A class=menuButton style="TOP: 250px" href="' + prefix2 + 'Page459.htm">Who`s who</A>');
  document.write('<A class=menuButton style="TOP: 300px" href="' + prefix2 + 'Page592.htm">Work with us</A>');
  document.write('</P></DIV>');
}


/*
 * Function to output footer
 */
function footer()
{
  document.write('<DIV class=footer>');
  document.write('<IMG class=footer src="' + prefix2 + 'image355.gif">');
  document.write('<SPAN class=footer>');
  document.write('<P class=Normal>(c) Camberwell Choir School 2011');
  document.write('</P>');
  document.write('</SPAN>');
  document.write('</DIV>');
}


/*
 * Function to output a video player and control button
 */
function videoplayer(swffile, playerid)
{
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240" id="player' + playerid + '" align="middle">');
  document.write('<param name="movie" value="' + swffile + '"/>');
  document.write('<param name="play" value="false"/>');
  document.write('<param name="loop" value="false"/>');
  document.write('<param name="quality" value="high"/>');
  document.write('<embed src="' + swffile + '" play="false" loop="false" quality="high" width="320" height="240" name="player' + playerid + '" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');
  document.write('</object>');
  document.write('<input type=image SRC="playbutton.jpg" style="position:relative; top:20; left:20" id="button' + playerid + '" onclick="playvideo(document.player' + playerid + ', \'button' + playerid + '\')">');
}


/*
 * Function to output a wide video player and control button
 */
function videoplayerwide(swffile, playerid)
{
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="180" id="player' + playerid + '" align="middle">');
  document.write('<param name="movie" value="' + swffile + '"/>');
  document.write('<param name="play" value="false"/>');
  document.write('<param name="loop" value="false"/>');
  document.write('<param name="quality" value="high"/>');
  document.write('<embed src="' + swffile + '" play="false" loop="false" quality="high" width="320" height="180" name="player' + playerid + '" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');
  document.write('</object>');
  document.write('<input type=image SRC="playbutton.jpg" style="position:relative; top:20; left:20" id="button' + playerid + '" onclick="playvideo(document.player' + playerid + ', \'button' + playerid + '\')">');
}


/*
 * Function to output a large video player and control button
 */
function videoplayerlarge(swffile, playerid)
{
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="480" height="360" id="player' + playerid + '" align="middle">');
  document.write('<param name="movie" value="' + swffile + '"/>');
  document.write('<param name="play" value="false"/>');
  document.write('<param name="loop" value="false"/>');
  document.write('<param name="quality" value="high"/>');
  document.write('<embed src="' + swffile + '" play="false" loop="false" quality="high" width="480" height="360" name="player' + playerid + '" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');
  document.write('</object>');
  document.write('<input type=image SRC="playbutton.jpg" style="position:relative; top:20; left:20" id="button' + playerid + '" onclick="playvideo(document.player' + playerid + ', \'button' + playerid + '\')">');
}


/*
 * Variables for controlling video playing
 */
var timerid;
var currentplayer = null;
var currentbutton;


/*
 * Function to poll when the currently playing video has finished
 */
function endplaying()
{
  if (currentplayer == null)
  {
    clearInterval(timerid);
  }
  else if (!currentplayer.IsPlaying())
  {
    currentbutton.src = "playbutton.jpg";
    clearInterval(timerid);
  }
}

/*
 * Function tthat is called when a video play/stop button is clicked. Parameters are the player object
 * and the play/stop button id.
 */
function playvideo(player, buttonid)
{
  var button = document.getElementById(buttonid);

  if ((currentplayer != null) && (currentplayer != player))
  {
    currentplayer.StopPlay();
    currentbutton.src = "playbutton.jpg";
    clearInterval(timerid);
  }

  if (player.IsPlaying())
  {
    player.StopPlay();
    button.src = "playbutton.jpg";
    currentplayer = null;
    clearInterval(timerid);
  }
  else
  {
    player.Play();
    button.src = "stopbutton.jpg";
    currentplayer = player;
    currentbutton = button;
    timerid = setInterval("endplaying()",500);
  } 
}


