function init() {
	
			
	var tempStr = navigator.userAgent.toLowerCase();
	//degrade ajax for opera, safari, and ie 5.x
	if (window.opera || (tempStr.indexOf("applewebkit/"))!=-1 || (document.getElementByID && document.all)) {
		var browserDetect=true 
		}else{
		var browserDetect=false
		}

	if(!browserDetect) {
		var oXmlDom = zXmlDom.createDocument();
		oXmlDom.onreadystatechange = function () {
			if (oXmlDom.readyState == 4) {
				if (oXmlDom.parseError.errorCode == 0) {
					parsePhotoInfo(oXmlDom);
				} else {
/*					var str = "An error occurred!!\n" +
						"Description: " + oXmlDom.parseError.reason + "\n" +
						"File: " + oXmlDom.parseError.url + "\n" +
						"Line: " + oXmlDom.parseError.line + "\n" +
						"Line Position: " + oXmlDom.parseError.linepos + "\n" +
						"Source Code: " + oXmlDom.parseError.srcText;
					alert(str);*/
				}
			}
		}
    //oXmlDom.load("photos.html");
	oXmlDom.load("photos.xml");
	//oXmlDom.load("photo_gallery.php");
	}
}

var intGroup=1

function parsePhotoInfo(oXmlDom) {
	 document.getElementById('noscriptPhotos').className='hide';
	var oRoot = oXmlDom.documentElement;
    var oFragment = document.createDocumentFragment();
    var arrXMLPhotos = oRoot.getElementsByTagName("a");

	var aPrevious = document.createElement("a");
	aPrevious.setAttribute("href","#imageGroup");
	aPrevious.setAttribute("title","View Previous Group of Thumbnails");
	aPrevious.setAttribute("id","previous");
	//aPrevious.setAttribute("onClick","slide('previous')");
	oFragment.appendChild(aPrevious);
	
	var imgPrevious = document.createElement("img");
	imgPrevious.setAttribute("src", "_images/arrow_slider_left.gif");
	imgPrevious.setAttribute("alt","Previous Images");
	imgPrevious.setAttribute("width", "24");
	imgPrevious.setAttribute("height", "25");
	aPrevious.appendChild(imgPrevious);
	
	
	var divContainer = document.createElement("div");
	divContainer.setAttribute("id","divContainer");
	oFragment.appendChild(divContainer);
	
			for (var i4 =0; i4 < arrXMLPhotos.length;i4++) {

			var sHref= arrXMLPhotos[i4].getAttribute("href");
			var sRel= arrXMLPhotos[i4].getAttribute("rel");
			var sTitle= arrXMLPhotos[i4].getAttribute("title");
	
				for (var i2=0;i2 < arrXMLPhotos[i4].childNodes.length; i2++) {
					if (arrXMLPhotos[i4].childNodes[i2].tagName=="img") {
					var sSrc = arrXMLPhotos[i4].childNodes[i2].getAttribute("src");
					var sWidth = arrXMLPhotos[i4].childNodes[i2].getAttribute("width");
					var sHeight = arrXMLPhotos[i4].childNodes[i2].getAttribute("height");
					var sAlt = arrXMLPhotos[i4].childNodes[i2].getAttribute("alt");
					
					var aLink = document.createElement("a");
					aLink.setAttribute("href",sHref);
					aLink.setAttribute("rel",sRel);
					aLink.setAttribute("title",sTitle);
					aLink.setAttribute("id","link_"+i4);
					divContainer.appendChild(aLink);

					var imgThumbnail = document.createElement("img");
					imgThumbnail.setAttribute("src", sSrc);
					imgThumbnail.setAttribute("width", sWidth);
					imgThumbnail.setAttribute("height", sHeight);
					imgThumbnail.setAttribute("alt", sAlt);
					aLink.appendChild(imgThumbnail);
					}
				}
			}
	
	var aNext = document.createElement("a");
	aNext.setAttribute("href","#imageGroup");
	aNext.setAttribute("title","View Next Group of Thumbnails");
	aNext.setAttribute("id","next");
	//aNext.setAttribute("onClick","slide('next')");
	oFragment.appendChild(aNext);
	
	var imgNext = document.createElement("img");
	imgNext.setAttribute("src", "_images/arrow_slider_right.gif");
	imgNext.setAttribute("alt","Next Images");
	imgNext.setAttribute("width", "24");
	imgNext.setAttribute("height", "25");
	aNext.appendChild(imgNext);
	
	document.getElementById('imageGroup').appendChild(oFragment);

	document.getElementById('next').onclick=slide;
	document.getElementById('previous').onclick=slide;

//show first six by default
	var intPhoto = intGroup*9;
	var intStart = intPhoto-9;

	var arrLinks = document.getElementById('divContainer').getElementsByTagName("a");

	for (var i7=0; i7<arrLinks.length;i7++) {
		if (i7 >=intStart && i7 <intPhoto) {
			arrLinks[i7].className="show";
		}else{
			arrLinks[i7].className="hide";
		}
		
	}
	 
//make sure everything is loaded up before initiating the lightbox
	if (window.onload) {
		initLightbox();
	}
}

function slide() {
	var arrLinks = document.getElementById('divContainer').getElementsByTagName("a");	
	if (this.id=="previous" && intGroup>1) {
		intGroup=intGroup-1;
	}else if (this.id=="previous" && intGroup==1) {
		intGroup=arrLinks.length/9;	
	}else if (this.id=="next" && intGroup <arrLinks.length/9) {
		intGroup=intGroup+1;
	}else{
		intGroup=1;
	}
	
	var intPhoto = intGroup*9;
	var intStart = intPhoto-9;

	//set everything back to hide
	
	for (var i6=0; i6<arrLinks.length;i6++) {
		if (i6 >=intStart && i6 <intPhoto) {
			arrLinks[i6].className="show";
			
		}else{
			arrLinks[i6].className="hide";
		}
	}
}


function initFaculty() {
	var tempStr = navigator.userAgent.toLowerCase();

	//degrade ajax for opera, safari, and ie 5.x
	if (window.opera || (tempStr.indexOf("applewebkit/"))!=-1 || (document.getElementByID && document.all)) {
		var browserDetect=true 
		}else{
		var browserDetect=false
		}

	if(!browserDetect) {
		var oXmlFacultyDom = zXmlDom.createDocument();
		oXmlFacultyDom.onreadystatechange = function () {
			if (oXmlFacultyDom.readyState == 4) {
				if (oXmlFacultyDom.parseError.errorCode == 0) {
					parseFacultyInfo(oXmlFacultyDom);
				} else {
/*					var str = "An error occurred!!\n" +
						"Description: " + oXmlFacultyDom.parseError.reason + "\n" +
						"File: " + oXmlFacultyDom.parseError.url + "\n" +
						"Line: " + oXmlFacultyDom.parseError.line + "\n" +
						"Line Position: " + oXmlFacultyDom.parseError.linepos + "\n" +
						"Source Code: " + oXmlFacultyDom.parseError.srcText;
					alert(str);*/
				}
			}
		}
	oXmlFacultyDom.load("faculty_profiles.xml");
	}
}

function parseFacultyInfo(oXmlFacultyDom) {
    document.getElementById('noscriptFaculty').className='hide';
	var oRoot = oXmlFacultyDom.documentElement;
    var oFragment = document.createDocumentFragment();
    var arrXMLFaculty = oRoot.getElementsByTagName("div");	
	
	    for (var i8 = 0; i8 < arrXMLFaculty.length; i8++) {
	    var h2Title, h3Title, sParagraph, sSrc,sHref;
        
        var oCurrentChild = arrXMLFaculty[i8].firstChild;

        do {
				switch (oCurrentChild.tagName) {
					case "h3":
						sName = oCurrentChild.text;
					break;
					case "p":
						sParagraph = oCurrentChild.text;
					break;
					case "img":
						sSrc = oCurrentChild.getAttribute("src");
						sAlt = oCurrentChild.getAttribute("alt");
					break;
					case "a":
						sHref = oCurrentChild.getAttribute("href");
					break;
					default:
					break;
					} 
        	} while (oCurrentChild = oCurrentChild.nextSibling);


		var divContainer = document.createElement("div");
		oFragment.appendChild(divContainer);
	
		var imgPhoto = document.createElement("img");
		imgPhoto.setAttribute("src", sSrc);
		imgPhoto.setAttribute("alt", sAlt);
		imgPhoto.setAttribute("width","107");
		imgPhoto.setAttribute("height","98");
		divContainer.appendChild(imgPhoto);
		
		var h3Name = document.createElement("h3");
		h3Name.appendChild(document.createTextNode(sName));
		divContainer.appendChild(h3Name);
		
		var pDescription = document.createElement("p");
		pDescription.appendChild(document.createTextNode(sParagraph));
		divContainer.appendChild(pDescription);
		
		var pLink = document.createElement("p");
		divContainer.appendChild(pLink);
		
		var aLink = document.createElement("a");
		aLink.setAttribute("href", sHref);
		aLink.appendChild(document.createTextNode("Learn more about this faculty member..."));
		pLink.appendChild(aLink);
		
		}

		var ulList = document.createElement("ul");
		aLink.setAttribute("id", "faculty_more");
		oFragment.appendChild(ulList);

		var liFirst = document.createElement("li");
		ulList.appendChild(liFirst);
	
		var liSecond = document.createElement("li");
		ulList.appendChild(liSecond);

		var aNext= document.createElement("a");
		aNext.setAttribute("href", "#faculty_container");
		aNext.setAttribute("id", "faculty_next");
		aNext.appendChild(document.createTextNode("View next Profile"));
		liFirst.appendChild(aNext);
		
		var aViewAll= document.createElement("a");
		aViewAll.setAttribute("href", "faculty_list.php");
		aViewAll.appendChild(document.createTextNode("View all Profiles"));
		liSecond.appendChild(aViewAll);

		document.getElementById('faculty_slider').appendChild(oFragment);
		
		
		var arrDivs = document.getElementById('faculty_slider').getElementsByTagName("div");
		//hide divs onload except for first one
		for (var i9=0; i9<arrDivs.length;i9++) {
			if (i9==0) {
				arrDivs[i9].className="show";
			}else{
				arrDivs[i9].className="hide";
			}
		}
		document.getElementById('faculty_next').onclick=slideFaculty;
		
}

var intShow=0;

function slideFaculty() {
	var arrDivs = document.getElementById('faculty_slider').getElementsByTagName("div");	
	
	if (intShow<arrDivs.length-1) {
		intShow=intShow+1;
	}else{
		intShow=0;
	}

	for (var i10=0; i10<arrDivs.length;i10++) {
		if (i10==intShow) {			
			arrDivs[i10].className="show"
		}else{
			arrDivs[i10].className="hide"	
		}
	}
}

/* start facts */

function initFacts() { 
	var tempStr = navigator.userAgent.toLowerCase();

	//degrade ajax for opera, safari, and ie 5.x
	if (window.opera || (tempStr.indexOf("applewebkit/"))!=-1 || (document.getElementByID && document.all)) {
		var browserDetect=true 
		}else{
		var browserDetect=false
		}

	if(!browserDetect) {
		var oXmlFactsDom = zXmlDom.createDocument();
		oXmlFactsDom.onreadystatechange = function () {
			if (oXmlFactsDom.readyState == 4) {
				if (oXmlFactsDom.parseError.errorCode == 0) {
					parseFactsInfo(oXmlFactsDom);
				} else {
/*					var str = "An error occurred!!\n" +
						"Description: " + oXmlFactsDom.parseError.reason + "\n" +
						"File: " + oXmlFactsDom.parseError.url + "\n" +
						"Line: " + oXmlFactsDom.parseError.line + "\n" +
						"Line Position: " + oXmlFactsDom.parseError.linepos + "\n" +
						"Source Code: " + oXmlFactsDom.parseError.srcText;
					alert(str);*/
				}
			}
		}
	oXmlFactsDom.load("funfacts.xml");
	}
}

function parseFactsInfo(oXmlFactsDom) {
	if (document.getElementById('facts')) {
		document.getElementById('noscriptFacts').className='hide';
		var oRoot = oXmlFactsDom.documentElement;
		var oFragment = document.createDocumentFragment();
		var arrXMLFacts = oRoot.getElementsByTagName("p");	
		
			for (var i11 = 0; i11 < arrXMLFacts.length; i11++) {
			
				var oCurrentChild = arrXMLFacts[i11].text;
		
				var pContainer = document.createElement("p");
				pContainer.appendChild(document.createTextNode(oCurrentChild));
				oFragment.appendChild(pContainer);	
			
			}
	
		var ulList = document.createElement("ul");
			ulList.setAttribute("id", "facts_more");
			oFragment.appendChild(ulList);
	
			var liFirst = document.createElement("li");
			ulList.appendChild(liFirst);
		
			var liSecond = document.createElement("li");
			ulList.appendChild(liSecond);
	
			var aNext= document.createElement("a");
			aNext.setAttribute("href", "#facts_container");
			aNext.setAttribute("id", "facts_next");
			aNext.appendChild(document.createTextNode("View next MSU Fact"));
			liFirst.appendChild(aNext);
			
			var aViewAll= document.createElement("a");
			aViewAll.setAttribute("href", "funfacts.php");
			aViewAll.appendChild(document.createTextNode("View more MSU Facts"));
			liSecond.appendChild(aViewAll);
	
			document.getElementById('facts_slider').appendChild(oFragment);
			
			
			var arrPs = document.getElementById('facts_slider').getElementsByTagName("p");
			//hide divs onload except for first one
			for (var i12=0; i12<arrPs.length;i12++) {
				if (i12==0) {
					arrPs[i12].className="show";
				}else{
					arrPs[i12].className="hide";
				}
			}
			document.getElementById('facts_next').onclick=slideFacts;
	}
}


function slideFacts() {
	var arrPs = document.getElementById('facts_slider').getElementsByTagName("p");	
	
	if (intShow<arrPs.length-1) {
		intShow=intShow+1;
	}else{
		intShow=0;
	}

	for (var i13=0; i13<arrPs.length;i13++) {
		if (i13==intShow) {			
			arrPs[i13].className="show"
		}else{
			arrPs[i13].className="hide"	
		}
	}
}





