function lightbox(box, callingInstance, url, boxLoadFunction){
	this.box = box;
	this.shadow = 'div#shadow';
	this.callingInstance = callingInstance;
	this.url = url;
	this.boxLoadFunction = boxLoadFunction;
	this.detect = navigator.userAgent.toLowerCase();
}

lightbox.prototype = {
	showLightbox: function(args){
		var instance = this;
		
		this.adjustIE(true);
		$(this.shadow).show();
		var scrollHeight = findScroll().y + 40;
		
		if ($(this.box).length < 1){
			$.ajax({
				type: 'GET',
				url: this.url,
				dataType: 'html',
				success: function(msg){
					$('body').append(msg);
					$(instance.box).css('top', scrollHeight + 'px').show();
					if (instance.boxLoadFunction){
						if (args){
							instance.boxLoadFunction.apply(instance.callingInstance, args);
						}
						else{
							instance.boxLoadFunction.apply(instance.callingInstance);
						}
					}
				},
				failure: function(){
					alert('Template does not exist');
				}
			});
		}
		else{
			$(this.box).css('top', scrollHeight + 'px').show();
		}
	},
	
	hideLightbox: function(){
		$(this.box).hide();
		this.adjustIE();
		$(this.shadow).hide();
	},
	
	adjustIE : function(show){
		if (this.detect.indexOf("msie") > -1){
			if (show){
				$(this.shadow).css({height: getPageSize()[1], width: getPageSize()[0]});
				$('div#frame select').hide();//$('select').hide();
			}
			else{
				setScroll(0,0);
				$('div#frame select').show();
			}
		}
		else return false;
	}
}
