(function () {                                                                 
    var swapper =                                                               
        function (a,L,e) {                                                     
            var r = Math.floor(Math.random()*L);                               
            var x = a[e];                                                       
            a[e] = a[r];                                                       
            a[r] = x;                                                           
        };                                                                     
    Array.prototype.shuffle =                                                   
        function () {                                                           
            var i,L;                                                           
            i = L = this.length;                                               
            while (i--) swapper(this,L,i);                                     
        };                                                                     
})();

var slidecount=0;
var useslidearray=0;

function loadXMLDoc(dname) 
{
	var xmlDoc;
	window.i=0;
	if (window.XMLHttpRequest)
  	{
  	xmlDoc=new window.XMLHttpRequest();
  	xmlDoc.open("GET",dname,false);
  	xmlDoc.send("");
  	return xmlDoc.responseXML;
  	}
// IE 5 and IE 6
	else if (ActiveXObject("Microsoft.XMLDOM"))
  	{
  	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  	xmlDoc.async=false;
  	xmlDoc.load(dname);
  	return xmlDoc;
  	}
	alert("Error loading document");
	return null;
}






function nextxmlslide(where)
{
	
	nodenum=window.slideshoworder[window.i];
	
	
	
	if (window.i<window.x.length-1)
  	{
  	window.i++;
  	}else{
	window.i=0;
	}
	
	//document.getElementById('d3').innerHTML=where +" "+ nodenum;
	nodenum=window.slideshoworder[window.i];
	
	b = slideshoworder.join("");
	c=window.i;
	d=nodenum;

	//document.getElementById('d3').innerHTML=b +" WIN I "+c+" NODE NUM "+d;
	 display(where, nodenum);
}

function getxml(dname,myroot){
	
  window.xmlDoc=loadXMLDoc(dname);	
  window.x=xmlDoc.getElementsByTagName(myroot);

	
  display();
  displaythumbs();
}


function artarray(dname,myroot){
	window.xmlDoc=loadXMLDoc(dname);	
    window.x=xmlDoc.getElementsByTagName(myroot);
	
    window.info=xmlDoc.getElementsByTagName('instructor');
	
	
	window.slideshoworder = new Array();
	for(i=0;i<window.x.length;i++){
		slideshoworder[i]=i;
	}
	slideshoworder.shuffle();

}
function getxmlone(dname,myroot,where,mynodenum){


    nodenum=window.slideshoworder[mynodenum];
	
	if (window.i<window.x.length-1)
  	{
  	window.i++;
  	}else{
	window.i=0;
	}

  display(where,nodenum);  
  slidecount++;

}

function displaythumbs(){
	
	thumbnames="";
    for(t=0;t<window.x.length;t++){
		thumbpic=(window.x[t].getElementsByTagName("THUMB")[0].childNodes[0].nodeValue);
		thumbimage="<img src='"+thumbpic+"' align=bottom/>";
		thumbnames+=" "+thumbimage;
		
	}
	document.getElementById("thumb").innerHTML=thumbnames;
	
}

function display(where,nodenum)
{
	//window.i=nodenum;
	mytest=window.x.length+" O";
 	
	/*series=(window.x[window.i].getElementsByTagName("SERIES")[0].childNodes[0].nodeValue);
	where=(window.x[window.i].getElementsByTagName("LOCATION")[0].childNodes[0].nodeValue);
	about=(window.x[window.i].getElementsByTagName("ABOUT")[0].childNodes[0].nodeValue);
	*/
	pic=(window.x[nodenum].getElementsByTagName("PIC")[0].childNodes[0].nodeValue);
	//document.getElementById("copy").innerHTML="<span class='title'>"+title+"</span><br/>"+series+"<br/>"+about;
	document.getElementById(where).innerHTML="<img src='"+pic+"' align=left/>"
	



}