
function pictureWindow(whichpic) { 
	if (document.getElementById) { 
		document.getElementById("placeholder").src = whichpic.href; 
		return false; 
	} 
	else { 
		return true; 
	} 
}
function fullWindow(anchorObj){	
	var windowSetup=null;
  windowSetup="width=800,height=500,left=0,top=0,scrollbars=yes,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes";
  fullwin=window.open(anchorObj.href,"fullwin",windowSetup);
	fullwin.focus();
}
//Event Listeners
function addEvent(elm, evType, fn, useCapture){
// cross-browser event handling for IE5+, NS6+ and Mozilla 
// By Scott Andrew 
	if (elm.addEventListener) { 
		elm.addEventListener(evType, fn, useCapture); 
		return true; 
		} 
	else if (elm.attachEvent) { 
		var r = elm.attachEvent('on' + evType, fn); 
		return r; 
		}
	else {
		elm['on' + evType] = fn;
		}
	}
function checkID(e){
	var el, anchorObj;
	if(window.event && window.event.srcElement){
		el = window.event.srcElement;
	}
	if(e && e.target){
		el = e.target;
	}
	if(!el){ return; }
//alert("checking ID " + el.nodeName);
//while the tag is not an anchor tag move one up the node tree
	while (el.nodeName.toLowerCase() != 'a'){
		el = el.parentNode;
		}
//Lock in anchor object in case the clicked link is part of a pictureset or windowset class
	anchorObj=el;
//Continue up DOM Tree to see if clicked anchor is part of pictureset class: stop at html tag
	while (el.nodeName.toLowerCase() != 'html'){
		if (el.className == "pictureset"){
		pictureWindow(anchorObj);
		// cancel bubbling, we don't want the page to appear in the
		// parent window.  The original object triggering the
		// event is sent, because that is the event trigger that
		// needs to be cancelled.
		cancelClick(e);
		return false;
		}
		if (el.className == "windowset"){
		fullWindow(anchorObj);
		// cancel bubbling, we don't want the page to appear in the
		// parent window.  The original object triggering the
		// event is sent, because that is the event trigger that
		// needs to be cancelled.
		cancelClick(e);
		return false;
		}
		el = el.parentNode;
	}
	// a "pictureset" element was not found, return so that the
	// browser will follow the link
	return true;
}
// from DHTML Utopia
function cancelClick(e){
	//alert("cancelling bubble for " + e.nodeName);
	// for IE browsers
	if(window.event){
	window.cancelBubble = true;
	window.event.returnValue = false;
	}
	// for standard browsers
	if(e){
		if(e.stopPropagation){e.stopPropagation();}
		if(e.preventDefault){e.preventDefault();}
	}    
}
function addListeners(){
	var linktags
	// locate all anchor tags
	linktags=document.getElementsByTagName('a');
	// add the checkID() listener to the click event of each anchor tag
	for (var i=0; i < linktags.length; i++){
	//alert("adding listener to " + linktags[i].innerHTML);
		addEvent(linktags[i], 'click', checkID, false);
	}
}
// add addListeners() to the load event. 

addEvent(window, 'load', addListeners, false);