// lightbox.js previously existed in multiple copies throughtout the site
// these have now been replaced with this file, which ensures jQuery is loaded and then loads the new master version of Lightbox at "/javascripts/jquery.tatelightbox.js"
// Alex Pilcher, 09/07/2009

	// Check to make sure JQuery script is loaded
	var hasJQuery = false;
	jscripts = document.getElementsByTagName('script');
	for(i=0; i < jscripts.length; i++) {
		mySrc = jscripts[i].src;
		mySrc = mySrc.substr(mySrc.lastIndexOf('/')+1);
		if (mySrc == "jquery-latest.min.js") { 
		// JQuery is already called in the source
		hasJQuery = true;	
		}
	} 
	if (!hasJQuery) { // we need to load it ourselves
		var addJQuery = document.createElement('script');
		addJQuery.type = 'text/javascript';
		addJQuery.src = "\/javascripts\/jquery-latest.min.js";
		document.getElementsByTagName('head')[0].insertBefore(addJQuery,jscripts[0]);
	}
	
	// now add the lightbox script at the end of the Head element
	var addLightbox = document.createElement('script');
	addLightbox.type = 'text/javascript';
	addLightbox.src = "\/javascripts\/jquery.tatelightbox.js";
	document.getElementsByTagName('head')[0].appendChild(addLightbox);