var Information = Class.create();

Information.prototype = {
	
	// initialize()
	// Constructor runs on completion of the DOM loading. Loops through anchor tags looking for 
	// 'lightbox' references and applies onclick events to appropriate links. The 2nd section of
	// the function inserts html at the bottom of the page which is used to display the shadow 
	// overlay and the image container.
	//
	initialize: function() {	
		if (!document.getElementsByTagName){ return; }
		var anchors = document.getElementsByTagName('a');

		// loop through all anchor tags
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			
			var relAttribute = String(anchor.getAttribute('rel'));
			// use the string.match() method to catch 'lightbox' references in the rel attribute
			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().search('/info/'))){
				anchor.onclick = function () {myInformation.start(this); return false;}
			}
		}
	  },
	  
	  start: function(infoObj) {
	    var rel = infoObj.getAttribute('rel');
	    var closeButton = $(rel).childNodes[0];
		closeButton.onclick= function () {myInformation.end(this.parentNode);};
//		var infoDiv = rel.substring(4);
//		var divOpen = $(infoDiv);
		new Effect.BlindDown($(rel), {duration:0.2});
	  },
	  
	end: function(div) {
		new Effect.BlindUp($(div), {duration:0.2});
	}
}

function initInformation() { myInformation = new Information(); }
Event.observe(window, 'load', initInformation, false);