// Javascript from Moodle modules
var slideNo=-1;
var currentSlideNo=0;
var autoSync = false;

<!-- TabView -->
var tabView = new YAHOO.widget.TabView("tabset");

<!--goto next slide -->
function gotoNextSlide(){
	if(numberOfSlides!=slideNo){
		slideNo += 1;
		displaySlide();
	}else{
		alert("Slide Show Ends!");
	}	
}

<!-- goto previous slide -->
function gotoPrevSlide(){
	if(slideNo > 1){
		slideNo -= 1;
		displaySlide();
	}else{
		alert("We are at the first slide!");
	}
}

<!-- goto first slide -->
function gotoFirstSlide(){
	if(slideNo != 1){
		slideNo= 1;
		displaySlide();
	}else{
		alert("Already on the first slide!");
	}
}

<!-- goto first slide -->
function gotoLastSlide(){
	if(slideNo != numberOfSlides){
		slideNo=numberOfSlides;
		displaySlide();
	}else{
		alert("Already on the last slide!");
	}
}

function displaySlide(){
	var slide= slidePath+"Slide"+slideNo+".JPG";
	var FO = {	movie:slide,width:600,height:450,majorversion:"7",build:"0",bgcolor:"#FFFFFF"};
	UFO.create(	FO, "slide-show");	
}

<!-- Trig Auto Sync -->
function trigAutoSync(){
	autoSync= document.getElementById('autosync').checked;
	checkAutoSync();
}

<!-- Handle Presenters Auto Sync -->
function checkAutoSync(){
	clearMsg();
	if(autoSync){
		if(currentSlideNo!=slideNo) syncSlide();
	}
	setTimeout('checkAutoSync()',1000);
}

<!-- Clear Messages -->
function clearMsg(){
	document.getElementById('slide-nav').innerHTML= '';
}

<!-- Async Calls -->

var handleGetSuccess = function(o){
	if(o.responseText !== undefined){
		currentSlideNo = o.responseText;
	}
}

var handleGetFailure = function(o){
	if(o.responseText !== undefined){
		document.getElementById('currentslide').innerHTML= 'Error: '+o.statusText;
	}
}

var callbackGet =
{
	success:handleGetSuccess,
	failure:handleGetFailure,
	argument: { param:"param", bar:"bar" }
};

<!-- Async Call the server to update the current slide number -->
var handleSetSuccess = function(o){
	if(o.responseText !== undefined){
		document.getElementById('slide-nav').innerHTML= 'The Global Current Slide Changed';
		currentSlideNo = slideNo;
	}
}

var handleSetFailure = function(o){
	if(o.responseText !== undefined){
		alert('Updating the status failed:'+o.statusText);
	}
}

var callbackSet =
{
	success:handleSetSuccess,
	failure:handleSetFailure,
	argument: { param:"param", bar:"bar" }
};

var callbackResetPr = {
  success: function(o) {
    alert(o.responseText);
  }
}
/**
 * JavaScript for checking or unchecking 
 * all the students or all students in a group.
 *
 * @param toggle Check All/None
 * @param start the first checkbox to be changed
 * @param end the last checkbox to be changed
 * return boolean
 **/
function block_quickmail_toggle(toggle, start, end) {
    // Element ID
    var id = 'mailto'+start;

    // iterate through all of the appropriate checkboxes and change their state
    while(document.getElementById(id) && start != end) {
        document.getElementById(id).checked = toggle;
        start++;
        id = 'mailto'+start;
    }

    return false;
}