/**
 * @param {Object} contentType 1为基本的文本或者HTML代码,2为frame
 * @param {Object} title 标题信息
 * @param {Object} htmlStr 填入的信息内容 如果内容的类型是fram 则此参数为一个url地址 否则为HTML代码
 * @param {Object} width 层的宽度
 * @param {Object} height 层的高度
 */
layer={
	canvasId :"container_show_layer",//默认容器名
	layerWidth :500,//默认容器宽度
	title:'标题信息',
	layerHeight :400,//默认容器高度
	contentType:1,//默认文件类型
	htmlStr:'<font color="red">请添加信息内容</font>',//默文件内容为空
	iframeIdName:'iframe_layer',
	
	UtilField:function(str){
		if(str=="undefined")
			return 1;
	},	
	ShowLayer:function(title,htmlStr,width,height,contentType){
		this.contentType=contentType||this.contentType;
		this.title=title||this.title;
		this.htmlStr=htmlStr||this.htmlStr;
		this.layerWidth=width||this.layerWidth;
		this.layerHeight=height||this.layerHeight;
		
		layer.HiddenLayer();
		var title = '<div id="tit" style="background:url(images/repeat_x.png) repeat-x;height:26px;cursor:move;"><div style="float:left;width:auto;padding-left:10px;height:26px;line-height:26px;font-size:12px;color:#555;font-weight:bold;">'+this.title+'</div><div style="float:right;padding-right:10px;padding-top:3px;"><a href="javascript:" onclick="layer.HiddenLayer();"><img src="images/close.jpg" width="18" height="18" border="0" /></a></div></div>';
		<!-- onmousedown="dd.moveInit(\''+layer.canvasId+'\',event);" onmousemove="dd.Move(\''+layer.canvasId+'\',event);" onmouseup="dd.stopMove();" onmouseout="dd.stopMove();" -->
		var contentDiv = window.document.createElement("div");
		contentDiv.style.width=(this.layerWidth-2)+"px";
		contentDiv.style.height=(this.layerHeight-28)+"px";
		
		
		if(this.contentType==2){
			var temp = "<iframe width='100%' style='height:" + (this.layerHeight-28) + "px' name='" + this.iframeIdName + "' id='" + this.iframeIdName + "' src='" + this.htmlStr + "' frameborder='0' scrolling='" + 'auto' + "'></iframe>";
			contentDiv.innerHTML=temp;
		}else{
			contentDiv.innerHTML=this.htmlStr;
		}
		
		var container = document.createElement("div");	
		container.id=this.canvasId;
		container.style.width=this.layerWidth+"px";
		container.style.height=this.layerHeight+"px";
		container.style.position="absolute";
		container.style.zIndex=100;
		container.style.border="1px solid #92D1DC";
		container.style.fontSize="13px";
		
		container.style.top=((document.body.offsetHeight-this.layerHeight)/2)>0?((document.body.offsetHeight-this.layerHeight)/2)+"px":document.body.offsetHeight+"px";
		container.style.left=((document.body.offsetWidth-this.layerWidth)/2)>0?(document.body.offsetWidth-this.layerWidth)/2+"px":document.body.offsetWidth+"px";
		container.style.backgroundColor = "#fff";
		container.innerHTML=title;
		container.appendChild(contentDiv);
		
		document.body.appendChild(container);
	},
	HiddenLayer:function(){
		//alert(this.contentType+'--contentType,'+this.canvasId+'--canvasId,'+this.title+'--title,'+this.htmlStr+'--htmlStr,'+this.layerWidth+'--layerWidth,'+this.layerHeight+'--layerHeight')
		var _openLayer = document.getElementById(this.canvasId);
		if(_openLayer!=null){_openLayer.parentNode.removeChild(_openLayer);}
	}	
}
