// -----------------------------------------------------------------------------------
//
//	Lightbox v2.02
//	by Lokesh Dhakar - http://www.huddletogether.com
//	3/31/06
//
//	For more information on this script, visit:
//	http://huddletogether.com/projects/lightbox2/
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//	
//	Credit also due to those who have helped, inspired, and made their code available to the public.
//	Including: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.org), Thomas Fuchs(mir.aculo.us), and others.
//
//
// -----------------------------------------------------------------------------------
/*

	Table of Contents
	-----------------
	Configuration
	Global Variables

	Extending Built-in Objects	
	- Object.extend(Element)
	- Array.prototype.removeDuplicates()
	- Array.prototype.empty()

	Lightbox Class Declaration
	- initialize()
	- start()
	- changeImage()
	- resizeImageContainer()
	- showImage()
	- updateDetails()
	- updateNav()
	- enableKeyboardNav()
	- disableKeyboardNav()
	- keyboardAction()
	- preloadNeighborImages()
	- end()
	
	Miscellaneous Functions
	- getPageScroll()
	- getPageSize()
	- getKey()
	- listenKey()
	- showSelectBoxes()
	- hideSelectBoxes()
	- pause()
	- initLightbox()
	
	Function Calls
	- addLoadEvent(initLightbox)
	
*/


var Aboutbox = Class.create();

Aboutbox.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 objBody = document.getElementsByTagName("body").item(0);
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','aboutoverlay');
		objOverlay.style.display = 'none';
		//This is commented out because if the user clicks outside of the 'box'
		//it would cause the box to close.
		//objOverlay.onclick = function() { myExportbox.end(); return false; }
		objBody.appendChild(objOverlay);
		
		var objAboutbox = document.createElement("div");
		objAboutbox.setAttribute('id','aboutbox');
		objAboutbox.style.display = 'none';
		objBody.appendChild(objAboutbox);
		
		var objOuterAboutContainer = document.createElement("div");
		objOuterAboutContainer.setAttribute('id','outerAboutContainer');
		objAboutbox.appendChild(objOuterAboutContainer);
		
		var objAboutContainer = document.createElement("div");
		objAboutContainer.setAttribute('id','aboutContainer');
		
		var objMemberAboutbox = document.createElement("table");
		objMemberAboutbox.setAttribute('align','center');
		objMemberAboutbox.setAttribute('cellspacing','4');
		
			
		var objTablebody = document.createElement("TBODY");
		
		var row0 = document.createElement("tr");	
		
		var row0col1 = document.createElement("td");
		row0col1.setAttribute("align","left");
		row0col1.innerHTML = "<span id='llabel1' class='membertitle'><font size='5'>Ohlalu!<font>  <font size='2'>About</font></span>";
		row0.appendChild(row0col1);
		
		var row0col2 = document.createElement("td");
		row0col2.setAttribute("align","right");
		//the class "close" is located in the lightbox css
		row0col2.innerHTML = "<table class='close' style='BORDER-TOP: gainsboro 1px solid;border-left: gainsboro 1px solid;border-right: gainsboro 1px solid;border-bottom: gainsboro 1px solid;'><tr><td onclick='myAboutbox.end(); return false;'>Close</td></tr></table>";
		row0.appendChild(row0col2);
		
		
		objTablebody.appendChild(row0);
		
		var row1 = document.createElement("tr");	
		
		var row1col1 = document.createElement("td");
		//row1col1.setAttribute("align","center");
		row1col1.innerHTML = "<table width='100%'><tr>"+
							 "<td class='generalLabels'>"+
							 "<span id='llabel2'>"+
							 "Ohlalu! is a online video link archive where you can watch all kinds of videos and \"Thumb It...F U...Like It\".<br><br>Also if you see a video on another website that you think should be posted you can \"Recommend It\".<br><br> Contact : diplomat@ohlalu.com"+
							 "</span>"+
							 "</td>"+
							 "</tr></table>";
		row1.appendChild(row1col1);	
		
				
		objTablebody.appendChild(row1);
		
		
				
		objMemberAboutbox.appendChild(objTablebody);
		objAboutContainer.appendChild(objMemberAboutbox);
		objOuterAboutContainer.appendChild(objAboutContainer);
		
		/*var objExportDataContainer = document.createElement("div");
		objExportDataContainer.setAttribute('id','exportDataContainer');
		objOuterExportContainer.appendChild(objExportDataContainer);
		
		var objExportData = document.createElement("div");
		objExportData.setAttribute('id','exportData');
		objExportData.innerHTML = "<table><tr><td valign='top'><img src='http://www.picture2life.com/Images/Website/info.png'/></td><td>Need to export more that one (1) picture at a time? <a href='http://www.picture2life.com/Export'>Click here to export multiple pictures!</a></td></tr></table>";
		objExportDataContainer.appendChild(objExportData);*/
		
		/*var exportBottomNav = document.createElement("div");
		exportBottomNav.setAttribute('id','exportBottomNav');
		objExportContainer.appendChild(exportBottomNav);
		
		var objBottomNavCloseLink = document.createElement("a");
		objBottomNavCloseLink.setAttribute('id','bottomNavClose');
		objBottomNavCloseLink.setAttribute('href','#');
		objBottomNavCloseLink.onclick = function() { myExportbox.end(); return false; }
		exportBottomNav.appendChild(objBottomNavCloseLink);
		
		var objBottomNavCloseImg = document.createElement("img");
		objBottomNavCloseImg.setAttribute('src',fileBottomNavCloseImage);
		objBottomNavCloseImg.setAttribute('border','0');
		objBottomNavCloseLink.appendChild(objBottomNavCloseImg);*/
	},
	
	//
	//	start()
	//	Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
	//
	start: function() {	

		hideSelectBoxes();

		// stretch overlay to fill page and fade in
		var arrayPageSize = getPageSize();
		Element.setHeight('aboutoverlay', arrayPageSize[1]);
		new Effect.Appear('aboutoverlay', { duration: 0.2, from: 0.0, to: 0.8 });

		// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var aboutboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);

		Element.setTop('aboutbox', aboutboxTop);
		//Element.show('exportbox');
		new Effect.Appear('aboutbox', { duration: 0.75 });
	},
	//
	//	end()
	//
	end: function() {
		Element.hide('aboutbox');
		new Effect.Fade('aboutoverlay', { duration: 0.2});
		showSelectBoxes();
	}
}
//---------------------------------------------------------------
var myAboutBox = null;

function initAboutbox() { myAboutbox = new Aboutbox(); }
Event.observe(window, 'load', initAboutbox, false);