
	CWS_colourMe()
//-----------------------//--------------------------				
// data entry 
//-----------------------//--------------------------				
	staffList = new Array()
	jobOrdInserts = new Array()
	//--------------------------
		add_JOI = function(title,index){
			jobOrdInserts[jobOrdInserts.length] = new Array(title,index)
		}

//-----------------------//--------------------------				
// Job Ordinal Data
//-----------------------//--------------------------				
	// job Ordinal list order determined by the first word in job title
	jobOrdinal = new Array('head','director','professor','senior academic','reader','principal','senior','lecturer / s','lecturer','associate','researcher','research')
	// those jobs who's ordinal indicator is somewhere else in the string, eg aaa aaaa manager aaaaaa..
	// 
	add_JOI('principal of riseholme',.5)
	
	add_JOI('manager',2.4)
	add_JOI('deputy head',1.6)
	add_JOI('acting head',0.5)
	add_JOI('professor',2.5)
	
	add_JOI('subject leader',2.6)
	add_JOI('programme leader',5.6)
	add_JOI('tutor',9)
	add_JOI('project',9)
	
	add_JOI('post doctoral research associate',10.5)
	add_JOI('research assistant',10.6)
	add_JOI('research associate',10.5)
	add_JOI('head of business school',-0.1)
	
//-----------------------//--------------------------				
	

		addEntry = function(title,fname,lname,dname,jtitle,email,id){
			ord = 99
			for (var i = 0; i < jobOrdinal.length;++i){
				if(ord == 99 ){if(jtitle.toLowerCase().substr(0,jobOrdinal[i].length)== jobOrdinal[i]){ ord=i }}
			}
			for (var i = 0; i < jobOrdInserts.length;++i){
				if(jtitle.toLowerCase().indexOf(jobOrdInserts[i][0]) != -1){
					ord = Math.min(jobOrdInserts[i][1],ord)
				}
			}
			
			ord = "00"+ord; 
			if(ord.indexOf('.') == -1){ord = ord+'.00'}
			else{ord = ord+'00'}
			ord = ord.substr(0,ord.indexOf('.')+2)
			ord = ord.substr(ord.length-5)
			
			staffList[staffList.length] = new Array(title,fname,lname,dname,jtitle,email,id,ord)
		}
		
//-----------------------//--------------------------				
// display functions
//-----------------------//--------------------------					

	writeOutList = function(){
		outStr = ''
		outStr = outStr + writeOutHeader()
		for(var i= 0; i < staffList.length;++i){
			outStr = outStr +writeOutLine(i)
		}
		outStr = outStr +writeOutTail()
		document.getElementById("content").innerHTML =outStr
	}
	//-----------------------

 
		writeOutHeader = function(){
			HStr = '<table border="0"><tr><td colspan="3" valign="top">Click icons to change list order</td></tr><tr>'
			if(sortType == 'firstN')
				{HStr = HStr + '<td align="center"><img ID="s0" src="/componants/images/stacked.gif" alt="sorted by first name"></td>'}
			else{HStr = HStr + '<td align="center"><a href=javascript:sortByFirst() onmouseover="toggleOn(0)" onmouseout="toggleOff(0)"  ><img ID="s0" src="/componants/images/stack.gif" alt="sort by first name"></a></td>'}
			if(sortType == 'lastN')
				{HStr = HStr + '<td align="left"><img ID="s1" src="/componants/images/stacked.gif" alt="sorted by last name"></td>'}
			else{HStr = HStr + '<td align="left"><a href=javascript:sortByLast() onmouseover="toggleOn(1)" onmouseout="toggleOff(1)"  ><img ID="s1" src="/componants/images/stack.gif" alt="sort by last name"></a></td>'}
			if(sortType == 'job')
				{HStr = HStr + '<td align="left"><img ID="s2" src="/componants/images/stacked.gif" alt="sorted by position"></td><td></td></tr>'}
			else{HStr = HStr + '<td align="left"><a href=javascript:sortByTitle() onmouseover="toggleOn(2)" onmouseout="toggleOff(2)"  ><img ID="s2" src="/componants/images/stack.gif" alt="sort by position"></a></td><td></td></tr>'}
			return HStr 
		}
		//-----------------------
			toggleOn = function(tID){
				document.getElementById("s"+tID).src= "/componants/images/shuffle.gif"
			}
	
			toggleOff = function(tID){
				document.getElementById("s"+tID).src= "/componants/images/stack.gif"
			}

		//-----------------------	
		writeOutLine = function(i){
			lineStr = ''
			if(i==0){lastOrd = staffList[i][7]}
			if(sortType ==  'job' && lastOrd != staffList[i][7]){lineStr =  lineStr +'<tr><td>&nbsp;</td></tr>'}
			lineStr =  lineStr +'<tr><td colspan="2"><a href='+staffList[i][6]+'.asp>'+staffList[i][0]+' '+ staffList[i][3]+'</a></td>'
			lineStr =  lineStr +'<td>'+staffList[i][4]+'</td>'
			lineStr =  lineStr + '<td><a href=mailto:'+staffList[i][5].toLowerCase()+'>'+staffList[i][5].toLowerCase()+'</a></td></tr>'
			lastOrd = staffList[i][7]
			return lineStr
		}

		writeOutTail = function(){return '</table><br><BR>'}


//-----------------------//--------------------------				
// sort functions
//-----------------------//--------------------------					

		
		sortByTitle = function(){
			sortType = 'job'		
			staffList.sort(byJTitle)
			writeOutList()
		}
			
		sortByFirst = function(){
			sortType = 'firstN'		
			staffList.sort(byFirstName)
			writeOutList()
		}

		sortByLast = function(){
			sortType = 'lastN'		
			staffList.sort(byLastName)
			writeOutList()
		}
		byJTitle = function(a,b)
		{	A = a[7]+a[2].toLowerCase(); B = b[7]+b[2].toLowerCase();return sorter(A,B)
			}
		
		byLastName = function(a,b)
		{A = a[2].toLowerCase(); B = b[2].toLowerCase();return sorter(A,B)}
		byFirstName = function(a,b)
		{A = a[1].toLowerCase(); B = b[1].toLowerCase();return sorter(A,B)}


		function sorter(A,B)	{if(A > B) {return 1 	};	if(A == B) {return 0	};	if(A < B) {return -1	}	}
	
//-----------------------//--------------------------				

	closeList = function(){
		sortByTitle()	}


