document.domain = "zhiji.com";
var forumiframecomplete=false;
function checkforumiframecomplete(){ return forumiframecomplete;};
function setforumiframecomplete(){ forumiframecomplete = true;};
function checkpagecomplete(){if (document.readyState == "complete") setforumiframecomplete(); else window.setTimeout(checkpagecomplete,1000);};
function set10second(){ setforumiframecomplete();};
checkpagecomplete();
window.setTimeout(set10second,10000);//页面10秒之后，无论iframe是否加载完，都释放
String.prototype.Format=function(){var a=this;var b=arguments.length;for(var i=0;i<b;i+=1)a=a.replace(new RegExp("\\{"+i+"\\}","g"),arguments[i]);return a};
if(!window.Myjf) var Myjf=window.Myjf={};
(function(){
 var userAgent = navigator.userAgent.toLowerCase();
 Myjf.browser = {
 version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
 safari: /webkit/.test( userAgent ),
 opera: /opera/.test( userAgent ),
 msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
 mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
 };
 Myjf.Utility={//通用工具
 fadeIn:function(b,c,d){Myjf.Utility.setOpacity(b,0);Myjf.Utility.show(b);for(var i=0;i<=100;i+=5){(function(){var a=i;setTimeout(function(){Myjf.Utility.setOpacity(b,(a/100)*c)},(i+1)*d)})()}},
 fadeOut:function(b,c,d,e){for(var i=0;i<100;i+=2){(function(){var a=i;setTimeout(function(){Myjf.Utility.setOpacity(b,100-a);if(a==98){if(!d)Myjf.Utility.hide(b);else Myjf.Utility.removeNode(b);e()}},(i+1)*c)})()}},
 getStyle:function(a,b){if(a.style[b])return a.style[b];else if(a.currentStyle)return a.currentStyle[b];else if(document.defaultView&&document.defaultView.getComputedStyle){b=b.replace(/([A-Z])/g,"-$1");b=b.toLowerCase();var s=document.defaultView.getComputedStyle(a,"");return s&&s.getPropertyValue(b)}else return null},
 hide:function(a){var b=Myjf.Utility.getStyle(a,"display");if(b!="none")a.$oldDisplay=b;a.style.display="none";return Myjf.Utility},
 show:function(a){a.style.display=a.$oldDisplay||"block";return Myjf.Utility},
 removeNode:function(a){a.parentNode&&a.parentNode.removeChild(a);return Myjf.Utility},
 setOpacity:function(a,b){if(a.filters)a.style.filter="alpha(opacity="+b+")";else a.style.opacity=b/100;return Myjf.Utility},
 setX:function(a,b){a.style.left=b+"px";return Myjf.Utility},
 setY:function(a,b){a.style.top=b+"px";return Myjf.Utility},
 StopDefault:function(e){if(e&&e.preventDefault)e.prefentDefault();else window.event.returnValue=false;return false},
 cancelBubble:function(a){a=a||window.event;if(window.event)a.cancelBubble=true;else a.stopPropagation()},
 Event: {//事件
 addEventHandler:function(a,b,c,d){if(a.addEventListener)a.addEventListener(b,c,d);else if(a.attachEvent)a.attachEvent("on"+b,c);else a["on"+b]=c},
 removeEventHandler:function(a,b,c,d){if(a.removeEventListener)a.removeEventListener(b,c,d);else if(a.detachEvent)a.detachEvent('on'+b,c);else a['on'+b]=null},
 getCurrentElem:function(a){a=a||window.event;return a.srcElement||a.target}
 },
 Postion: {
 scrollX:function(){var a=document.documentElement;return self.pageXOffset||(a&&a.scrollLeft)||document.body.scrollLeft||0},
 scrollY:function(){var a=document.documentElement;return self.pageYOffset||(a&&a.scrollTop)||document.body.scrollTop||0},
 windowWidth:function(){var a=document.documentElement;return self.innerWidth||(a&&a.clientWidth)||document.body.clientWidth},
 windowHeight:function(){var a=document.documentElement;return self.innerHeight||(a&&a.clientHeight)||document.body.clientHeight},
 pageWidth:function(){return document.body.scrollWidth},
 pageHeight:function(){return document.body.scrollHeight}
 }
 };
 var Utility=Myjf.Utility,
 Layer={
 zIndex:20009,
 Hash:{},
 Config:{
 bg:'<iframe id="pop_bg2_{0}" scrolling=0 frameborder=0 class="pop_BackGround" ></iframe>'+
 '<div id="pop_bg1_{0}" class="pop_BackGround" ></div>',
 p2:'<div class="pop_Content2" id="{3}{0}">'+
	 '<h1 id="{4}{0}"><span id="pop_title_{0}" class="pop_Title">{6}</span></h1><span class="pop_close" title="关闭"><img id="{5}{0}" src="http://www.zhiji.com/public_js_css/images/con_002.gif" border="0" /></h2></span>'+
	 '<div class="pop_Main"><div id="pop_loading_{0}" style="font-size:12px;"><img src="http://www.zhiji.com/public_js_css/images/indicator.gif" border="0" alt="" /> 请稍候...</div><iframe id="pop_frame_{0}" frameborder="0" scrolling="no" haslayout="-1" src="{1}"></iframe></div><div id="checkNoCookie_{0}" style="display:none;"></div>'
,p3:'<div class="pop_Content_II" id="{3}{0}">'+
	 '<div class="pop_main">'+
	 '<div class="pop_Header">'+
	 '<div id="{4}{0}"><h3 id="pop_title_{0}" class="pop_title_II">{6}</h3></div>'+
	 '<div class="pop_Content_opt"><a href="javascript:;" id="{5}{0}" title="关闭" class="pop_Content_close">关闭</a></div>'+
	 '</div>'+
	 '<div class="pop_Main"><div id="pop_loading_{0}" style="font-size:12px;"> <img src="http://www.zhiji.com/public_js_css/images/indicator.gif" border="0" alt="" /> 请稍候...</div><iframe id="pop_frame_{0}" frameborder="0" scrolling="no" haslayout="-1" src="{1}"></iframe></div><div id="checkNoCookie_{0}" style="display:none;"></div>'+
	 '</div></div>'
},
 Show:function(config){//显示
 if(!config) throw {msg:'请输入参数'};
 var _json={
 panel: config.panel||'p3', //样式模板
 title: config.title||'', //标题
 tid: config.title||'pop_title_', //标题id
 cid: config.cid||'pop_cont_', //主内容id
 hid: config.hid||'pop_head_', //拖动id
 clid: config.clid||'pop_close_', //关闭id
 src: config.src||'', //iframe地址
 fcon: config.fcon||'', //底部内容
 follow: !!config.follow||false, //跟随
 move: !!config.move||false , //移动
 sSpeed: config.sSpeed||5, //淡进
 cSpeed: config.cSpeed||0, //关闭速度
 fSpeed: config.fSpeed||500, //跟随延迟
 callBack: config.callBack|| function(){}, //结束回调函数
 firstFun: config.firstFun|| function(){}, //预先执行函数
 noRand: config.noRand //是否添加随机值在url末尾
 };
 var _temdId= !!!_json.noRand ? Math.floor(Math.random()*10000000000) : 1;
 this.Hash[_temdId+'']=_json.cid+_temdId;
 var _div=document.createElement('div');
 _div.id='pop_container_'+_temdId;
 _div.style.display='none';
 _div.$MyjfId=_temdId;
 _div.$cSpeed=_json.cSpeed;
 _div.$callBack=_json.callBack;
 if(_json.src.indexOf('?')>0) _json.src=_json.src+'&rand='+_temdId;
 else _json.src=_json.src+'?rand='+_temdId;
 _div.innerHTML=this.Config.bg.Format(_temdId)+this.Config[_json.panel].Format(_temdId,_json.src,_json.fcon,_json.cid,_json.hid,_json.clid,_json.title);
 document.body.appendChild(_div);
 _json.firstFun(_temdId);
 this.SetBackGround("pop_bg2_"+_temdId,"pop_bg1_"+_temdId);
 var _close=document.getElementById(_json.clid+_temdId);
 if(_close){//绑定关闭
 Utility.Event.addEventHandler(_close,'click',Myjf.Layer.Close,false);
 _close.$MyjfId=_temdId;
 };
 this.BeMiddle(_temdId);//设置居中
 if(_json.follow) this.Follow(_json);//设置跟随
 if(_json.move){//设置拖动
 var _m=document.getElementById(_json.cid+_temdId);
 var _h=document.getElementById(_json.hid+_temdId);
 this.Drag(_h,_m,0,0);
 };
 Utility.fadeIn(_div,100,_json.sSpeed);
 },
 Close:function(evt){//关闭
 var num,_elem= Utility.Event.getCurrentElem(evt);
 if(!_elem.$MyjfId) return false;
 else num=_elem.$MyjfId;
 if(!Layer.Hash[num+'']) return false;
 var _o=document.getElementById('pop_container_'+num);
 var _con=document.getElementById(Layer.Hash[num+'']);
 var callBack=function(){
 Utility.removeNode(_o);
 _o.$callBack();
 };
 delete Layer.Hash[num+''];
 if(_o && _con) Utility.fadeOut(_con,_o.$cSpeed,true,callBack);
 Utility.cancelBubble(evt)
 },
 Follow:function(config){//跟随
 var timer;
 var scollEvent=function(){
 if(timer) return;
 timer = setTimeout(function() {
 var _winWidth = Utility.Postion.windowWidth(),
 _winHeight = Utility.Postion.windowHeight();
 for(var o in Layer.Hash){ 
 if(!o) continue;
 var _div=document.getElementById(Layer.Hash[o+'']);
 (function(w,h,sX,sY){
 //_div && Myjf.Utility.setX(_div,sX + (_winWidth-w)/2).setY(_div,sY +(_winHeight-h)/2); //动态控制
 _div && Utility.setX(_div,sX + (_winWidth-w)/2).setY(_div,sY +(_winHeight-450)/2);
 })(Utility.getStyle( _div , 'width').replace('px','')>>0, 
 Utility.getStyle( _div , 'height').replace('px','')>>0,
 Utility.Postion.scrollX(),
 Utility.Postion.scrollY());
 };
 timer=null;
 },config.fSpeed);
 };
 Utility.Event.addEventHandler(window,'scroll',scollEvent,false);
 Utility.Event.addEventHandler(window,'resize',scollEvent,false);
 Utility.Event.addEventHandler(window,'load',scollEvent,false);
 },
 BeMiddle:function(id){//居中
 var _div=document.getElementById(this.Hash[id+'']);
 var _width = Utility.getStyle( _div , 'width' );
 var _height = Utility.getStyle( _div , 'height');
 _div.style.left =( Utility.Postion.windowWidth()/2 - (_width.replace('px','')>>0)/2 + Utility.Postion.scrollX())  + 'px';
 //_div.style.top =( Utility.Postion.windowHeight()/2 - (_height.replace('px','')>>0)/2 + Utility.Postion.scrollY()) + 'px';   //动态控制
 _div.style.top =( Utility.Postion.windowHeight()/2 - (450>>0)/2 + Utility.Postion.scrollY()) + 'px';
 Layer.zIndex+=2;
 _div.style.zIndex= Layer.zIndex;
 },
 SetBackGround:function(){//设置背景宽度
 for(var i=0,j=arguments.length;i<j;i+=1) {
 (function(o,h,w){
 if(o){ o.style.height=h; o.style.width=w; Layer.zIndex+=1;o.style.zIndex=Layer.zIndex;};
 })(document.getElementById(arguments[i]),
 (Math.max(document.body.scrollHeight,document.body.offsetHeight)) + "px",
 (Math.max(document.body.scrollWidth,document.body.offsetWidth)) + "px");
 };
 },
 Drag:function(o,root,minX,minY,opacity){//移动
 !o.$Root&&(o.$Root=root||o);
 opacity = opacity||0.3;
 var x,y,_cloneItem = ['height','width','left','top'];
 var DragEvent={
 mousedown:function(evt){//拖动开始
 evt = evt || window.event;
 x = evt.layerX || evt.offsetX;
 y = evt.layerY || evt.offsetY;
 document.body.appendChild(_clone);
 Utility.Event.addEventHandler(document,'mousemove',DragEvent.move,false);
 Utility.Event.addEventHandler(document,'mouseup',DragEvent.end,false);
 Utility.hide(root);
 return false;
 },
 clone:function(e,opacity){//克隆对象样式
 var _div = document.createElement('div');
 _div.$handle = o;
 _div.$root = root;
 _div.className = 'clone';
 _div.style.filter = 'alpha(opacity='+(opacity * 100)+')';
 _div.style.opacity = opacity;
 for(var i=0;i<_cloneItem.length;i+=1) _div.style[_cloneItem[i]]=Utility.getStyle(e,_cloneItem[i]);
 return _div;
 },
 end:function(evt){//结束拖动
 evt = evt || window.event;
 _clone.$temp && Myjf.Utility.setX(_clone.$root,_clone.$temp.left).setY(_clone.$root,_clone.$temp.top);
 Utility.Event.removeEventHandler(document,'mousemove',DragEvent.move,false);
 Utility.removeNode(_clone).show(root);
 },
 compare:function(){//比较
 if(_clone.$minX != null) _clone.$temp.left = Math.max(_clone.$temp.left , _clone.$minX) + Utility.Postion.scrollX();
 if(_clone.$minY != null) _clone.$temp.top = Math.max(_clone.$temp.top , _clone.$minY) + Utility.Postion.scrollY(); 
 },
 move:function(evt){//移动
 evt = evt|| window.event;
 (function(left,top){
 _clone.$temp = {left:left,top:top};
 DragEvent.compare();
 Utility.setX(_clone,_clone.$temp.left).setY(_clone,_clone.$temp.top);
 })(evt.clientX- x ,evt.clientY- y )
 },
 zIndex:function(){//多窗体样式
 }
 };
 var _clone = DragEvent.clone(o.$Root,opacity);//克隆
 _clone.$minX	= typeof minX != 'undefined' ? minX : null;
 _clone.$minY	= typeof minY != 'undefined' ? minY : null;
 Utility.Event.addEventHandler(o,'mousedown',DragEvent.mousedown,false);
 }
 };
 Myjf.Layer=Layer;
 Myjf.Zhiji={
 Tools:{
 Layer:{
 GoTo:function(title,url){
 var _name=_title='';
 _name=url,_title=title;
 for(var i in Myjf.Layer.Hash){
 document.getElementById('pop_loading_'+i).style.display='block';
 if(_name.indexOf("?")>0) document.getElementById('pop_frame_'+i).src=_name+'&rand='+i;
 else document.getElementById('pop_frame_'+i).src=_name+'?rand='+i;
 document.getElementById('pop_title_'+i).innerHTML=_title;
  document.getElementById('pop_cont_'+i).style.height='50px';
};
 },
 Close:function(){
 //location.href=location.href;
 location.reload();
 }
 }
 }
 };
})();

function ShowLoginDiv(callBack){//弹出弹出层
  Myjf.Layer.Show({
  panel:'p3',title:'\u9700\u8981\u767b\u5f55\uff01',src:'http://www.zhiji.com/public_js_css/LoginDomain.asp',follow:true,move:true,cSpeed:0,
  firstFun:function(_temdId){
  for(var i in Myjf.Layer.Hash) document.getElementById('pop_cont_'+i).style.height='50px';
  },
  callBack:callBack
 });
}


function ShowRegDiv(callBack){//弹出注册层
  Myjf.Layer.Show({
  panel:'p3',title:'\u6ce8\u518c\uff01',src:'http://www.zhiji.com/public_js_css/regpre.asp',follow:true,move:true,cSpeed:0,
  firstFun:function(_temdId){
  for(var i in Myjf.Layer.Hash) document.getElementById('pop_cont_'+i).style.height='50px';
  },
  callBack:callBack
 });
}


function ShowOperateDiv(_title,_url){//显示公共层 模板2
 if (enableCommendPopWin){
 Myjf.Layer.Show({
 panel:'p2',title:unescape(_title)+'&nbsp;',src:unescape(_url),follow:true,move:true,cSpeed:5,
 firstFun:function(_temdId){
 for(var i in Myjf.Layer.Hash) document.getElementById('pop_cont_'+i).style.height='50px';
 }
 });
 }
}

function ShowCommonDiv(_title,_url){ //显示公共层  模板3
 if (enableCommendPopWin){
 Myjf.Layer.Show({
 panel:'p3',title:unescape(_title)+'&nbsp;',src:unescape(_url),follow:true,move:true,cSpeed:0,
 firstFun:function(_temdId){
 for(var i in Myjf.Layer.Hash) document.getElementById('pop_cont_'+_temdId).style.height='50px';
 }
 });
 }
}


function open_new_win(url){//打开新窗口
  window.open(url);
}



