/* EVENT LISTENERS FOR OPENING ABSTRACT DOCUMENTS 
   abstract links must have class="abstractLink" */

function initAbstractLinks(){
	//loop over anchor tags to add event listeners to abstract links
	var arLinksAll = new Array();
	arLinksAll = document.getElementById('content').getElementsByTagName('a');
	for(i=0; i < arLinksAll.length; i++){
		if(arLinksAll[i].className=='abstractLink'){
			addEvent(arLinksAll[i],'click',evtListen_handleAbstractLink,false);
		}	
	}
}

function evtListen_handleAbstractLink(e){
	//open abstract in its own window
	var linkClicked = getElmnt(e);
	/* to make sure e is the link and not a child of the link (e.g. text or image between the <a> tags),
	   walk up the DOM tree until the 'a' element is found, don't go past the 'body' container*/
	while(linkClicked.nodeName.toLowerCase() != 'a' && linkClicked.nodeName.toLowerCase() != 'body'){
		linkClicked=linkClicked.parentNode;
		//prevent accidental infinite loop by returning if body tag reached
		if(linkClicked.nodeName.toLowerCase() == 'body'){
			return;}
	}	
	var url=linkClicked.href;
	var winHeight=screen.height-200;
	var winWidth=800;
	if(screen.width > 800){winWidth=900;}
	var leftPos=(screen.width-winWidth)/2;
	var topPos=10;
	var sOption="width="+winWidth+",height="+winHeight+",left="+leftPos+",top="+topPos+",menubar=no,"; 
	    sOption+="toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes";  
	winAbstract=window.open(url,"Abstract",sOption); 
	winAbstract.focus();
	cancelClick(e);
	return false;
}
addEvent(window, 'load', initAbstractLinks, false);