<!--
/*
	Who'sWho? - publications / employee renderer v1.0, by Martin Latter (2004) ~ http://www.copysense.co.uk/
	This application was developed for an intranet system - quickness in sorting, not data security.
	Thanks to Alex Vincent for the function cleanWhiteSpace() - for Gecko browsers.
	innerHTML used for fast rendering speed with big lumps of data (see http://www.quirksmode.org/).

	This application is licensed under the Creative Commons License Attribution 2.0 License (http://creativecommons.org/licenses/by/2.0/) - basically it means you are free to enhance this code to meet your needs but please credit me as the original author; and for any reuse or distribution you need to make clear to others the license terms.
*/


var xmlFile = "publications.xml";
var xmlFile2 = "people.xml";
var xmlFile3 = "partnerdocs.xml";
var imgDir = "images/";  // directory path for images
var largeScreenEnabled = false;  // make this value true for a large amount of data and users on a screen resolution > 1024x768 



/* ************************************************** */

var publicationArr = new Array();
var personArr = new Array();
var partnerDocArr = new Array();
var res = 1;
var largeScreen = (largeScreenEnabled && screen.availHeight > 780)? 1 : 0;


// LOADING PUBLICATIONS

function browserDetect(){
	if(navigator.vendor == 'Apple Computer, Inc.')
		window.location.href='index_error.html';
	else init();

}

function Warning()
{
	os= '<p align="center">Unfortunately, the XML data cannot be displayed on your browser.  We are currently working on fixing this problem.  Until then, please use Mozilla or an IE browser.  OR you may visit our <a href="index_old.html">old homepage</a>.  Sorry for the inconvenience.</p>';
	document.getElementById('slate').innerHTML = os;	
}

function loadXML()
{
	var xmlDoc;

	try
	{
		if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
			xmlDoc.onreadystatechange = function() { if (xmlDoc.readyState==4) grabPublicationsData(xmlDoc, 0); }
			xmlDoc.load(xmlFile);
		}

		else if (window.XMLHttpRequest)
		{
			xmlDoc = document.implementation.createDocument('','doc',null);
			xmlDoc.onload = function() { grabPublicationsData(xmlDoc, 1); }
			xmlDoc.load(xmlFile);
		}

		else alert('Sorry, this browser is not XML-compliant and cannot render the XML data.');
	}

	catch(e)
	{
		alert ('There was an error (' + e + ') attempting to load the XML document');
	}
}

function grabPublicationsData(xmldoc, f)
{
	var i = 0;
	var publications = xmldoc.getElementsByTagName('documents')[0];

	if (f) cleanWhiteSpace(publications);
	// Alex Vincent's cleanWhiteSpace function is a slow method (other methods are twice+ as fast), but it's neat and highly suitable in situations like this where users may want to alter the XML nodes being parsed.

	var pubTitle = '', author = '', date = '', pubstatus = '', booktitle = '', editors = '', publisher = '', pubtype = '',role = '', pubPDF = '', pubPPT = '', pubURL = '';
	var numPublications = publications.childNodes.length;

	for (; i < numPublications; i++)
	{
		pubTitle = publications.childNodes[i].childNodes[0].firstChild.nodeValue;
		author = publications.childNodes[i].childNodes[1].firstChild.nodeValue;
		date = publications.childNodes[i].childNodes[2].firstChild.nodeValue;
		pubstatus = publications.childNodes[i].childNodes[3].firstChild.nodeValue;
		booktitle = publications.childNodes[i].childNodes[4].firstChild.nodeValue;
		editors = publications.childNodes[i].childNodes[5].firstChild.nodeValue;
		publisher = publications.childNodes[i].childNodes[6].firstChild.nodeValue;
		pubtype = publications.childNodes[i].childNodes[7].firstChild.nodeValue;
		role = publications.childNodes[i].childNodes[8].firstChild.nodeValue;
		pubPDF = publications.childNodes[i].childNodes[9].firstChild.nodeValue;
		pubPPT = publications.childNodes[i].childNodes[10].firstChild.nodeValue;
		pubURL = publications.childNodes[i].childNodes[11].firstChild.nodeValue;
		
		
		publicationArr[i] = new publication(pubTitle, date, pubstatus, booktitle, editors, author, publisher, pubtype, role, pubPDF, pubPPT, pubURL);
		
	}
}

function publication(pubTitle, date, pubstatus, booktitle, editors, author, publisher, pubtype, role, pubPDF, pubPPT, pubURL)
{
	this.pubTitle = pubTitle;
	this.date = date;
	this.pubstatus = pubstatus;
	this.booktitle = booktitle;
	this.editors = editors;
	this.author = author;
	this.role = role;
	this.publisher = publisher;
	this.pubtype = pubtype;
	this.pubPDF = pubPDF;
	this.pubPPT = pubPPT;
	this.pubURL = pubURL;

}

//END LOADING PUBLICATIONS
//START LOADING PEOPLE

function loadXML2()
{
	var xmlDoc2;

	try
	{
		if (window.ActiveXObject)
		{
			xmlDoc2 = new ActiveXObject('Microsoft.XMLDOM');
			xmlDoc2.onreadystatechange = function() { if (xmlDoc2.readyState==4) grabPeopleData(xmlDoc2, 0); }
			xmlDoc2.load(xmlFile2);
		}
		else if (window.XMLHttpRequest)
		//else if (document.implementation && document.implementation.createDocument)
		{
			xmlDoc2 = document.implementation.createDocument('','doc',null);
			xmlDoc2.onload = function() { grabPeopleData(xmlDoc2, 1); }
			xmlDoc2.load(xmlFile2);
		}

		else alert('Sorry, this browser is not XML-compliant and cannot render the XML data.');
	}

	catch(e)
	{
		alert ('There was an error (' + e + ') attempting to load the XML document');
	}
}

function grabPeopleData(xmldoc2, f)
{
	var i = 0;
	var people = xmldoc2.getElementsByTagName('people')[0];

	if (f) cleanWhiteSpace(people);

	var firstName = '', lastName = '', position = '', dept = '', school = '', email = '';
	var numPeople = people.childNodes.length;

	for (; i < numPeople; i++)
	{
		firstName = people.childNodes[i].childNodes[0].firstChild.nodeValue;
		lastName = people.childNodes[i].childNodes[1].firstChild.nodeValue;
		position = people.childNodes[i].childNodes[2].firstChild.nodeValue;
		dept = people.childNodes[i].childNodes[3].firstChild.nodeValue;
		school = people.childNodes[i].childNodes[4].firstChild.nodeValue;
		email = people.childNodes[i].childNodes[5].firstChild.nodeValue;

		personArr[i] = new person(firstName, lastName, position, dept, school, email);
	}
}

function person(firstName, lastName, position, dept, school, email)
{
	this.firstName = firstName;
	this.lastName = lastName;
	this.position = position;
	this.dept = dept;
	this.school = school;
	this.email = email;
}
//END LOADING PEOPLE
//START LOADING PARTNER DOCS
function loadXML3()
{
	var xmlDoc3;

	try
	{
		if (window.ActiveXObject)
		{
			xmlDoc3 = new ActiveXObject('Microsoft.XMLDOM');
			xmlDoc3.onreadystatechange = function() { if (xmlDoc3.readyState==4) grabPartnerData(xmlDoc3, 0); }
			xmlDoc3.load(xmlFile3);
		}
		else if (window.XMLHttpRequest)
		//else if (document.implementation && document.implementation.createDocument)
		{
			xmlDoc3 = document.implementation.createDocument('','doc',null);
			xmlDoc3.onload = function() { grabPartnerData(xmlDoc3, 1); }
			xmlDoc3.load(xmlFile3);
		}

		else alert('Sorry, this browser is not XML-compliant and cannot render the XML data.');
	}

	catch(e)
	{
		alert ('There was an error (' + e + ') attempting to load the XML document');
	}
}

function grabPartnerData(xmlDoc3, f)
{
	
	var i = 0;
	var partnerDocs = xmlDoc3.getElementsByTagName('partnerdocs')[0];
	
	if (f) cleanWhiteSpace(partnerDocs);
	

	var title = '', description = '', lastModified = '', convertedModified = '', DLtype1 = '', DLtype2 = '', techDoc = '';
	var numpartnerDocs = partnerDocs.childNodes.length;
	
	for (; i < numpartnerDocs; i++)
	{
		title = partnerDocs.childNodes[i].childNodes[0].firstChild.nodeValue;
		description = partnerDocs.childNodes[i].childNodes[1].firstChild.nodeValue;
		lastModified = partnerDocs.childNodes[i].childNodes[2].firstChild.nodeValue;
		convertedModified = partnerDocs.childNodes[i].childNodes[3].firstChild.nodeValue;
		DLtype1 = partnerDocs.childNodes[i].childNodes[4].firstChild.nodeValue;
		DLtype2 = partnerDocs.childNodes[i].childNodes[5].firstChild.nodeValue;
		techDoc = partnerDocs.childNodes[i].childNodes[6].firstChild.nodeValue;

		partnerDocArr[i] = new partnerDoc(title, description, lastModified, convertedModified, DLtype1, DLtype2, techDoc);
	}
}

function partnerDoc(title, description, lastModified, convertedModified, DLtype1, DLtype2, techDoc)
{
	this.title = title;
	this.description = description;
	this.lastModified = lastModified;
	this.convertedModified = convertedModified;
	this.DLtype1 = DLtype1;
	this.DLtype2 = DLtype2;
	this.techDoc = techDoc;
}
//END LOADING PARTNERDOCS


function cleanWhiteSpace(node)
{
	// function by Alex Vincent

	var notWS = /\S/;
	var cN, i;

	for (i=0; i< node.childNodes.length; i++)
	{
		cN=node.childNodes[i];

		if ((cN.nodeType == 3) && (!notWS.test(cN.nodeValue)))
		{
			node.removeChild(node.childNodes[i]);
			i--;
		}

		if (cN.nodeType == 1) cleanWhiteSpace(cN);
	}
}

function sortit(n)
{
	switch (n)
	{
		case 1:
			publicationArr.sort(sortPubTitleUp);
			displayPublications(0);
			break;

		case 2:
			publicationArr.sort(sortPubTitleDown);
			displayPublications(0);
			break;

		case 3:
			publicationArr.sort(sortDate);
			displayPublications(0);
			break;
			
		case 4:
			publicationArr.sort(sortDateUp);
			displayPublications(0);
			break;
		
		case 6:
			publicationArr.sort(sortPubtype);
			displayPublications(1);
			break;
		case 7:
			personArr.sort(sortPersonPosition);
			displayPeople(1);
			break;
		case 8:
			personArr.sort(sortLastName);
			displayPeople(1);
			break;
		case 9:
			partnerDocArr.sort(sortPartnerAZ);
			displaypartnerDocs(1);
			break;
		case 10:
			partnerDocArr.sort(sortPartnerZA);
			displaypartnerDocs(1);
			break;
		case 11:
			partnerDocArr.sort(sortPartnerDateUp);
			displaypartnerDocs(1);
			break;
		case 12:
			partnerDocArr.sort(sortPartnerDateDown);
			displaypartnerDocs(1);
			break;
	}
}

function sortPubTitleUp(a,b)
{
	var x = a.pubTitle.toLowerCase();
	var y = b.pubTitle.toLowerCase();
	if (y < x) return 1;
	else if (y > x) return -1;
	else return 0;
}

function sortPubTitleDown(a,b)
{
	var x = a.pubTitle.toLowerCase();
	var y = b.pubTitle.toLowerCase();
	if (x > y) return -1;
	else if (x < y) return 1;
	else return 0;
}


function sortPersonPosition(a,b)
{
	

	var x = a.hiddenPosSort.toLowerCase();
	var y = b.hiddenPosSort.toLowerCase();

	if (x < y) return -1;
	else if (x > y) return 1;
	else return 0;
	
	if (x2 < y2) return -1;
	else if (x2 > y2) return 1;
	else return 0;
}

function sortLastName(a,b)
{
	

	var x = a.lastName.toLowerCase();
	var y = b.lastName.toLowerCase();

	if (x < y) return -1;
	else if (x > y) return 1;
	else return 0;

}


function sortDate(a, b) 
{	
	var x = a.date.toLowerCase();
	var y = b.date.toLowerCase();
	
	j = x.toString();
	o = y.toString();
	
	if (j < o) return -1;
	else if (j > o) return 1;
	else return 0;
}

function sortDateUp(a, b) 
{	
	var x = a.date.toLowerCase();
	var y = b.date.toLowerCase();
	
	j = x.toString();
	o = y.toString();
	
	if (j > o) return -1;
	else if (j < o) return 1;
	else return 0;
}

function sortPartnerAZ(a, b) 
{	
	var x = a.title.toLowerCase();
	var y = b.title.toLowerCase();
	
	if (x < y) return -1;
	else if (x > y) return 1;
	else return 0;
}

function sortPartnerZA(a, b) 
{	
	var x = a.title.toLowerCase();
	var y = b.title.toLowerCase();
	
	if (x > y) return -1;
	else if (x < y) return 1;
	else return 0;
}
function sortPartnerDateDown(a, b) 
{	
	var x = a.convertedModified.toLowerCase();
	var y = b.convertedModified.toLowerCase();
	
	j = x.toString();
	o = y.toString();
	
	if (j < o) return -1;
	else if (j > o) return 1;
	else return 0;
}

function sortPartnerDateUp(a, b) 
{	
	var x = a.convertedModified.toLowerCase();
	var y = b.convertedModified.toLowerCase();
	
	j = x.toString();
	o = y.toString();
	
	if (j > o) return -1;
	else if (j < o) return 1;
	else return 0;
}
	


function displayPublications(n)
{
	var numPublications = publicationArr.length;
	var i = 0;
	var j = 0;
	var k = 0;
	var l = 0;
	var os = '<div class="pubTitleTop">Scholarly Product Titles</div><hr>';
	var temp = ''
	
	os += '<b>Research Papers</b>';
	for (; i< numPublications;i++)
	{
	/*	
	if (n)
		{
			if (publicationArr[i].pubtypeSort != temp) os += '<div class="spacertop"><strong>' + publicationArr[i].pubtype + 's<\/strong></div><div class="spacerbot"><\/div>';
			temp = publicationArr[i].pubtypeSort;
			
		}
	*/
	if(publicationArr[i].pubtype == 'Research Paper'){
		os += '<a href="javascript:publicationDisplay('+i+')" class="publicationlink"> -' + publicationArr[i].pubTitle + ' <\/a><font size="-2">Year: '+ publicationArr[i].date +'</font><br>';
		os+= '<font size="-2">Publication Type: '+ publicationArr[i].pubtype +'</font><p>';
		}
	}
	os += '<\/p><p>';
	
	os += '<b>Book Chapters</b>';
	for (; j< numPublications;j++)
	{
		if(publicationArr[j].pubtype == 'Book Chapter'){
		os += '<a href="javascript:publicationDisplay('+j+')" class="publicationlink"> -' + publicationArr[j].pubTitle + ' <\/a><font size="-2">Year: '+ publicationArr[j].date +'</font><br>';
		os+= '<font size="-2">Publication Type: '+ publicationArr[j].pubtype +'</font><p>';
		}
	}
	os += '<\/p><p>';
	
	os += '<b>Grant Proposals</b>';
	for (; k< numPublications;k++)
	{
		if(publicationArr[k].pubtype == 'Grant Proposal'){
		os += '<a href="javascript:publicationDisplay('+k+')" class="publicationlink"> -' + publicationArr[k].pubTitle + ' <\/a><font size="-2">Year: '+ publicationArr[k].date +'</font><br>';
		os+= '<font size="-2">Publication Type: '+ publicationArr[k].pubtype +'</font><p>';
		}
	}
	os += '<\/p><p>';
	
	os += '<b>Presentations</b>';
	for (; l< numPublications;l++)
	{
		if(publicationArr[l].pubtype == 'Presentation'){
		os += '<a href="javascript:publicationDisplay('+l+')" class="publicationlink"> -' + publicationArr[l].pubTitle + ' <\/a><font size="-2">Year: '+ publicationArr[l].date +'</font><br>';
		os+= '<font size="-2">Publication Type: '+ publicationArr[l].pubtype +'</font><p>';
		}
	}
	os += '<\/p><p>';
	document.getElementById('indexWin').innerHTML = os;
}

function displayPeople(n)
{
	
	var numPeople = personArr.length;
	var i = 0;
	var j = 0;
	var h = 0;
	var k = 0;
	var os = '<font size=+2 color="#006699">PGIST Research Team</font><p><table width="90% cellpadding="5" cellspacing="5" border="0">';
	var temp = '';
	
	//Display PIs
	os+='<tr>';
	os+='<td width="33%">';
	os+='<b>Principal Investigators</b><p>';
	for (; k < numPeople; k++)
	if(personArr[k].position == 'Director and Principal Investigator')
	{
		os += personArr[k].firstName + ' ' + personArr[k].lastName + '<br>';
		os += personArr[k].dept + '<br>';
		os += personArr[k].school + '<br>';
		os += '<a href="mailto:' + personArr[k].email + '">' +personArr[k].email +'</a><p>';	
	} 
	
	for (; i < numPeople; i++)
	if(personArr[i].position == 'Principal Investigator')
	{
		os += personArr[i].firstName + ' ' + personArr[i].lastName + '<br>';
		os += personArr[i].dept + '<br>';
		os += personArr[i].school + '<br>';
		os += '<a href="mailto:' + personArr[i].email + '">' +personArr[i].email +'</a><p>';	
	} 
	
	os +='</td>';
	//END Display PI
	
	/*
	//Display Consultants
	os+='<td width="33%">';
	os+='<b>Consultants</b><p>';
	for (; j < numPeople; j++)
	if(personArr[j].position == 'Consultant')
	{
		os += personArr[j].firstName + ' ' + personArr[j].lastName + '<br>';
		os += personArr[j].dept + '<br>';
		os += personArr[j].school + '<br>';
		os += '<a href="mailto:' + personArr[j].email + '">' +personArr[j].email +'</a><p>';	
	} 
	
	os +='</td>';
	//End Display Consultants
	*/
	
	//Display RAs
	os+='<td width="33%">';
	os+='<b>Research Assistants</b><p>';
	for (; h < numPeople; h++)
	if(personArr[h].position != 'Principal Investigator')
	{
		os += personArr[h].firstName + ' ' + personArr[h].lastName + '<br>';
		if(personArr[h].position != 'Research Assistant'){
		os += personArr[h].position + '<br>';
		}
		os += personArr[h].dept + '<br>';
		os += personArr[h].school + '<br>';
		os += '<a href="mailto:' + personArr[h].email + '">' +personArr[h].email +'</a><p>';	
	} 
	
	os +='</td>';
	//END Display RAs
	os+= '</tr></table>';
/*
	else if(personArr[i].position == 'Research Assistant')
	{
		if (n)
		{
			if (personArr[i].position != temp) os += '<strong>' + personArr[i].position + 's<\/strong><p>';
			temp = personArr[i].position;	
		}
		

		os += personArr[i].firstName + ' ' + personArr[i].lastName + '<br>';
		if (personArr[i].dept != nondept)  os += 'Department of ' + personArr[i].dept + '<br>';
		   else os += personArr[i].dept + '<br>';
		os += personArr[i].school + '<br>';
		os += '<a href="mailto:' + personArr[i].email + '">' +personArr[i].email +'</a><p>';
	}	
*/
document.getElementById('teamslate').innerHTML = os;
}


function displaypartnerDocs(n)
{
	var numpartnerDocs = partnerDocArr.length;
	var i = 0;
	var j = 0;
	var os = '<font size=+2 color="#006699">PGIST Partner Information</font><p><table width="90% border="1">';
	os += 'The following materials provide additional information about the PGIST Project. This page is intended mainly for project partners. Please contact <a href="mailto:kramsey@u.washington.edu">Kevin</a> or <a href="mailto:nyerges@u.washington.edu">Tim</a> with any questions.';
	os += '<p>';

	
	for (; i < numpartnerDocs; i++)
	if(partnerDocArr[i].techDoc == 'False')
	{
		if(partnerDocArr[i].title != 'NULL') os += '<div class="partnerTitle">' + partnerDocArr[i].title + '</div>';
		if(partnerDocArr[i].description != 'NULL')os +=partnerDocArr[i].description + ' - ';
		if(partnerDocArr[i].lastModified != 'NULL')os += '<i>' + partnerDocArr[i].lastModified + '</i>';
		if (partnerDocArr[i].DLtype1 != 'NULL') os += '<br><a href="./partner/' + partnerDocArr[i].DLtype1 + '" target="_blank">PDF Format <img src="acrobat_icon.gif" border="0"></a>';
		if (partnerDocArr[i].DLtype2 != 'NULL') os += '<a href="./partner/' + partnerDocArr[i].DLtype2 + '" target="_blank">  Word Format <img src="word_icon.gif" border="0"></a><br>';
		os +='<p>';
	} 
	if(partnerDocArr.length == 0){os += "<i>There are no partner documents available at this time.</i>"}
	//os += '<br><hr>';
	//os += '<div class="partnerTitle">Technical documentation for PGIST Information Tracks: (in progress)</div>';
	for (; j < numpartnerDocs; j++)
	if(partnerDocArr[j].techDoc == 'True')
	{
		if(partnerDocArr[j].title != 'NULL') os += '<div class="partnerTechTitle">' + partnerDocArr[j].title + '</div>';
		if(partnerDocArr[j].DLtype1 != 'NULL') os += '<a href="' + partnerDocArr[j].DLtype1 +'">Overview Relationship Diagram</a>; ';
		if(partnerDocArr[j].DLtype2 != 'NULL') os += '<a href="' + partnerDocArr[j].DLtype1 +'">Detail Object Class Diagram</a> (includes object attributes);';
		os +='<p>';
	} 
	//os += '<div class="partnerTechTitle"><a href="http://depts.washington.edu/pgist/team/tracks/datadict.php">Data Dictionary</a></div> (Password Required - email <a href="mailto:kramsey@u.washington.edu">Kevin</a> or <a href="mailto:nyerges@u.washington.edu">Tim</a> for access)<p>';
	os += '<\/p>';
	document.getElementById('partnerslate').innerHTML = os;
}

function publicationDisplay(n)
{
	var os = '--<a href="javascript:backIndexWin()">back</a>--<p>';
	os += '<center><strong>' + publicationArr[n].pubTitle +'<\/strong><p></center>';
	
	if (publicationArr[n].pubtype == 'Presentation')
	{
	
	os += publicationArr[n].author + '.  Presented at the ' + publicationArr[n].publisher + '<br><br>';
	}
	
	else if (publicationArr[n].pubtype == 'Book Chapter')
	{
	os += publicationArr[n].author + ', <u>' + publicationArr[n].pubTitle + '</u>. ' + publicationArr[n].pubstatus + ' in <em>' + publicationArr[n].booktitle + '</em>, '+ publicationArr[n].editors + ' eds. '+ publicationArr[n].publisher + '. ';
	os += '<br><br>';
	}
	else
	{

	os += publicationArr[n].author + '.  ';
	os += publicationArr[n].pubtype + ' submitted in ' + publicationArr[n].date;
		if (publicationArr[n].publisher != 'NULL') os+=  ' to the ' + publicationArr[n].publisher;
	os += '<br><br>';
	}
	
	
	if (publicationArr[n].role != 'NULL') os += '<strong>Abstract: </strong>' + publicationArr[n].role + '<br><br>';
	
	if (publicationArr[n].pubPPT != 'NULL') os += '<center><b><a href="./doc/' + publicationArr[n].pubPPT + '" target="_blank">Download this '+ publicationArr[n].pubtype +' in PPT Format <img src="ppt_icon.gif" border="0"></a></b></center>';
	if (publicationArr[n].pubPDF != 'NULL') os += '<center><b><a href="./doc/' + publicationArr[n].pubPDF + '" target="_blank">Download this '+ publicationArr[n].pubtype +' in PDF Format <img src="acrobat_icon.gif" border="0"></a></b></center><br>';
	
	if (publicationArr[n].pubURL != 'NULL') os += '<center><b>Link: </b><a href="' + publicationArr[n].pubURL + '" target="_blank">File Located on a different server.  Please click here to access this '+ publicationArr[n].pubtype +' <img src="newWindow_icon.png" border="0"></a></center><br>';
	
	
	
	if (publicationArr[n].pubPDF == 'NULL' && publicationArr[n].pubPPT == 'NULL' && publicationArr[n].pubURL == 'NULL') os +='<p><center><font color="#CC0000">This '+ publicationArr[n].pubtype +' can not be downloaded at this time.</font></center></p><br>'
	os += '<\/p>';
	document.getElementById('publicationWin').innerHTML=os;
	
}
/*removed dump all function
function dumppublicationAll(n)
{
	switch (n)
	{
		case 1:
			publicationArr.sort(sortPubTitleUp);
			break;

		case 2:
			publicationArr.sort(sortPubTitleDown);
			break;

		case 3:
			publicationArr.sort(sortDate);
			break;
			
		case 4:
			publicationArr.sort(sortDateUp);
			break;
		case 5:
			publicationArr.sort(sortPubTitleUp);
			break;
		case 6:
			publicationArr.sort(sortPubtype);
			break;
	}

	var i = 0;
	var temp = '';
	var os = '<table width="95%">';
	var numPublications = publicationArr.length;

	for (; i < numPublications; i++)
	{
	os += '--<a href="javascript:backIndexWin()">back</a>--<br>';
	os += '<center><i>Publication Type: '+ publicationArr[i].pubtype +'</i><br></center>';
	os += '<center><strong>' + publicationArr[i].pubTitle +'<\/strong><p></center>';
	
	if (publicationArr[i].pubtype == 'Presentation')
	{
	os += publicationArr[i].author + '.  This presentation was presented in '+ publicationArr[i].date +' at the ' + publicationArr[i].publisher + '<br><br>';
	}
	
	else if (publicationArr[i].pubtype == 'Book Chapter')
	{
	os +=  publicationArr[i].author + ', <u>' + publicationArr[i].pubTitle + '</u>. ' + publicationArr[i].pubstatus + ' in <em>' + publicationArr[i].booktitle + '</em>, '+ publicationArr[i].editors + ' eds. '+ publicationArr[i].publisher + '. ';
	os += '<br><br>';
	}
	else
	{

	os += publicationArr[i].author + '.  ' + publicationArr[i].pubtype + ' submitted in ' + publicationArr[i].date;
		if (publicationArr[i].publisher != 'NULL') os+=  ' to the ' + publicationArr[i].publisher;
	os += '<br><br>';
	}
	
	
	os += '<strong>Abstract: </strong>' + publicationArr[i].role;
	os += '<br><br>';
	if (publicationArr[i].pubPPT != 'NULL') os += '<center><b><a href="../doc/' + publicationArr[i].pubPPT + '" target="_blank">Download this '+ publicationArr[i].pubtype +' in PPT Format</a></b></center>';
	if (publicationArr[i].pubPDF != 'NULL') os += '<center><b><a href="../doc/' + publicationArr[i].pubPDF + '" target="_blank">Download this '+ publicationArr[i].pubtype +' in PDF Format</a></b></center><br>';
	
	
	
	if (publicationArr[i].pubPDF == 'NULL') os +='<p><center><font color="#CC0000">Unfortunately this '+ publicationArr[i].pubtype +' can not be downloaded at this time.</font></center></p><br>'
	os += '<\/p>';
	

	}
	os += '<\/table>';
	document.getElementById('publicationWin').innerHTML = os;
	//document.getElementById('indexWin').style.visibility='hidden';
	//document.getElementById('publicationWin').style.visibility='hidden';
	//document.getElementById('menu').style.visibility='hidden';
	//document.getElementById('returnmenu').style.visibility='visible';
	//document.getElementById('dump').innerHTML=os;
}
*/
function retern()
{
	document.getElementById('indexWin').style.visibility='visible';
	document.getElementById('publicationWin').style.visibility='visible';
	document.getElementById('menu').style.visibility='visible';
	document.getElementById('returnmenu').style.visibility='hidden';
	document.getElementById('dump').innerHTML='';
}

function backIndexWin()
{

	document.getElementById('publicationWin').innerHTML= '<font size=+2 color="#006699">PGIST Scholarly Products</font><p>Welcome to the PGIST Scholarly Products webpage.  These are the current public scholarly  products available from PGIST. </p>';
	document.getElementById('publicationWin').innerHTML += '<p>Please follow the links to the left to view the abstract of the selected scholarly product.  From that page you may then download the document in Adobe PDF or Microsoft Powerpoint (PPT) formats (if available).</p>';
	document.getElementById('publicationWin').innerHTML += '<p>Use the links above to sort the documents by title or date within each publication type.</p>';
	document.getElementById('publicationWin').innerHTML += '<p>If you are a researcher and would like to submit a scholarly product, please <a href="http://depts.washington.edu/pgist/team/publicationsform/form.html">click here</a>.</p>';
}

//function setMainTab(m){
//	for (i=1; i<=4; i++)document.getElementById("m"+i).className = ((m == i)?"tabselected":"tabnormal");
//}



//SLATES START HERE
function slateHome()
{
clickOverview();
//setMainTab(1);
	//os = '<center><a href="PGIST_Programmer_Ad_Poster_Oct_17_2005.pdf"><img src="ad.gif" border="0"></a></center>';
	os = '<font size=+2 color="#006699">PGIST Overview</font><p>';
	os += 'The PGIST project is studying how Geographic Information Systems (GIS) and Internet technologies can improve public participation in transportation decision making.';
	os += '  We are working with regional agencies and stakeholders to develop and evaluate on-line tools for expanding public participation in transportation improvement programming for the central Puget Sound region.';
	os += '  We aim to improve peoples ability to express their views and expand their knowledge, in order to come to a shared understanding about transportation related concerns, and then voice choices about project recommendations.</p>';
	os += '<p><table width="600"  border="0" cellspacing="0" cellpadding="0">';
	os += '<td width="50%" valign="top"><strong>Director: Tim Nyerges, Ph.D. </strong><p>Department of Geography <br>University of Washington <br>Box 353550 <br>Seattle , WA 98195 <br> 206-543-5296 </p><p><a href="mailto:nyerges@u.washington.edu">nyerges@u.washington.edu </a></p></td>';
	os += '<td width="50%" valign="top"><strong>Outreach Coordinator: Kevin Ramsey </strong><p>Department of Geography, Smith Hall 428 <br>University of Washington <br>Box 353550 <br>Seattle , WA 98195 <br> 206-616-9018 </p>  <p><a href="mailto:kramsey@u.washington.edu">kramsey@u.washington.edu </a></p></td>';
	os += '</tr>';
	os += '</table></p>';
	document.getElementById('slate').innerHTML= os;
	document.getElementById('slate').style.visibility='visible';
	document.getElementById('teamslate').style.visibility='hidden';		
	document.getElementById('partnerslate').style.visibility='hidden';
	document.getElementById('indexWin').style.visibility='hidden';
	document.getElementById('publicationWin').style.visibility='hidden';
	document.getElementById('menuPubLeft').style.visibility='hidden';
	document.getElementById('menuPubRight').style.visibility='hidden';
	document.getElementById('menuPartnerLeft').style.visibility='hidden';
	document.getElementById('menuPartnerRight').style.visibility='hidden';

}

function slateTeam(n)
{
sortit(8);
clickTeam();
//setMainTab(2);

	
			
	document.getElementById('slate').style.visibility='hidden';	
	document.getElementById('teamslate').style.visibility='visible';	
	document.getElementById('partnerslate').style.visibility='hidden';
	document.getElementById('indexWin').style.visibility='hidden';
	document.getElementById('publicationWin').style.visibility='hidden';
	document.getElementById('menuPubLeft').style.visibility='hidden';
	document.getElementById('menuPubRight').style.visibility='hidden';
	document.getElementById('menuPartnerLeft').style.visibility='hidden';
	document.getElementById('menuPartnerRight').style.visibility='hidden';
}

function slatePartner()
{
//setMainTab(3);
clickPartnerPage();

	displaypartnerDocs();		
	document.getElementById('slate').style.visibility='hidden';	
	document.getElementById('teamslate').style.visibility='hidden';
	document.getElementById('partnerslate').style.visibility='visible';
	document.getElementById('indexWin').style.visibility='hidden';
	document.getElementById('publicationWin').style.visibility='hidden';
	document.getElementById('menuPubLeft').style.visibility='hidden';
	document.getElementById('menuPubRight').style.visibility='hidden';
	document.getElementById('menuPartnerLeft').style.visibility='visible';
	document.getElementById('menuPartnerRight').style.visibility='visible';
}

function slatePublications()
{
//setMainTab(4);
sortit(4);
clickPublications();
	document.getElementById('slate').style.visibility='hidden';
	document.getElementById('teamslate').style.visibility='hidden';
	document.getElementById('partnerslate').style.visibility='hidden';	
	document.getElementById('indexWin').style.visibility='visible';
	document.getElementById('publicationWin').style.visibility='visible';
	document.getElementById('menuPubLeft').style.visibility='visible';
	document.getElementById('menuPubRight').style.visibility='visible';
	document.getElementById('menuPartnerLeft').style.visibility='hidden';
	document.getElementById('menuPartnerRight').style.visibility='hidden';
}

//SLATES END HERE

function extwin(f)
{
	(f)? res = 0 : res = !res;
	var h = res? '250' : '550';
	var p = res? '400' : '700';
	document.getElementById('indexWin').style.height = h + 'px';
	document.getElementById('publicationWin').style.height = h + 'px';
	document.getElementById('menu').style.top = p + 'px';
}

//FADE SCRIPT

function Fade(objID,CurrentAlpha,TargetAlpha,steps){

		var obj = document.getElementById(objID);
		
		CurrentAlpha = parseInt(CurrentAlpha);
		if (isNaN(CurrentAlpha)){
			CurrentAlpha = parseInt(obj.style.opacity*100);
			if (isNaN(CurrentAlpha))CurrentAlpha=100;
		}
		
		
		
		var DeltaAlpha=parseInt((CurrentAlpha-TargetAlpha)/steps);
		var NewAlpha = CurrentAlpha - DeltaAlpha;
		
		if (NewAlpha == 100 && (navigator.userAgent.indexOf('Gecko') != -1 && navigator.userAgent.indexOf('Safari') == -1)) NewAlpha = 99.99;
		
		obj.style.opacity = (NewAlpha / 100);
		obj.style.MozOpacity = obj.style.opacity;
		obj.style.KhtmlOpacity = obj.style.opacity;
		obj.style.filter = 'alpha(opacity='+NewAlpha+')';
		
		if (steps>1){
			setTimeout('Fade("'+objID+'",'+NewAlpha+','+TargetAlpha+','+(steps-1)+')', 50);
		}
		}
		
		
function clickOverview(){
Fade('overview','',100,13);
Fade('team','',35,13);
Fade('partnerpage','',35,13);
Fade('publications','',35,13);

	if (navigator.appVersion.indexOf("MSIE")==-1){
	Fade('menuPartnerRight','',0,20);
	Fade('menuPartnerLeft','',0,20);
	Fade('menuPubRight','',0,20);
	Fade('menuPubLeft','',0,20);
	Fade('slate','',100,13);
	
	}


}

function clickTeam(){
Fade('overview','',35,13);
Fade('team','',100,13);
Fade('partnerpage','',35,13);
Fade('publications','',35,13);
	if (navigator.appVersion.indexOf("MSIE")==-1){
	Fade('menuPartnerRight','',0,20);
	Fade('menuPartnerLeft','',0,20);
	Fade('menuPubRight','',0,20);
	Fade('menuPubLeft','',0,20);
	}
}

function clickPartnerPage(){
Fade('overview','',35,13);
Fade('team','',35,13);
Fade('partnerpage','',100,13);
Fade('publications','',35,13);

	if (navigator.appVersion.indexOf("MSIE")==-1){
	Fade('menuPartnerRight','',100,30);
	Fade('menuPartnerLeft','',100,30);
	Fade('menuPubRight','',0,30);
	Fade('menuPubLeft','',0,30);
	
	}

}

function clickPublications(){
Fade('overview','',35,13);
Fade('team','',35,13);
Fade('partnerpage','',35,13);
Fade('publications','',100,13);

	if (navigator.appVersion.indexOf("MSIE")==-1){
	Fade('menuPartnerRight','',0,30);
	Fade('menuPartnerLeft','',0,30);
	Fade('menuPubRight','',100,30);
	Fade('menuPubLeft','',100,30);
	}

}

//END FADE SCRIPT

function init()
{
	
	loadXML();
	loadXML2();
	loadXML3();
	backIndexWin();
	slateHome();
	clickOverview();
	sortit(9);
	
	//window.setTimeout('sortit(6)', 1500);
}


//window.onload = init;

// -->
