// JavaScript Document

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_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 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_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}

function SlideShow(slideList, image, speed, name)          
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = -1;
  this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(image, slideList[current]);
    clearTimeout(timer);
	timer = setTimeout(name+'.play()', speed);
  }
}



function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

var elders = ['images/graphic/elders_physical_space01.jpg', 'images/graphic/elders_physical_space02.jpg', 'images/graphic/elders_table_map01.jpg', 'images/graphic/elders_table_map02.jpg'];
var eldersShow = new SlideShow(elders, 'slide1', 3000, "eldersShow");

var babel = ['images/graphic/bookpage02.jpg', 'images/graphic/bookpage03.jpg', 'images/graphic/bookpage04.jpg'];
var babelShow = new SlideShow(babel, 'slide2', 3000, "babelShow");

var wejay = ['images/graphic/wejay01.jpg','images/graphic/wejay02.jpg', 'images/graphic/wejay03.jpg', 'images/graphic/wejay04.jpg', 'images/graphic/wejay05.jpg'];
var wejayShow = new SlideShow(wejay, 'slide3', 3000, "wejayShow");

var macphersons = ['images/multimedia/macphersons01.jpg','images/multimedia/macphersons02.jpg', 'images/multimedia/macphersons03.jpg', 'images/multimedia/macphersons04.jpg', 'images/multimedia/macphersons05.jpg'];
var macphersonsShow = new SlideShow(macphersons, 'slide4', 3000, "macphersonsShow");

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}

function resetContentLinks(){
	var rightDivContent = document.getElementById('rightDivContent');
	for(i in rightDivContent.children){
		var elem = rightDivContent.children[i];
		if(elem.nodeName == "P"){
		 	elem.children[2].children[0].style.fontWeight='normal';
		}
	}
}
function loadSection(){
	var section = document.location.hash;
	if(section != undefined){
		section = section.substr(1);
		var span = document.getElementById(section);
		if(span.nodeName = "SPAN"){
			var atag = span.parentNode;
			if(atag != undefined && atag.onclick != undefined){
				atag.onclick();
			}
		}
	}
}