var Lightbox = {
	isIE: false, id: null,
	showSpinner:function() {
	  if (!$('lb_overlay').visible()) {
	    Lightbox.showBox();
	  }
		$('lb_box_contents').hide();
		$('lb_spinner').show();
		return false;
	},
	hideSpinner:function() {
		$('lb_box_contents').show();
		$('lb_spinner').hide();
		return false;
	},
	showBox:function() {
		this.isIE = (navigator.userAgent.indexOf("MSIE") > -1) ? true : false;
		if(this.isIE) this.fixIE("100%", "hidden","hidden");
		$('lb_overlay').show();
		this.displayBox('lb_box');
		return false;
	},
	hideBox:function() {
		$('lb_box').hide();
		$('lb_overlay').hide();
		if(this.isIE) this.fixIE("auto", "auto","visible");
		$('lb_box_close').hide();
		return false;
	},
	getPageSize:function() {
		var xScroll, yScroll;
		xScroll = document.body.scrollWidth || document.body.offsetWidth;
		yScroll = (window.innerHeight + window.scrollMaxY) || document.body.scrollHeight || document.body.offsetHeight;
		var de = document.documentElement;
	    var windowWidth = self.innerWidth || (de&&de.clientWidth) || window.innerWidth  || document.body.clientWidth;
	    var windowHeight = self.innerHeight || (de&&de.clientHeight) || window.innerHeight  || document.body.clientHeight;
		var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
		var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
		var scrollY = (de&&de.scrollTop) || (document.body&&document.body.scrollTop) || window.pageYOffset || window.scrollY || 0;
		return new Array(windowWidth, windowHeight, pageWidth, pageHeight, scrollY, yScroll);
	},
	displayBox:function(id) {
		var windowSize = this.getPageSize();
		var windowWidth = windowSize[0];
		var windowHeight = windowSize[1];
    var scrollY = windowSize[4];
		$('lb_overlay').style.height = ((windowSize[5]<windowHeight) ? windowHeight : windowSize[5]) + "px";
		$(id).style.top = (scrollY+40) + "px"
		$(id).show();
		$('lb_box_close').style.top = (scrollY+15) + "px"
		$('lb_box_close').show();
	},
	fixIE: function (height, overflow, visibility) {
		body_selects = document.getElementsByTagName("select");
		for (i = 0; i < body_selects.length; i++) body_selects[i].style.visibility = visibility;
		box_selects = $('lb_box').getElementsByTagName("select");
		for (i = 0; i < box_selects.length; i++) box_selects[i].style.visibility = 'visible';
	}
};
