function Popup(id){
	this.id = id;
	this.title = "";
	this.content = "";
	this.depth = "1";
	this.hidden = false;
}

Popup.prototype.settitle = function(title){
	this.title = title;
}

Popup.prototype.addcontent = function(content){
	this.content += content;
}

Popup.prototype.setdepth = function(depth){
	this.depth = depth;
}

Popup.prototype.sethidden = function(hidden){
	this.hidden = hidden;
}

Popup.prototype.draw = function(){	
	this.popupcode = '<div id="' + this.id + '" style="position:absolute; width:100%; text-align:center; z-index:' + this.depth + '; left:0px; top:200px;">'
	this.popupcode += '	<div style="width:320px; margin:0px auto;">';
	this.popupcode += '		<div style="width:320px; position:absolute;">';
	this.popupcode += '		<div style="padding-top:12px; padding-right:12px; text-align:right;"><img id="close_' + this.id + '" src="' + rootpath + 'imgs/popup_win_close.gif" style="cursor:pointer;"></div>';
	this.popupcode += ' 		<span style="font-weight:bold; color:#a11a10;">' + this.title + '</span><br />';
	this.popupcode += '			<div style="padding:20px;">' + this.content + '</div>';
	this.popupcode += '			</div>';
	this.popupcode += '	 	<img src="' + rootpath + 'imgs/popup_win.png" />';
	this.popupcode += '	</div>';
	this.popupcode += '</div>';
	
	document.write(this.popupcode);
	
	if (this.hidden){
		$("#" + this.id).hide();	
	}
	
	var closer = document.getElementById("close_" + this.id);
	closer.onclick = function(){
		var newid = this.id.split("close_");
		$("#" + newid[1]).fadeOut(400);
	}
}
