var lightbox = new lightbox_create();
var lightbox_initialized = false;

function lightbox_create() {
	var obj=new Object();
	obj.content = null;
	
	// Turn everything on - mainly the IE fixes
	obj.activate = function(){
		initialize_lightbox();

		document.getElementById('overlay').style.display = "block";
		this.content.style.display = "block";
		
		if (navigator.userAgent.toLowerCase().indexOf('msie') + 1){
//alert(document.getElementsByTagName('html')[0].clientWidth)			;
			/*var htm	= document.getElementsByTagName('html')[0];
			htm.style.overflow = 'hidden';
			htm.style.width='100%';
			htm.style.height='100%';
			*/
			/*var bod	= document.getElementsByTagName('body')[0];
			bod.style.overflow = 'hidden';
			bod.style.width='100%';
			bod.style.height='100%';*/
			
			// In IE, select elements hover on top of the lightbox
			selects = document.getElementsByTagName('select');
			for(i = 0; i < selects.length; i++) {
				selects[i].style.visibility = 'hidden';
			}
		}
		
	};
	
	obj.deactivate = function(){
		this.content.style.display = "none";
		document.getElementById('overlay').style.display = "none";
		if (navigator.userAgent.toLowerCase().indexOf('msie') + 1){
			/*var htm	= document.getElementsByTagName('html')[0];
			htm.style.width='auto';
			htm.style.height='auto';
			htm.style.overflow = 'auto';
			var bod	= document.getElementsByTagName('body')[0];
			//bod.style.overflow = 'hidden';
			bod.style.width='auto';
			bod.style.height='auto';*/
			// In IE, select elements hover on top of the lightbox
			selects = document.getElementsByTagName('select');
			for(i = 0; i < selects.length; i++) {
				selects[i].style.visibility = 'visible';
			}
		}
	};
	
	return obj;
}

function initialize_lightbox(){
	if (lightbox_initialized) return;
	addLightboxMarkup();
	lightbox_initialized = true;
}

// Add in markup necessary to make this work. Basically two divs:
// Overlay holds the shadow
// Lightbox is the centered square that the content is put into.
function addLightboxMarkup() {
	var bod 		= document.getElementsByTagName('body')[0];
	var overlay 	= document.createElement('div');
	overlay.id		= 'overlay';
	bod.appendChild(overlay);
}