
/****************
示例 new popup().markPop("我是popup"，0,200,5000)
markPop(html,x,y,closetime)
参数说明 html为要显示内容
x\y显示位置缺省值请用-1带入 
closetime代表自动关闭时间可为空
****************/
function popup(){
	
	//创建Pop
	 this.markPop=function()
	 {
		 var style="position:fixed;",str="",html,closeTime=-1;
		 if(arguments[0]==undefined)return;
		 if(arguments[1]!=undefined || arguments[1]!=-1) style+="left:"+arguments[1]+"px;";
		 if(arguments[2]!=undefined || arguments[2]!=-1) style+="top:"+arguments[2]+"px;";
		 if(arguments[3]!=undefined) closeTime=arguments[3];
		 
		 html=arguments[0];
		 
		 str=" <div  id=\"pop_form_win\" style=\"width:420px; height:62px; z-index:9990; "+style+" \">";
		 str+="<div style=\"height:24px; width:420px; z-index:9991; background:url(images/showbf_bg_01.gif); \">";
		 str+="<div style=\"float:left; z-index:9992; background:url(images/showbf_07.gif); width:136px; height:24px;\"></div>";
		 str+="<div style=\"float:right; z-index:9993; background: url(images/showbf_09.gif); width:27px; height:24px; cursor:pointer;\" onclick=\"$('#pop_form_win').hide();$('#pop_form_win').remove();\"></div></div>";
		 str+="<div style=\"height:38px; z-index:9994; width:416px; border-bottom-width:2px; border-bottom-color:#CC0000; border-bottom-style:solid;border-left:2px; border-left-color:#CC0000; border-left-style:solid; z-index:9995; border-right:2px; border-right-color:#CC0000; border-right-style:solid\">";
		 str+="<table border=0 cellpadding=0 cellspacing=0 bgcolor=\"#FFFFFF\" class=\".poptable\" style=\"marign:0px;auto;width:416px; height:38px;\">";
		 str+="<tr><td>";
		 str+=html;
		 str+="</td></tr></table>";
		 str+="<style type=\"text/css\">";
		 str+=".poptable td {font-family: \"Tahoma\", \"宋体\";font-size: 13px;}";
		 str+=".poptable .line td { border-bottom:solid 1px #FFD8CA; line-height:32px;}";
		 str+="</style></div></div>";
		 
		 if($("#pop_form_win").length>0)$("#pop_form_win").remove();
		 
		 $("body").append(str);
		 if(!window.XMLHttpRequest)fixedPosition(document.getElementById("pop_form_win") ,arguments[1] ,arguments[2]);
		 if(closeTime!=-1)popup.closePop(closeTime);
				
		 }
		 
		 //关闭POP
		 this.closePop=function()
		 {
			 try{
				 if(arguments[0]==undefined || arguments[0]=="" || arguments[0]==null){
					 closeWin();
					 }else{
						 setTimeout('popup.closePop()',arguments[0]);
						 }
			}catch(err){closeWin();}
		 }
		 
		 var closeWin=function(){
			 $("#pop_form_win").hide();
			 $("#pop_form_win").remove();
			 }
			 
			 
		/*以下是兼容IE6写法*/ 
		
		/*作者：淡新举
		联系：http://www.scriptlover.com
		功能：使元素fixed定位*/
		var fixedPosition = function(element ,left ,top){
				 element.style.display = "block";
				 if (!window.XMLHttpRequest && window.ActiveXObject)
				 {
					 element.style.position = "absolute";
					 fixedPosition.setGlobal();
					 }
					 else
					 {
						 element.style.position = "fixed";
						 }
						 element.style.top = top +"px";
						 element.style.left = left +"px";
				};
				
     /*添加css规则*/
     fixedPosition.addCSSRule = function(key ,value){
	 var css = document.styleSheets[document.styleSheets.length-1];
	 css.cssRules ? 
	 (css.insertRule(key +"{"+ value +"}", css.cssRules.length)) :
	 (css.addRule(key ,value));
	 };

     /*标志特定公共规则是否存在*/
     fixedPosition.inited = false;

     /*设置特定公共规则*/
     fixedPosition.setGlobal = function(){
		 if (! fixedPosition.inited){
			 document.body.style.height = "100%";
			 document.body.style.overflow = "auto";
			 fixedPosition.addCSSRule("*html" ,"overflow-x:auto;overflow-y:hidden;");
			 fixedPosition.inited = true;
			 }
			 };
	/*兼容IE6扩展函数结束*/
		 

	}
	
	

	
(function() {this.popup=new popup();})();
