function displayInit(mainXMLDOC){
		MOZ = (document.implementation && document.implementation.createDocument)
		DisplayManager=new displayManagerClass();
		grasp.main(mainXMLDOC);
}
displayManagerClass = function(){
	uid=0;
	this.thumbW=128;
	this.thumbH=96;
	this.picW=640;
	this.picH=480;
	if(MOZ){
		contentArea=document.getElementById('contentArea');
		NavMenu = document.getElementById('NavMenu');
	}
}
//////
/////
//// C R E A T I O N
///
//
displayManagerClass.prototype.createPortProject=function(node){
}
grasp={}
grasp.main=function(node){
	if(node.firstChild.nodeName=='xml'){		
		var doc = node.childNodes[1].childNodes;
	}else{
		var doc = node.firstChild.childNodes;
	}
	var mx = doc.length;
	for (var i = 0; i<mx; i++) {
		switch (doc[i].nodeName) {
		case 'category' :
			grasp.displayCat(doc[i]);
			break;
		}
	}
}
grasp.displayCat=function(node){
	uid++
	var pTitle=node.getAttribute('pTitle');
	this.cNav = DisplayManager.createDiv(NavMenu,'NavItem');
	this.cProj=DisplayManager.createDiv(contentArea,'header');
	this.cProj.setAttribute('id','cat'+uid);
	this.cNav.innerHTML='<a title="See '+pTitle+'" href="#cat'+uid+'">'+pTitle+'</a>';
	var nTop2 = DisplayManager.createDiv(contentArea,'NavItemTop');
	if (MOZ){
		nTop2.style.width='83';
	}
	nTop2.innerHTML='<a title="Return to top" href="#">top</a>'
	this.cProj.innerHTML+=pTitle
	this.pc=0
	var doc = node.childNodes;
	var mx = doc.length;
	for (var i = 0; i<mx; i++) {
		switch (doc[i].nodeName) {
		case 'project' :
			grasp.displayProj(doc[i]);
			break;
		}
	}
}
grasp.displayProj=function(node){
	var a = node.getAttribute('thumbs').split(',');
	var mx = a.length;
	if(node.getAttribute('lay')=='long'){
		this.cProj = DisplayManager.createDiv(contentArea,'projMain2');
		this.pTitle = DisplayManager.createDiv(this.cProj,'pTitle');
		this.cCon = DisplayManager.createDiv(this.cProj,'projConent');
		if(mx!=1){
			this.thumbs = DisplayManager.createDiv(this.cCon,'projThumbHolder2');
		}else{
			this.thumbs = DisplayManager.createDiv(this.cCon,'projThumbHolder');
		}
		if(MOZ){
			this.cProj.style.width='726';
		}
		this.desc = DisplayManager.createDiv(this.cCon,'projInfo');
		this.pc=0;
	}else{
		this.cProj = DisplayManager.createDiv(contentArea,'projMain');
	 	this.pTitle = DisplayManager.createDiv(this.cProj,'pTitle');
	 	this.cCon = DisplayManager.createDiv(this.cProj,'projConent');
	 	this.thumbs = DisplayManager.createDiv(this.cCon,'projThumbHolder');
		this.desc = DisplayManager.createDiv(this.cCon,'projInfo');
		this.pc=1;
	}
	var ctitle=node.getAttribute('pTitle');
	this.pTitle.innerHTML=ctitle;
	var txt = '';
	for (var i = 0; i<mx; i++) {
		if(a[i].indexOf('x')==-1){
			var link='pic'+a[i].split('thumb')[1];			
			txt+='<a href="javascript:popUpIMG(\''+link+'\',DisplayManager.picW,DisplayManager.picH)"><img alt="'+ctitle+': Click for larger Image" title="'+ctitle+': Click for larger Image" src="thumbs/'+a[i]+'" width="'+DisplayManager.thumbW+'" height="'+DisplayManager.thumbH+'" class="projThumb"></a>'
		}else{
			var pic=a[i].split('x')[1];			
			txt+='<img src="thumbs/'+pic+'" width="'+DisplayManager.thumbW+'" height="'+DisplayManager.thumbH+'" alt="'+ctitle+': Large image unavailable" title="'+ctitle+': Large image unavailable" class="projThumbX">'
		}
	}
	this.thumbs.innerHTML=txt;
	var doc = node.childNodes;
	var mx = doc.length;
	for (var i = 0; i<mx; i++) {
		switch (doc[i].nodeName) {
		case 'info' :
			grasp.displayInfo(doc[i]);
			break;
		}
	}
}
grasp.displayInfo=function(node){
	if(node.getAttribute('header').indexOf('Description')==-1){
			var cInf = DisplayManager.createDiv(this.desc,'projDesc2');
		}else{
			var cInf = DisplayManager.createDiv(this.desc,'projDesc');
		}
	var adjusted=node.firstChild.nodeValue;
	cInf.innerHTML='<span class="projDescHeader">'+node.getAttribute('header')+': </span>'+adjusted;
}
displayManagerClass.prototype.createDiv=function(parent,cls){
	var d = document.createElement('div');
	if(cls!=''){
		d.className= cls;
	}
	parent.appendChild(d);
	return d
}
displayManagerClass.prototype.linkFunc=function(js,text){
	return 	"<a href='javascript:"+js+"'>"+text+"</a>";
}
displayManagerClass.prototype.imgTag=function(file){
	if(file==undefined){
		return ''
	}
	return 	"<img src='"+file +"' >";
}
displayManagerClass.prototype.buttonIcon=function(file){
	if(file==undefined){
		return ''
	}
	return 	"<div class='buttonIcon'><img src='"+file +"' ></div>";
}
displayManagerClass.prototype.imgLink=function(js, text, file){
	return 	"<div class='buttonIcon'>"+this.linkFunc(js,"<img src='"+file +"' >")+"</div>"+this.linkFunc(js,text);
}

////
/// X M L - F E E D
//
/*
getXML = function(str, file, endFunc){
// replaced this function with
// http://www.howtocreate.co.uk/jslibs/htmlhigh/importxml.html
// because that script had better mac and xbrowser support

	if (document.implementation && document.implementation.createDocument){
		this[str] = document.implementation.createDocument("", "", null);
		this[str].onload = endFunc;
	} else if (window.ActiveXObject){
		this[str] =  new ActiveXObject("Microsoft.XMLDOM");
		this[str].onreadystatechange = function () {								
			if (this[str].readyState == 4) {
					endFunc();
			}
		};
	} else {
		alert('This site can not run with the current browser, or browser settings.');
		return;
	}		
	this[str].load(file); 
};
*/
getPortXML=function(fileName){
	var canItWork = importXML( 'port.xml', 'displayInit', false );
	// old :: getXML('mainXMLDOC', fileName+'.xml', displayInit);
};

////
/// M A N I P U L A T I O N
//

