var  MyGlassBox = new MyGlassBox();
function MyGlassBox() {
	
	this.BGColor = "#000000";
	this.LightBoxID = '';
	var Backgound = '';
	var Container = '';
	var ContentArea = ''
	
	$(function() {
		var Time = new Date();
		this.LightBoxID = Time.getMinutes()+''+Time.getMilliseconds();
		
		
		 Backgound = document.createElement("div");
		 Backgound.setAttribute("id","BG_LightBox"+this.LightBoxID);
		 $(Backgound).css("position","fixed");
		 $(Backgound).css("width","100%");
		 $(Backgound).css("height","100%");
		 $(Backgound).css("top","0px");
		 $(Backgound).css("left","0px");
		 $(Backgound).css("z-index","1");
		 
		 $(Backgound).css("opacity",0.8);
		 $(Backgound).hide();
		 $(Backgound).appendTo("body");
		 
		 Container = document.createElement("div");
		 Container.setAttribute("id","Container_LightBox"+this.LightBoxID);
		 $(Container).css("position","absolute");
		 $(Container).css("width","100%");
		 $(Container).css("height","100%");
		 $(Container).css("top","0px");
		 $(Container).css("left","0px");
		 $(Container).css("display","block");
		 $(Container).hide();
		 $(Container).appendTo("body");
		 $(Container).css("z-index","1");
		 
		 ContentArea = document.createElement("div");
		 ContentArea.setAttribute("id","Content_LightBox"+this.LightBoxID);
		 $(ContentArea).css("margin","20px auto");
		 $(ContentArea).css("overflow","hidden");
		 $(ContentArea).css("position","relative");
		 
		 $(ContentArea).appendTo($(Container));
	});
	
	
	  this.show = function() {
	 	
		$(Backgound).css("background-color",this.BGColor);
		
		$(Backgound).fadeIn('fast',function() { $(Container).show(); });
		
		$(ContentArea).html("&nbsp;");
		

	 }
	 
	 this.setText = function(width,height,html) {
		 
		var top = ($(Backgound).height() - height) / 2;
		$(ContentArea).css('height',height+'px');
		$(ContentArea).css('width',width+'px');
		$(ContentArea).css("margin-top",(top+$(window).scrollTop())+'px');

		$(ContentArea).css("z-index","1");
		 
		 $(ContentArea).html(html);
		 try {
			 $(Container).find("input:first").focus();
			 document.body.focus();
		 } catch (e) {}
	 }
	 
	 this.close = function() {
		 				$(Backgound).fadeOut('fast');
						$(Container).hide();
						$("iframe").show();
	 				}
}
