// JavaScript Document
//if(Stage=='undefined') Stage.initStage();

var stage = {	
	overlay : document.createElement("div"),
	cWrapper : document.createElement("div"),
	cBox : document.createElement("div"),
	
	setOverlay: function(content){
		
		//set styles and positions to all the divs
		document.body.style.width="100%";
		document.body.style.padding = "0px";
		document.body.style.margin = "0px";
		
		//overlay styles
		this.overlay.style.width="100%";
		this.overlay.style.height="100%";
		this.overlay.style.background = "url(images/overlay_bg.png)";
		this.overlay.style.position = "absolute";	
		this.overlay.style.top = "0px";
		this.overlay.style.left = "0px";
		
		//cWrapper styles
		this.cWrapper.style.width = "550px";
		this.cWrapper.style.position = "relative";
		this.cWrapper.style.margin = "0px auto";
		this.cWrapper.style.marginTop = "250px";
		
		//cBox styles
		this.cBox.style.width = "100%";
		this.cBox.style.background = "white";
		this.cBox.style.color = "#333333";
		this.cBox.style.padding = "15px";
		
		//write the delete icon 
		var delbtn = document.createElement("a");
		delbtn.href = "Javascript: stage.closeOverlay()";
		delbtn.innerHTML = "<img src='images/x.png' alt='close' />";
		delbtn.style.position = "absolute";
		delbtn.style.top = "-5px";
		delbtn.style.left = "-5px";
		
		this.cWrapper.appendChild(delbtn);
		
		//now set cBox with content passed as argument
		this.cBox.innerHTML = content;
		
		this.cWrapper.appendChild(this.cBox);
		
		this.overlay.appendChild(this.cWrapper);
		
		document.body.appendChild(this.overlay);
		
	},
	
	closeOverlay: function(){
		this.overlay.style.display = "none";
		this.cBox.innerHTML = ""; //empty any content that was in the content box!
	}
}


