// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
currentSlide = 1;
jumpTo = 0;

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 monitorSlides(){
	point = Math.round(MM_findObj("MediaPlayer").controls.CurrentPosition);
	folder = MM_findObj("fslides").value;
	playState = MM_findObj("MediaPlayer").PlayState;
	if(playState == 3){
	if (point >= 0 && point < jumpTo){MM_findObj("MediaPlayer").controls.CurrentPosition = jumpTo;}
		for (x=0;x<slideTimes.length;x++){
			if (slideTimes[x] < point && slideTimes[(x+1)] > point && slideNumbers[x] != currentSlide){
					MM_findObj("slideImg").src = "slides/"+folder+"/Slide"+(slideNumbers[x])+".jpg";
					//MM_findObj("sTitle").innerHTML = slideTitles[x];
					for (i=0;i<slideTimes.length;i++){MM_findObj("bg"+slideNumbers[i]).style.background = "#FFFFFF";}
					MM_findObj("bg"+slideNumbers[x]).style.background = "#3984FF";
					//MM_findObj("slideNum").innerHTML = "Slide "+slideNumbers[x];
					//currentSlide = slideNumbers[x];
			}
		}
		
		window.status = "Playing ("+convertSeconds()+")";
	}else{
		window.status = "Stopped";
	}
}

function convertSeconds(){
	point = Math.round(MM_findObj("MediaPlayer").CurrentPosition) - jumpTo;
	hours = Math.floor(point / 60 / 60);
	mins = Math.floor(point / 60) - (hours * 60);
	seconds = point - (mins * 60) - (hours * 60 * 60);
	return hours+":"+mins+":"+seconds;
}
	
images = "";
function showHideDiv(divnumb){
	switch(divnumb){
		case 1:
			MM_findObj("slides1").style.display = "block";
			MM_findObj("slides2").style.display = "none";
			MM_findObj("slides3").style.display = "none";
			MM_findObj("slides4").style.display = "none";
			MM_findObj("slides5").style.display = "none";
		  break    
		case 2:
			MM_findObj("slides1").style.display = "none";
			MM_findObj("slides2").style.display = "block";
			MM_findObj("slides3").style.display = "none";
			MM_findObj("slides4").style.display = "none";
			MM_findObj("slides5").style.display = "none";
		  break
		case 3:
			MM_findObj("slides1").style.display = "none";
			MM_findObj("slides2").style.display = "none";
			MM_findObj("slides3").style.display = "block";
			MM_findObj("slides4").style.display = "none";
			MM_findObj("slides5").style.display = "none";
		  break
		case 4:
			MM_findObj("slides1").style.display = "none";
			MM_findObj("slides2").style.display = "none";
			MM_findObj("slides3").style.display = "none";
			MM_findObj("slides4").style.display = "block";
			MM_findObj("slides5").style.display = "none";
		  break
		case 5:
			MM_findObj("slides1").style.display = "none";
			MM_findObj("slides2").style.display = "none";
			MM_findObj("slides3").style.display = "none";
			MM_findObj("slides4").style.display = "none";
			MM_findObj("slides5").style.display = "block";
		  break
	}
}
function showTitle(nS){
	//MM_findObj("bg"+nS).style.background = "#3984FF";
	MM_findObj("sTitle").innerHTML = slideTitles[nS-1];
}
function chgSlWm(nSlide){
	folder = MM_findObj("fslides").value;
	MM_findObj("slideImg").src = "slides/"+folder+"/Slide"+nSlide+".jpg";
	MM_findObj("MediaPlayer").controls.CurrentPosition = slideTimes[nSlide-1];
}
//var output = "";
//function showSlides_t(){
//	output = "<table width='100%' border='0' cellspacing='0' cellpadding='4'><tr>"
//	for (x=0;x<slideNumbers.length;x++){
//		output += "<td align='center' valign='middle' id='bg"+slideNumbers[x]+"'><a href='#' onClick='chgSlWm("+slideNumbers[x]+");'><img id='slides"+slideNumbers[x]+"_t' border='0' src='slides/JohnClarke/Slide"+slideNumbers[x]+"_t.jpg'></a></td>"
//	}
//	output += "</tr></table>"
//	MM_findObj("slidesT").innerHTML = output
//}