function LP_picRollover(imageName, image2) 
{
	if(document.images)
	{
		aButton=document.images[imageName];
		aState=aButton.state
		if(aState!="down")
		{
		
			if(aState!="up"){ 
			  // This will only run once to initialise button up file.
			  for(i=0;i<document.images.length;i++)
			  { if (document.images[i].id.indexOf("b")>=0)
			    {  aB=document.images[i];
			       aB.up=aB.src;
			    }
			  }
			}

			aButton.down = image2;
			aButton.src = image2;
		
		}
	}
}

function LP_picRollback(imageName, imageUp) 
{
	if(document.images)
	{
		if(imageUp)
		{
			if(document.images[imageName].state!="down")
			{
				document.images[imageName].src = document.images[imageName].up = imageUp;
			}
		}
		else
		{
			if(document.images[imageName].state!="down")
			{
				document.images[imageName].src = document.images[imageName].up;
			}
		}
	}
}

function LP_switchTrack(button, d,PlayerID, trackName, trackNumber)
{
	for (i=0;i<document.images.length;i++)
	{
		if (document.images[i].id.indexOf("b")>=0)
		{
			aButton=document.images[i];
			aButton.state="up";
			LP_picRollback(aButton.id);
			
		}
	}
	b=document.images[button];
	b.state="down";
	b.src=b.down;
	var Player;
	Player=MM_findObj(PlayerID, d); 
	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer
		Player.fileName=trackName;
	}
	else
	{ // Welcome to the Real World
		Player.GoToChapter(trackNumber);
		Player.Play();
	}
}

function LP_stopPlayer(button, d, PlayerID)
{

	for (i=0;i<document.images.length;i++)
	{
		if (document.images[i].id.indexOf("b")>=0)
		{
			aButton=document.images[i];
			aButton.state="up";
			LP_picRollback(aButton.id);
			
		}
	}
	b=document.images[button];
	b.state="down";
	b.src=b.down;
	Player=MM_findObj(PlayerID, d);
	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer
		Player.Stop();
	}
	else
	{ // Welcome to the Real World
		Player.Stop();
	}
}

function MM_preloadImages() { //v3.0
   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   }

function LP_preloadImages() 
{
   d=document;
   a=LP_preloadImages.arguments;
   j=d.images.length;
   for(i=0; i<a.length; i++)
   {
   	d.images[j]=new Image;
   	d.images[j].src=a[i];
   }
}

function MM_swapImgRestore() { //v3.0
   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }

function MM_showHideLayers() { //v6.0
   var i,p,v,obj,args=MM_showHideLayers.arguments;
   for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
      if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
      obj.visibility=v; }
}


function LP_choosePlayer(trackOrList)
{
	var writestring="";
	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer is erratic with anything other than WMP

		writestring +="<object ID='MediaPlayer1' CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'";
		writestring +="CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'";
		writestring +="STANDBY='Loading Microsoft Windows Media Player components...'";
		writestring +="TYPE='application/x-oleobject' width='275' height='30'>";
		writestring +="<param name='fileName' value="+trackOrList+">";
		writestring +="<param name='animationatStart' value='true'>";
		writestring +="<param name='transparentatStart' value='true'>";
		writestring +="<param name='autoStart' value='true'>";
		writestring +="<param name='showControls' value='false'>";
		writestring +="<param name='Volume' value='-100'>";
		writestring +="<embed ID='MediaPlayer1' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/'";
		writestring +="src="+trackOrList;
		writestring +="name='MediaPlayer1' width='275' height='30' autostart='1' showcontrols='0' volume='-100'>";
		writestring +="</object>";
	}
	else
	{ // Welcome to the Real World

		writestring +="<object ID='MediaPlayer1' data="+trackOrList+" type='audio/mp3'";
		writestring +="width='275' height='35' vspace='5'>";
		writestring +="<param name='src' value="+trackOrList+">";
		writestring +="<param name='controller' value='false'>";
		writestring +="<param name='loop' value='true'>";
		writestring +="<param name='autostart' value='true'>";
		writestring +="<embed ID='MediaPlayer1' src="+trackOrList+" width='275' height='35'></embed>";
		writestring +="</object>";
	}
		document.write(writestring);
}

function reloadPage(init) {  //reloads the window if Nav4 resized
   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
   document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function LP_swapImage(image,subtext)
{
	if (document.images) document.images["picHolder"].src = image;
  	vizLayer=document.getElementById("picHolderl");
	noViz=document.getElementById("body");
	vizLayer.style.visibility="visible";
	noViz.style.visibility="hidden";
	setSubTitle(subtext);
}
function LP_textRestore()
{
  	obj=document.getElementById("picHolderl");
	objold=document.getElementById("body");
	obj.style.visibility="hidden";
	objold.style.visibility="visible";
}

function LP_setPlayerPosition(player_id, pPos, iframe_id, iPos)
{
	d=document;
	p=d.getElementById(player_id);
	l=d.getElementById(iframe_id);
	p.style.top=pPos+"px";
	l.style.top=iPos+"px";
}

function LP_setParentPlayerPosition(player_id, pPos, iframe_id, iPos)
{
	d=parent.document;
	p=d.getElementById(player_id);
	l=d.getElementById(iframe_id);
	l.style.top=iPos+"px";
	p.style.top=pPos+"px";
}

function LP_offSiteColour(reset, divID)
{
a_text=document.getElementById(divID);

if (reset > 0) a_text.className = "buyNow"; 
else a_text.className = "buyNowOver";
}

function LP_buyNowColour(reset, divID)
{
a_text=document.getElementById(divID);

if (reset > 0) a_text.className = "buyNow"; 
else a_text.className = "buyNowOver";
}

function LP_loadPage(a_page)
{
window.location=a_page;
}

function LP_pageNavBar(pageRoot, thisPage, 
prev, index, next, arrows, indexTarget, 
cssNormal, cssOver, 
backArrow, backArrowOver, forwardArrow, forwardArrowOver)
{
// Places at given position a forward and backward menu with central index button.
// All items may be switched on or off.
//
// pageRoot - the pageID that will be used as the basis for unique names.
// thisPage - index number for current page, used to create unique names with pageRoot.
// prev; index; next; arrows - value 1 or 0 (on or off)
// indexTarget - URL for index page
// cssNormal; cssOver - stylesheets for normal and hover conditions
// backArrow; backArrowOver; forwardArrow; forwardArrowOver - images for arrows in both conditions
// Stylesheet values are in .cssNormal & .cssOver.

/* 
	</div>  --marks end of page    

--function call goes here. "page-name-4" is constructed from pageRoot + (thisPage + 1)

	<div id="page-name-4" style="position: absolute; left: 0px; top: 0px; width: 384px; height: 390px; z-index: 2; visibility: hidden;">
*/

	pageNow = pageRoot + thisPage;
	if (prev > 0)
	{
		if (arrows > 0)
		{
			arrowPrev = "arrow" + pageRoot + thisPage-1;
			imgName = "pg" + thisPage + "back";
			pageBack = pageRoot + (thisPage-1);
			pageNext = pageRoot + (thisPage+1);
			document.write("<div id='" + arrowPrev + "' style='position:absolute; left:0px; top:458px; width:13px; height:13px; z-index:3;'>");
			document.write("<a class='" + cssNormal + "' ");
			document.write('onMouseOver="' + "LP_picRollover('" + imgName + "','" + backArrowOver + "'); " +'"');
			document.write('onMouseOut="' + "LP_picRollback('" + imgName + "','" + backArrow + "'); " +'"');
			document.write('onClick="' + "LP_switchPage('" + pageNow + "','" + pageBack + "'); " +'"' + ">");
			document.write("<img id='" + imgName + "' src='" + backArrow + "' width='13' height='13'></a></div>");
		}
		thisPrevious = "previous" + thisPage;
		document.write("<div id='" + thisPrevious + "' class='" + cssNormal + "'  align='left' style='position:absolute; left:20px; top:455px; width:112px; height:20px; z-index:4'>");
		document.write('<span onMouseOver="' + "LP_picRollover('" + imgName + "', '" + backArrowOver + "');LP_setNavTextColour(0,'" + thisPrevious + "')" +'"');
		document.write('onMouseOut="' + "LP_picRollback('" + imgName + "', '" + backArrow + "');LP_setNavTextColour(1,'" + thisPrevious + "')" +'"');
		document.write('onClick="' + "LP_switchPage('" + pageNow + "','" + pageBack + "')" +'"' + ">previous</span></div>");
	}

	if (next > 0)
	{
		if (arrows > 0)
		{
			arrowNext = "arrow" + pageRoot + thisPage+1;
			imgName = "pg" + thisPage + "fwd";
			pageBack = pageRoot + (thisPage-1);
			pageNext = pageRoot + (thisPage+1);
			document.write("<div id='" + arrowNext + "' style='position:absolute; left:341px; top:458px; width:13px; height:13px; z-index:3;'>");
			document.write("<a class='" + cssNormal + "' ");
			document.write('onMouseOver="' + "LP_picRollover('" + imgName + "','" + forwardArrowOver + "'); " +'"');
			document.write('onMouseOut="' + "LP_picRollback('" + imgName + "','" + forwardArrow + "'); " +'"');
			document.write('onClick="' + "LP_switchPage('" + pageNow + "','" + pageNext + "'); " +'"' + ">");
			document.write("<img id='" + imgName + "' src='" + forwardArrow + "' width='13' height='13'></a></div>");
		}
		thisNext = "next" + thisPage;
		document.write("<div id='" + thisNext + "' class='" + cssNormal + "'  align='right' style='position:absolute; left:224px; top:455px; width:112px; height:20px; z-index:4'>");
		document.write('<span onMouseOver="' + "LP_picRollover('" + imgName + "', '" + forwardArrowOver + "');LP_setNavTextColour(0,'" + thisNext + "')" +'"');
		document.write('onMouseOut="' + "LP_picRollback('" + imgName + "', '" + forwardArrow + "');LP_setNavTextColour(1,'" + thisNext + "')" +'"');
		document.write('onClick="' + "LP_switchPage('" + pageNow + "','" + pageNext + "')" +'"' + ">more</span></div>");
	}
	
	
	 if (index > 0)
	{      
		thisIndex = "index" + thisPage;
		document.write("<div id='" + thisIndex + "' class='" + cssNormal + "' style='position:absolute; left:132px; top:455px; width:120px; height:20px; z-index:3'>");
		document.write("<div><div align='center'><span  ");
		document.write('onMouseOver="' +"LP_setNavTextColour(0,'" + thisIndex + "')" +'"');
		document.write('onMouseOut="' + "LP_setNavTextColour(1,'" + thisIndex + "')" +'"');
		document.write('onClick="' + "LP_loadPage('" + indexTarget + "')" +'"' + ">index</span></div></div></div></div>");
	}      	
}

function LP_setNavTextColour(reset, divID)
{
a_text=document.getElementById(divID);

if (reset > 0) a_text.className = "pageNav"; 
else a_text.className = "pageNavOver";
}

function openWin(url,a_width,a_height)
{
	aWindow=window.open(url,"","width="+a_width+",height="+a_height+",toolbar=no,status=no,scrollbars=no,resizable=no,menubar=no");
}

function LP_switchPage(oldPage, newPage)
{
  	vizLayer=document.getElementById(newPage);
	noViz=document.getElementById(oldPage);
	vizLayer.style.visibility="visible";
	noViz.style.visibility="hidden";
}

function LP_loadPage(a_page)
{
window.location=a_page;
}

function setSubTitle(a_value)
{
t=document.getElementById('subTitle');
t.firstChild.nodeValue=a_value;
}
function jumpto(a_movie,a_value) {

//thisMovie(a_movie).GotoFrame(a_value);
thisMovie(a_movie).stop();
thisMovie(a_movie).TGotoLabel("/",a_value);
thisMovie(a_movie).Play();
}

function thisMovie(movieName) {

  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.

	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer
		return 	parent.document.getElementById('player');	
	}
	else
	{
	if (navigator.appName.indexOf("irefox")>=0)
	{ // Welcome to the Real World 	d=parent.document;
	
	}
	else
	{
		//return window.parent.document['mozplayer'];
		return 	parent.document.getElementById('player');	
	}}
}

function loadPerformance(iframe_id, a_page)
{
	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer
		l=parent.document.frames[iframe_id];	
	}
	else
	{ // Welcome to the Real World 	d=parent.document;

	//p=d.getElementById(player_id);
		l=parent.frames[0];
	}
	l.location=a_page;
}