/**
 *
 #ui-dialog-overlay {
	border-width: 0;
	margin: 0; 
	padding: 0;
	background: black none repeat scroll 0% 0%;
	position: absolute; top: 0pt;
	left: 0pt;
	width: 100%;
	height: 100%;
	opacity:0.7;
	filter: alpha(opacity = 70);
	-moz-background-clip: -moz-initial;
	-moz-background-origin: -moz-initial;
	-moz-background-inline-policy: -moz-initial;
	z-index: 1005;
}
 */
var popup=function(){
	this.top=0;
	this.left=0;
	this.content='';
	this.width=0;
	this.height=0;
	this.overlay=true;
	this.header=true;
	this.title='';
	this.rand=Math.round(Math.random()*1000000);
	this.overlay_id="overlay_id"+this.rand;
	this.ui_dialog_id="ui-dialog-overlay"+this.rand;
	this.init=function(ptop,pleft,pheader,ptitle,pcontent,pwidth,pheight,poverlay){
		this.top=ptop;
		this.left=pleft;
		this.header=pheader;
		this.title=ptitle;
		this.content=pcontent;
		this.width=pwidth;
		this.height=pheight;
		this.overlay=poverlay;
	};
	this.display=function(){
		
		if(document.getElementById(this.overlay_id)==null){
			
			//document.removeChild(document.getElementById(this.overlay_id));
		//}
			html="<div id=\""+this.overlay_id+"\" class=\"overlay_id\">";
			if(this.header){
				html+="<div class='pop-header'>";
				html+="<div class='pop-header-title'>";
				html+=this.title;
				html+="</div>";
				html+="<div class='pop-header-icon'>";
				html+="<img src='icon/icon_button_close.gif' onclick='selectCharity("+this.rand+")'/>";
				html+="</div>"
				html+="</div>";
			}
			html+="	<div class=\"game-box\" tabindex=\"1000\">";
			html+=this.content;
			html+="</div>";
			html+="</div>";
			if(this.overlay){
				html+="<div class=\"ui-dialog-overlay\" id=\""+this.ui_dialog_id+"\"/>";
				html+="</div>";
			}
			
			var div=document.createElement('div');
			div.innerHTML=html;
			
			document.getElementsByTagName("body")[0].appendChild(div);
		}else{
			document.getElementById(this.overlay_id).style.display='block';
			document.getElementById(this.ui_dialog_id).style.display='block';
		}
		var winwidth= document.body.clientWidth;
		var winheight = document.body.clientHeight;
		
		document.getElementById(this.ui_dialog_id).style.width=winwidth+'px';
		document.getElementById(this.ui_dialog_id).style.height=winheight+'px';
		
		gameLayer=document.getElementById(this.overlay_id);
		var layerheight = gameLayer.clientHeight;
		var layerwidth = gameLayer.clientWidth;
		gameLayer.style.left =Math.round((winwidth - layerwidth)/2) + "px";
		gameLayer.style.top = Math.round((winheight - layerheight)/2) + "px";
	};
	this.hide=function(){
		document.getElementById(this.overlay_id).style.display='none';
		document.getElementById(this.ui_dialog_id).style.display='none';
	};
};
/**
 *
 #ui-dialog-overlay {
	border-width: 0;
	margin: 0; 
	padding: 0;
	background: black none repeat scroll 0% 0%;
	position: absolute; top: 0pt;
	left: 0pt;
	width: 100%;
	height: 100%;
	opacity:0.7;
	filter: alpha(opacity = 70);
	-moz-background-clip: -moz-initial;
	-moz-background-origin: -moz-initial;
	-moz-background-inline-policy: -moz-initial;
	z-index: 1005;
}
 */
var floatPopup=function(){
	this.top=0;
	this.left=0;
	this.content='';
	this.width=0;
	this.height=0;
	this.overlay=true;
	this.header=true;
	this.title='';
	this.rand=Math.round(Math.random()*1000000);
	this.overlay_id="overlay_id"+this.rand;
	this.ui_dialog_id="ui-dialog-overlay"+this.rand;
	this.init=function(ptop,pleft,pheader,ptitle,pcontent,pwidth,pheight,poverlay){
		this.top=ptop;
		this.left=pleft;
		this.header=pheader;
		this.title=ptitle;
		this.content=pcontent;
		this.width=pwidth;
		this.height=pheight;
		this.overlay=poverlay;
	};
	this.display=function(){

		if(document.getElementById(this.overlay_id)!=null){
				obj=document.getElementById(this.overlay_id);
				p=obj.parentNode;
				p.innerHTML='';
		}
			html="<div id=\""+this.overlay_id+"\" class=\"overlay_id1\">";
			if(this.header){
				html+="<div class='pop-header1'>";
				html+="<div class='pop-header-title'>";
				html+=this.title;
				html+="</div>";
				html+="<div class='pop-header-icon'>";
				html+="<img src='icon/icon_button_close.gif' onclick='selectCharity("+this.rand+")'/>";
				html+="</div>"
				html+="</div>";
			}
			html+="	<div class=\"game-box-float\" tabindex=\"1000\">";
			html+=this.content;
			html+="</div>";
			html+="</div>";
			if(this.overlay){
				html+="<div class=\"ui-dialog-overlay\" id=\""+this.ui_dialog_id+"\"/>";
				html+="</div>";
			}
			
			var div=document.createElement('div');
			div.innerHTML=html;
			
			document.getElementsByTagName("body")[0].appendChild(div);
		//}else{
		//	document.getElementById(this.overlay_id).style.display='block';
		//	document.getElementById(this.ui_dialog_id).style.display='block';
		//}
	
		var winwidth= document.body.clientWidth;
		var winheight = document.body.clientHeight;
		
		//document.getElementById(this.ui_dialog_id).style.width=this.pwidth+'px';
		//document.getElementById(this.ui_dialog_id).style.height=this.pheight+'px';
		
		gameLayer=document.getElementById(this.overlay_id);
		var layerheight = gameLayer.clientHeight;
		var layerwidth = gameLayer.clientWidth;
		gameLayer.style.left =Math.round((winwidth - layerwidth)/2)+170 + "px";
		gameLayer.style.top = Math.round((winheight - layerheight)/2) + "px";
	};
	this.hide=function(){
		document.getElementById(this.overlay_id).style.display='none';
		document.getElementById(this.ui_dialog_id).style.display='none';
	};
};
