/*
 * 网站基础类
 * CreatDate:08.09.05
 * Author:yangmy 
 */
var gov={
   htmldataHost: "http://tb.bjfcdt.gov.cn/HtmlData/GovV2/",
    // htmldataHost:"http://cybbjfc.158/htmldata/"
    tbdataHost:"http://tb.bjfcdt.gov.cn/default.html"
};
window.onerror=function(){return false};
if (typeof($) == 'undefined') {
  $ = function(elem) {
    if (arguments.length > 1) {
      for (var i = 0, elems = [], length = arguments.length; i < length; i++)
        elems.push($(arguments[i]));
      return elems;
    }
    if (typeof elem == 'string') {
      return document.getElementById(elem);
    } else {
      return elem;
    }
  };
}
var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

Object.extend = function(destination, source) {
  for (var property in source) {
    destination[property] = source[property];
  }
  return destination;
}

var StringBuilder = function(){
    this._buffer    = [];
}
StringBuilder.prototype.append = function(str){
    this._buffer[this._buffer.length] = String(str);
}
StringBuilder.prototype.toString = function(){
    return this._buffer.join('');
}
StringBuilder.prototype.add = StringBuilder.prototype.append;
StringBuilder.prototype.clear = function(){
    this._buffer = [];
}

gov.setCookie=function(str){
	var expires=new Date();
	expires.setTime(expires.getTime()+24*60*60*365*1000);
	document.cookie=str+" expires="+expires.toGMTString();
}

gov.readCookie=function(){
    var args=new Object();   
	var query=  document.cookie;
    var pairs=query.split("; ");  
    for(var i=0;i<pairs.length;i++)   
    {   
        var pos=pairs[i].split('=');  
        args[pos[0]]=unescape(pos[1]);  
    }
    return args;
}

var layerHide=function(obj){
    if(typeof(obj)=="object"){
	    obj.style.display="none";
	} 
	else if(typeof(obj)=="string"){
	    $(obj).style.display="none";
	}
}

var layerShow=function(obj){
     if(typeof(obj)=="object"){
	    obj.style.display="";
	} 
	else if(typeof(obj)=="string"){
	    $(obj).style.display="";
	}
}

gov.alert = function(msg, fnOk,unclose) {
if(parent.gov){
     new parent.gov.config.alert(msg, fnOk,unclose).open();
    }else{
     new gov.config.alert(msg, fnOk,unclose).open();
    } 
};
gov.confirm = function(msg, fnOk, fnCancel) {
     new parent.gov.config.confirm(msg, fnOk, fnCancel).open();
};
gov.close = function(id){
    if(parent.gov){
        parent.gov.config.close(id);
	}else{
		gov.config.close(id);
	}
};
gov.popClose = function(id){
    if(parent.gov){
        parent.gov.config.close(id);
       }else{
        gov.config.close(id);
       } 
};
gov.popOpen = function(src,title,unclose) {
	 if(parent.gov){
        pop=new parent.gov.config.chipinPop(src,title,unclose);
        var obj=pop.open();
        if(obj){ 
            parent.gov.config.reIframe(obj.id);
        } 
    }else{
        pop=new gov.config.chipinPop(src,title,unclose);
        var obj=pop.open();
        if(obj){ 
            gov.config.reIframe(obj.id);
        } 
    }
};


gov.config={
      close: function(id) {
            if(id!=null){
	  	        if($("pop_box"+id))  document.body.removeChild($("pop_box"+id));
                wincount--;
               	$("pop_bg").style.zIndex=820+wincount;  
				if (!$("reinit_popiframe"+id)&typeof(window["reinit_popiframe"+id]) != "undefined") clearInterval(window["reinit_popiframe"+id]); 	
             }else{
                for(var i=0;i<=winid;i++){
	  	            if($("pop_box"+i))  document.body.removeChild($("pop_box"+i));
					if (!$("reinit_popiframe"+i)&typeof(window["reinit_popiframe"+i]) != "undefined") clearInterval(window["reinit_popiframe"+i]); 	
                }
                wincount=0;
             } 
            if(wincount==0){ 
	  	   	    if($("pop_bg"))  layerHide("pop_bg"); 
	  	    }	
      }
};
gov.config.openLayer=function(){ winid=0; wincount=0;};
gov.config.openLayer.prototype={
      create: function(options) {
           winid++;
           wincount++; 
            if(!$("pop_bg")){
		        var win = document.createElement("DIV");
		        win.setAttribute("id", "pop_bg");
		        win.style.zIndex="820";
		        document.body.appendChild(win);
                var height=document.body.offsetHeight;
                win.style.height=height+"px";
		        win.innerHTML='<iframe src="" frameborder="0" style="position:absolute;  top:0px; left:0px; width:100%; height:'+height+'px; " ></iframe>';  
		    }
		    else{
		        $("pop_bg").style.zIndex=820+wincount*2-1; 
		        layerShow("pop_bg");
		    }
	        var box = document.createElement("DIV");
	        box.setAttribute("id", "pop_box"+winid);
	        box.style.zIndex=820+wincount*2;
	        document.body.appendChild(box);
		    $("pop_box"+winid).className=options.classname;
		    $("pop_box"+winid).innerHTML=options.info;
		    if($("chipinStep_box_btn2")) $("chipinStep_box_btn2").focus(); 
 			
			if($("popiframe"+winid)){ 
            	return $("popiframe"+winid);
           } 
      }
}
gov.config.alert = Class.create();
gov.config.alert.prototype = Object.extend(new gov.config.openLayer(),{
 	   initialize: function(text, fnOk,unclose) {
    	   this.classname = "alertpop";
    	   var showclose = '';
    	   if(unclose==1)
    	   {
    	        showclose = 'none';
    	   }
    	   this.html='<h3>提示信息<a id="chipinStep_box_btn1" style="display:'+showclose+'" title="关闭" onclick="gov.close('+(winid+1)+');'+fnOk+';">关闭</a></h3>';
    	   this.html+='<div class="alertpop_info_e">'+text+'</div>' 
     	   this.html+='<div class="alertpop_info_e_bt"><input id="chipinStep_box_btn2" type="button" style="cursor:pointer" name="Submit" class="button3 firstButton" value="确 认" onclick="gov.close('+(winid+1)+');'+fnOk+'"></div>'; 
	   },
	   open:function(){
	       return this.create({
	            classname:this.classname,
	            info:this.html 
	       })
	   }
});

gov.config.confirm=Class.create();
gov.config.confirm.prototype= Object.extend(new gov.config.alert(),{
 	   initialize: function(text, fnOk, fnCancel) {
    	   this.classname = "alertpop";
    	   this.html='<h3>提示信息<a  title="关闭" onclick="gov.close('+(winid+1)+');return false">关闭</a></h3>';
    	   this.html+='<div class="alertpop_info_q">'+text+'</div>' 
    	   this.html+='<div class="alertpop_info_q_bt"><input type="button" id="chipinStep_box_btn2" name="Submit" class="button3 firstButton" style="cursor:pointer" value="确 认" onclick="gov.close('+(winid+1)+');'+fnOk+'"><input type="button" name="clear" class="button3" style="cursor:pointer" value="取 消" onclick="gov.close('+(winid+1)+');'+fnCancel+'"></div>';
	   }
});

gov.config.chipinPop=Class.create();
gov.config.chipinPop.prototype = Object.extend(new gov.config.alert(),{
 	   initialize: function(src,title,unclose) {
 	                  this.ifrmid=winid+1;
 	                  var showclose = '';
            if(unclose==1)
    	   {
    	        showclose = 'none';
    	   }
 	       this.title=title||"信息窗口";
    	   this.classname = "chipinpop";
    	  this.html=""; 
           if(title){
                      this.title=title;
                      this.html = '<h3><span id="title_chipinpop">'+this.title+'</span><a href="#"  style="display:'+showclose+'" title="关闭" onclick="gov.close('+(winid+1)+');;return false">关闭</a></h3>'; 
           } 
		   this.html += '<iframe width=562  frameborder=0  marginwidth=0 marginheight=0 scrolling=no name=\"popiframe\" id=\"popiframe'+this.ifrmid+'\" src='+src+' allowTransparency></iframe>';   
	   }
});
gov.config.reIframe=function(dom){
    window["reinit_"+dom] =window.setInterval("gov.config.reinitIframe('"+dom+"')", 200);
}
gov.config.reinitIframe=function(dom){
	         var  iframe=$(dom);
             try{
                    var height =  iframe.contentWindow.document.body.scrollHeight;
                    if(!document.all){
						height= iframe.contentWindow.document.documentElement.offsetHeight;
					}else{
					    if(gov.getBrowser()>7){
						    height =  iframe.contentWindow.document.body.scrollHeight+8;
					    }
					}
                    iframe.height=height;
            }catch (ex){
          }
}

gov.getBrowser=function(){
	var browser=navigator.appName 
	var b_version=navigator.appVersion 
	var version=b_version.split(";"); 
	var trim_Version=version[1].replace(/[ ]/g,""); 
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
	{ 
		return 7;
	} 
	else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
	{ 
		return 6;
	}else{
		return 8;	
	}

}

gov.serviceBox=function(){
	this.Create = function()
	{
		var w =94;
		var h =245;
		var objbody= document.compatMode=="CSS1Compat"?document.documentElement:document.body;
		var l=objbody.scrollLeft+objbody.clientWidth-w;
		var t=objbody.scrollTop+(objbody.clientHeight-7);
		var mywin = document.createElement("DIV");
		mywin.setAttribute("id", "kf");
		mywin.style.cssText = "position:absolute;width:"+ w +"px;height:"+ h +"px;left:"+l+"px;overflow:hidden;top:"+t+"px";
		document.body.appendChild(mywin);
		//$("kf").innerHTML='<iframe src="" frameborder="0" style="position:absolute;top:0px; left:0px; width:100%; height:100%; display:none"></iframe><div style="position:absolute;top:60px; left:0px;"><div style="position:absolute;top:0px; right:0px; width:25px;height:25px;"><img src="/CommLott/V2/images/close.gif" style="cursor:pointer;" align=right alt="关闭" onclick="MyWin.Close(\'kf\')" /></div><a href="/help/advice.asp" target="_blank"><img src="/CommLott/V2/images/advice.gif" border=0 style="filter: alpha(opacity=90)" /></a></div><div style="position:absolute;top:120px; left:0px;"><div style="position:absolute;top:0px; right:0px;width:25px;height:25px;"><img src="/CommLott/V2/images/close.gif" style="cursor:pointer;" align=right alt="关闭" onclick="MyWin.Close(\'kf\')" /></div><a href="http://service.bjfcdt.gov.cn/dialog/reg.asp" target="_blank"><img src="/CommLott/V2/images/kf.gif" border=0 style="filter: alpha(opacity=90)" /></a></div>';
		$("kf").innerHTML='<iframe src="" frameborder="0" style="position:absolute;top:0px; left:0px; width:100%; height:100%; display:none"></iframe><div style="position:absolute;top:120px; left:0px;"><div style="position:absolute;top:0px; right:-2px;width:25px;height:25px;"><img src="/CommLott/V2/images/close.gif" style="cursor:pointer;" align=right alt="关闭" onclick="MyWin.Close(\'kf\')" /></div><a href="http://service.bjfcdt.gov.cn/dialog/reg.asp" target="_blank"><img src="/CommLott/V2/images/kf.gif" border=0 style="filter: alpha(opacity=90)" /></a></div>';

		this.Move("kf",t);
	}
	this.Close = function(Id, Opacity)
    {
	    if (typeof(window["et"+ Id]) != "undefined") clearTimeout(window["et"+ Id]);
	    var o = $(Id);
	    document.body.removeChild(o);
    }
	
    this.Move = function(Id,t)
    {
		if (typeof(window["ct"+ Id]) != "undefined") clearTimeout(window["ct"+ Id]);
		var objbody= document.compatMode=="CSS1Compat"?document.documentElement:document.body;
        t0=objbody.scrollTop+(objbody.clientHeight-245);
	    var o = $(Id);
	    if (!o) {
			return;
			}
		tl=t-t0;
		if(t!=t0)
		{
		  if (Math.abs(tl) < 52)
		  {
			  if (Math.abs(tl) < 16)
		      {
			    tl = tl< 0 ? 1 : -1;
		      }
			  else
			  {
			    tl = tl< 0 ? 2 : -2;
			  }
		  }
		  else{
			  		  tl=(tl>0?-8:8);
			  }
		  o.style.top=t+tl+"px";
		}
		o.style.left=objbody.scrollLeft+objbody.clientWidth-94+"px";
	    window["ct"+ Id] = window.setTimeout("MyWin.Move('"+ Id +"',"+ (t+tl) +")", 1);
    }
}
gov.addJs=function(jsid,path){  
     var js;
     if(js=$(jsid)){
         js.parentNode.removeChild(js);
     } 
     var script= document.createElement("SCRIPT"); 
     script.defer= true;   
     script.type="text/javascript";
     script.src=path+"?j="+Math.random();
     script.id=jsid;   
     document.getElementsByTagName("HEAD")[0].appendChild(script);   
}

gov.ajax={};
gov.ajax.updater=function(id,url)
{
	Ajax.showLoading(id);
	new Ajax.Updater(
		id,
		url,
		{
			method: 'get',
			onComplete:function(){Ajax.hideLoading(id);
			}
		})

}
// 加载本站公告
gov.ajax.bindSiteinfo=function(url){
    var ivars = {
        url : url,
        errorcode :0,
        errorMessage:'',
        objArray:[],            
        getVars:function()
        {
            Ajax.showLoading("siteInfo");  
            ivars.objArray = [];
            new Ajax.Request(ivars.url, 
            {
                method: 'get',
                evalJS:false,
                encoding:'gb2312',
                onSuccess:function(transport){
                     eval(transport.responseText);
                     ivars.objArray = publicNotice;
                     ivars.generate();
                }
            });
        },
        generate:function(){
            var ret=new StringBuilder();
            ret.add('		  	<ul>');
            for(var i = 0; i < ivars.objArray.length;i++)
            {  
                ret.add(ivars.objArray[i].ToHtmlDd());
             }
            ret.add('		</ul>');       
            $("siteInfo").innerHTML = ret.toString();
                       Ajax.hideLoading("siteInfo");  
 
        }
    };
     ivars.getVars(); 
}
// 加载近十期开奖数据
gov.ajax.bindTenaward=function(url,num){
    var vars = {
        url : url,
        num:num||0, 
        errorcode :0,
        errorMessage:'',
        objArray:[],            
        getVars:function()
        {
            //alert(this.url);
            Ajax.showLoading("column_info_00"); 
            vars.objArray = [];
            new Ajax.Request(vars.url, 
            {
                method: 'get',
                evalJS:false,
                encoding:'gb2312',
                onSuccess:function(transport){
                    //alert(transport.responseText);
                    eval(transport.responseText);
                    vars.generate();
                }
            });
        },
        generate:function(){
            var ret=new StringBuilder();
            ret.add(' <table width="100%" border="0" cellspacing="0">') 
            for(var i = 0 ; i < vars.objArray.length; i ++)
            {
                ret.add(vars.objArray[i].ToHtmlTr());
            }
           ret.add('</table>');
           $('column_info_00_'+this.num).innerHTML = ret.toString();
           for(var j=0;j<3;j++){
		        if($("column_info_00_"+j)) $("column_info_00_"+j).style.display="none";
		   }  
		   $("column_info_00_"+this.num).style.display=""; 
           Ajax.hideLoading("column_info_00");  
        }
    };
    vars.getVars();
}
// 加载数据图表链接
gov.ajax.bindDatachart=function(url,num){
    var tbvars = {
        url : url,
        num:num||0, 
        errorcode :0,
        errorMessage:'',
        objArray:[],            
        getVars:function()
        {
            Ajax.showLoading("column_info_01");
            tbvars.objArray = [];
            //alert(url);
            new Ajax.Request(tbvars.url, 
            {
                method: 'get',
                evalJS:false,
                encoding:'gb2312',
                onSuccess:function(transport){
                //alert(transport.responseText);
                    eval(transport.responseText);
                    tbvars.generate();
                    
                }
            });
        },
        generate:function(){
            var ret=new StringBuilder();
            ret.add(' <ul>') 
            for(var i = 0 ; i < tbvars.objArray.length; i ++)
            {
                ret.add(tbvars.objArray[i].ToHtmlDd());
            }
           ret.add('</ul>');
          // $('column_info_01_'+this.num).innerHTML = '';
         
           $('column_info_01_'+this.num).innerHTML = ret.toString();
           for(var j=0;j<4;j++){
		        if($("column_info_01_"+j)) $("column_info_01_"+j).style.display="none";
		   }  
		   $("column_info_01_"+this.num).style.display="";  
           Ajax.hideLoading("column_info_01");   
        }
    };
    tbvars.getVars();
}

var Ajax = {
  getTransport: function() {
    var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
	}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
  },
    showLoading:function(element,type)
    {
            //alert(element)

        if(type){
            if(!$("pop_bg")){
		        var win = document.createElement("DIV");
		        win.setAttribute("id", "pop_bg");
		        win.style.zIndex="820";
		        document.body.appendChild(win);
                var height=document.body.offsetHeight;
                win.style.height=height+"px";
		        win.innerHTML='<iframe src="" frameborder="0" style="position:absolute;  top:0px; left:0px; width:100%; height:'+height+'px; " ></iframe>';
		    }else{
    	        layerShow("pop_bg");
		    }
		    var box=$(element+"_loading");
	        if(!box)
	        {
	    	    box = document.createElement("DIV");
	            box.id=element+"_loading";
                box.style.zIndex=822;
                box.className="alertpop";
                box.innerHTML="<div style='margin-left:80px' class='loading'>数据加载中...</div>" 
                document.body.appendChild(box);
            }
            layerShow(box);
        }else{
	        var element=$(element);
	        if(!element)
	        {
		        return;
	        }
	        var divLoading=$(element.id+"_loading");
	        if(!divLoading)
	        {
		        divLoading=document.createElement("div");
		        divLoading.id=element.id+"_loading";
		        divLoading.className="loading";
		        divLoading.style.position = "absolute";
		        divLoading.style.top ="10px";
		        divLoading.style.left = (element.offsetWidth - 120)/2+"px";
		        divLoading.innerHTML="数据加载中...";
                element.appendChild(divLoading);
	        }
	        layerShow(divLoading);
	   } 
    },
   hideLoading:function(element,type)
    {
        if(type){
            layerHide("pop_bg")
           	var divLoading=$(element+"_loading");
	        layerHide(divLoading);
        }else{
	        var divLoading=$(element+"_loading");
	        if(!divLoading)
	        {
		        return;
	        }
	        layerHide(divLoading);
	    }
    } 
}
Ajax.Base = function() {};
Ajax.Base.prototype = {
  setOptions: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      encoding:     'UTF-8',
      parameters:   ''
    }
    Object.extend(this.options, options || {});
  }
}
Ajax.Request = Class.create();
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
 	initialize: function(url, options) {
    	this.transport = Ajax.getTransport();
    	this.setOptions(options);
   		this.request(url);
	},
	request:function(url){
		if(this.transport){
			var loader=this;
			this.transport.onreadystatechange=function(){
				loader.onReadyState.call(loader);
			}
			this.transport.open(this.options.method,url,this.options.asynchronous);
			this.transport.setRequestHeader('Content-type',this.options.contentType);
			this.transport.send(this.options.parameters);
		}
	},
	onReadyState:function(){
		if(this.transport.readyState==4){
				if (this.transport.status==200){
					this.options.onSuccess(this.transport);
				}
		}
	}
})
Ajax.Updater = Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
	 initialize: function(element,url, options) {
    	this.element = element;
    	this.transport = Ajax.getTransport();
    	this.setOptions(options);
   		this.request(url);
	},
	onReadyState:function(){
		if(this.transport.readyState==4){
				if (this.transport.status==200){
					$(this.element).innerHTML=this.transport.responseText;
					this.options.onComplete();
				}
		}
	}
})
Number.prototype.ToString = function (format)
{
    if(format == null)
    {
        return "" + this;
    }
    if(format == "00")
    {
        if(this >= 0 && this <= 9)
        {
            return "0" + this;
        }
    }
    return "" + this;
}
   var net=new Object();
net.tab={};
net.tab.objSelect=function(clickobj,obj,elem){
    for(var i=0;i<obj.length;i++)
    {
        obj[i].className="";
	    $(elem+"_"+i).style.display="none";
    }
    $(elem+"_"+clickobj.getAttribute("name")).style.display="";
    clickobj.className="selected"; 
}

net.tab.menuEvent=function(elem,num,flag){
    var objs=$(elem).getElementsByTagName("li");
       objs[num].className="selected";

       var conobj=$(elem+"_"+num);
       conobj.style.display="";

        net.tab.addEvent(objs,function (){
            net.tab.objSelect(this,objs,elem);
        },flag);
}

net.tab.addEvent=function(elems,fun,flag){
    for (var i=0;i<elems.length;i++)
    {
        elems[i].setAttribute("name",i);
        elems[i].onclick=fun;
		if(flag){
			elems[i].onmouseover=fun;
			}
    }
}

gov.scroll={
	scrollLoadHandler:[],
	registerscrollLoadHandler: function(handler){
		gov.scroll.scrollLoadHandler.push(handler);
	},
	scrollLoad: function(){
		var len=gov.scroll.scrollLoadHandler.length;
		if(len==0){
			window.onscroll=null;
			return;
		}
		var pageTop=function(){
			return document.documentElement.clientHeight+Math.max(document.documentElement.scrollTop,document.body.scrollTop);
		};
		var getTop=function(element){
		　　　　var actualTop = element.offsetTop;
		　　　　var current = element.offsetParent;
		
		　　　　while (current !== null){
		　　　　　　actualTop += current.offsetTop;
		　　　　　　current = current.offsetParent;
		　　　　}
		　　　　return actualTop;
		}

		for(var i=0;i<gov.scroll.scrollLoadHandler.length;i++){
			var option=gov.scroll.scrollLoadHandler[i];
			if($(option.obj)){
				if (getTop($(option.obj))<=pageTop()){
					if(typeof(option.fun) == 'function'){
						option.fun();
					}
					gov.scroll.scrollLoadHandler.splice(i,1);
					i--
				}
			}
		}
	},
	setscrollLoad:function(){
		window.onscroll = function () {
			gov.scroll.scrollLoad();
		}
		gov.scroll.scrollLoad();
	}
}

gov.shopcar = function()
{
    if(parent.$('ifmCart'))
    {
        parent.ifmCart.location.reload();
    }
}
gov.shopcarinfo = function()
{
    if(parent.$("LtypeCart_info"))
    {
        if(parent.$("LtypeCart_info").innerHTML!='')
        {
            parent.ifmLtypeCart.location.reload();
        }
    }
}
gov.confirmInfo = function(msg, txtOk, txtCancel, fnOk, fnCancel) {
     new parent.gov.config.confirmInfo(msg, txtOk, txtCancel, fnOk, fnCancel).open();
};
gov.config.confirmInfo=Class.create();
gov.config.confirmInfo.prototype= Object.extend(new gov.config.alert(),{
 	   initialize: function(text, txtOk, txtCancel, fnOk, fnCancel) {
    	   this.classname = "alertpop";
    	   this.html='<h3>提示信息<a  title="关闭" onclick="gov.close('+(winid+1)+');return false">关闭</a></h3>';
    	   this.html+='<div class="alertpop_info_q">'+text+'</div>' 
    	   this.html+='<div class="alertpop_info_q_bt"><input type="button" id="chipinStep_box_btn2" name="Submit" class="button3 firstButton" style="cursor:pointer" value="'+txtOk+'" onclick="gov.close('+(winid+1)+');'+fnOk+'"><input type="button" name="clear" class="button3" style="cursor:pointer" value="'+txtCancel+'" onclick="gov.close('+(winid+1)+');'+fnCancel+'"></div>';
	   }
});
gov.shopcarchipintxt = '已加入购物车';
gov.shopcarplantxt = '当前多期投注购物车已经提交,请在订单过期之前去电话确认';
/// new popOpen
gov.popOpen1 = function(src, title, className) {
    var pop;
    var __className;
    
    if(className != null && className != '')
        __className = className;
    else
        __className = "chipinpop";
    
    if(parent.gov){
        pop=new parent.gov.config.chipinPop1(src,title, __className);
        var obj=pop.open();
        if(obj){ 
            parent.gov.config.reIframe1(obj.id);
        } 
    }else{
        pop=new gov.config.chipinPop1(src,title, __className);
        var obj=pop.open();
        if(obj){ 
            gov.config.reIframe1(obj.id);
        } 
    }
};

gov.config.reIframe1=function(dom){
    window["reinit_"+dom] =window.setInterval("gov.config.reinitIframe1('"+dom+"')", 200);
}
gov.config.reinitIframe1=function(dom){
	         var  iframe=$(dom);
             try{
                    var height =  iframe.contentWindow.document.documentElement.scrollHeight;
 
                    var width =  iframe.contentWindow.document.documentElement.scrollWidth;
					var isIE6 = false;
					if(navigator.userAgent.toLowerCase().search(/msie\s+6\.0/)>-1)isIE6 = true;

                    iframe.height=height;
                    iframe.width=width;
					
					var iframeParent = iframe.parentNode||iframe.parentElement;
					var box = iframeParent.parentNode || parentNode.parentElement;
                    box.style.width=width+20+"px";
					iframe.style.marginTop="10px"; 
							
					//alert(isIE6);
					if(iframe.height>460){
						iframeParent.style.height = 460+'px';
						iframeParent.style.overflow = 'auto';
						box.style.cssText += '; margin-top:0px !important; margin-left:0px !important;';
						box.style.zIndex = 821;
						box.style.left = ($visualArea().w - width)/2 + 'px';
						box.style.top = (isIE6?document.documentElement.scrollTop:0) + ($visualArea().h - 500)/2 + 'px';
					}else{
						iframeParent.style.height = '';
						box.style.cssText += '; margin-top:0px !important; margin-left:0px !important;';
						box.style.zIndex = 821;
						box.style.left = ($visualArea().w - width)/2 + 'px';
						box.style.top = (isIE6?document.documentElement.scrollTop:0) + ($visualArea().h - height)/2 + 'px';
					}
            }catch (ex){}
		function $visualArea(){
			var w,h;
			 w = (window.innerWidth)? 
			 window.innerWidth: 
				(document.documentElement && document.documentElement.clientWidth)? 
				document.documentElement.clientWidth: 
				document.body.offsetWidth; 
			h = (window.innerHeight)? 
			window.innerHeight: 
				(document.documentElement && document.documentElement.clientHeight)? 
				document.documentElement.clientHeight: 
				document.body.offsetHeight; 
			return {w:w,h:h}; 
		};
}
gov.config.chipinPop1=Class.create();
gov.config.chipinPop1.prototype = Object.extend(new gov.config.alert(),{
 	   initialize: function(src,title) {
 	                  this.ifrmid=winid+1;

 	       this.title=title||"信息窗口";
    	   this.classname = "chipinpop";
    	  this.html=""; 
           if(title){
                      this.title=title;
                      this.html = '<h3><span id="title_chipinpop">'+this.title+'</span><a href="#" title="关闭" onclick="gov.close('+(winid+1)+');;return false">关闭</a></h3>'; 
           } 
		   this.html += '<div><iframe width=562  frameborder=0  marginwidth=0 marginheight=0 scrolling=no name=\"popiframe\" id=\"popiframe'+this.ifrmid+'\" src='+src+' allowTransparency></iframe></div>';   
	   }
});
