
/*
 * Popup 窗口类
 * include shadow.js
 * */

var Popup = new Function();


Popup.prototype = {
	
	shadow : null, //背景阴影;
	popup : null, //提示框;
	
	/*
	 * 初始化方法
	 * title : 标题
	 * content : 内容（html） 
	 * width : 宽度
	 * left : 左边距
	 * top : 上边距
	 * */
	
	init : function(content){
		var width = 540;
		var left = Utils.getCenterX(width);
		var top = Utils.getCenterY(200);
		this.shadow = new Shadow();
		this.shadow.show();
		this.popup = document.createElement('div');
		this.popup.style.position = 'absolute';
		this.popup.style.zIndex = '13';
		this.popup.style.width = width + "px";
		this.popup.style.left = left + "px";
		this.popup.style.top =  top + "px";
		this.popup.innerHTML = this.htmlCode(content);
		document.body.appendChild(this.popup); 
		Utils.observe(document.getElementById('window_close'),'click',this.remove.bind(this));
	},
	
	htmlCode : function(content){
		var image_url = "http://images.tradetang.com";
		//var str = '<div class="pop-up_border"><div class="pop-up_border_1"><div class="close"><a href="#" id="window_close">Close</a></div>'+content+'</div></div>';
		var str = '<div class="n15"><ul class="u31"><li class="w_l28"></li><li class="w_l29"><a href="javascript:void(0)" id="window_close"><img src="'+image_url+'/images/v2/btn27.gif" alt="Close" align="absmiddle" /> Close</a></li></li></ul>'+content+'</div>';
		
		return str;
	},
	
	setContent : function(content){
		this.popup.innerHTML = this.htmlCode(content);
		Utils.observe(document.getElementById('window_close'),'click',this.remove.bind(this));
	},
	
	remove : function(){
		this.shadow.remove();
		this.popup.style.display = 'none';
		document.body.removeChild(this.popup);	
	}
	
	 
	
	
	
	
}
