
// All JS in the hompage is found here.

var slidespeed=3000

//specify images
var slideimages=new Array("images/mp4a.jpg","images/mp1a.jpg","images/mp2a.jpg","images/mp3a.jpg")

//specify corresponding links
var slidelinks=new Array("researchmag.htm","researchmag.htm","researchmag.htm","http://www.uncg.edu/ure/campusweekly/")

var newwindow=0 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
var whichlink=0
var whichimage=0
var blenddelay=(ie)? document.images.slide.filters[0].duration*950 : 0

for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
	window.open(slidelinks[whichlink])
else
	window.location=slidelinks[whichlink]
}



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_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 slideit(){	
	if (!document.images) return
	if (ie) document.images.slide.filters[0].apply()
		document.images.slide.src=imageholder[whichimage].src
	if (ie) document.images.slide.filters[0].play()
		whichlink=whichimage
		whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
		setTimeout("slideit()",slidespeed+blenddelay)
}
	
// function copied from the droplist.js file added to all pages by the UNCG Wrapper
// slideit needs to be called after the page is loaded.  By adding the script below we can insert a call to the slideit
// function. The UNCG Campus Links DD will continue to work as well as the picure rotation for the home page.
// This file is added after droplist.js on the home page so we are essentially overriding the function and onload command.
	
startList = function() {  	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("uncgBlueNavDrop");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
	slideit();
}

// fires the body onload command without having to modify the HTML used on the home page.
window.onload=startList;

