﻿/*!
 * lhgcore Dialog Plugin v3.5.2
 * Date : 2011-07-03 11:03:11
 * Copyright (c) 2009 - 2011 By Li Hui Gang
 */
(function(a){var b=window,c,d,e,f=a.browser.msie&&a.browser.version<7?!0:!1,g=f?'<iframe hideFocus="true" frameborder="0" src="about:blank" style="position:absolute;z-index:-1;width:100%;height:100%;top:0px;left:0px;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>':"",h=function(a){a=a||document;return a.compatMode=="CSS1Compat"?a.documentElement:a.body},i=function(){e||(e=1976);return++e},j=function(){if("pageXOffset"in b)return{x:b.pageXOffset||0,y:b.pageYOffset||0};var a=h(c);return{x:a.scrollLeft||0,y:a.scrollTop||0}},k=function(){var a=h(c);return{w:a.clientWidth||0,h:a.clientHeight||0}},l=function(){var a=document.getElementsByTagName("script"),b="",c=0,d=a.length,e=/lhgdialog(?:\.min)?\.js/i;for(;c<d;c++)if(e.test(a[c].src)){b=!document.querySelector?a[c].getAttribute("src",4):a[c].src;break}return b.split("?")}(),m=l[0].substr(0,l[0].lastIndexOf("/")+1),n=function(a){if(l[1]){var b=l[1].split("&"),c=0,d=b.length,e;for(;c<d;c++){e=b[c].split("=");if(a===e[0])return e[1]}}return null},o=n("s")||"default",p=function(){var b=h(c);a(d).css({width:Math.max(b.scrollWidth,b.clientWidth||0)-1+"px",height:Math.max(b.scrollHeight,b.clientHeight||0)-1+"px"})};while(b.parent&&b.parent!=b){try{if(b.parent.document.domain!=document.domain)break}catch(q){break}b=b.parent}if(n("t")==="self"||b.document.getElementsByTagName("frameset").length>0)b=window;c=b.document;try{c.execCommand("BackgroundImageCache",!1,!0)}catch(q){}o=o.split(",");for(var r=0,s=o.length;r<s;r++)a("head",c).append('<link href="'+m+"skins/"+o[r]+'.css" rel="stylesheet" type="text/css"/>');a.fn.fixie6png=function(){var b=a("*",this),c,d;for(var e=0,f=b.length;e<f;e++)c=a(b[e]).css("ie6png"),d=m+"skins/"+c,c&&(b[e].style.backgroundImage="none",b[e].runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+d+"',sizingMethod='scale')")},a.fn.dialog=function(b){var c=!1;this[0]&&(c=new a.dialog(b),this.bind("click",c.ShowDialog));return c},a.dialog=function(l){var m=this,n,q,r,s,t,u,v,w,x,y=a.extend({title:"lhgdialog \u5f39\u51fa\u7a97\u53e3",cover:!1,titleBar:!0,btnBar:!0,xButton:!0,maxBtn:!0,minBtn:!1,cancelBtn:!0,width:400,height:300,id:"lhgdgId",link:!1,html:null,page:null,parent:null,dgOnLoad:null,onXclick:null,onCancel:null,onMinSize:null,fixed:!1,top:"center",left:"center",drag:!0,skin:o[0],resize:!0,autoSize:!1,rang:!1,timer:null,iconTitle:!0,bgcolor:"#fff",opacity:.5,args:null,lockScroll:!1,autoPos:!1,autoCloseFn:null,cancelBtnTxt:"\u53d6\u6d88",loadingText:"\u7a97\u53e3\u5185\u5bb9\u52a0\u8f7d\u4e2d\uff0c\u8bf7\u7a0d\u7b49..."},l||{}),z,A={},B=!1,C,D=function(a){var b=a.style,d=h(c),e=parseInt(b.left)-d.scrollLeft,f=parseInt(b.top)-d.scrollTop;b.removeExpression("left"),b.removeExpression("top"),b.setExpression("left","this.ownerDocument.documentElement.scrollLeft"+e),b.setExpression("top","this.ownerDocument.documentElement.scrollTop + "+f)},E=function(){var a,b;y.html?typeof y.html=="string"?a='<div id="lhgdg_inbox_'+y.id+'" class="lhgdg_inbox_'+y.skin+'" style="display:none">'+y.html+"</div>":a='<div id="lhgdg_inbox_'+y.id+'" class="lhgdg_inbox_'+y.skin+'" style="display:none"></div>':y.page&&(a='<iframe id="lhgfrm_'+y.id+'" frameborder="0" src="'+y.page+'" '+'scrolling="auto" style="display:none;width:100%;height:100%;"></iframe>'),b=['<div id="lhgdlg_',y.id,'" class="lhgdialog_',y.skin,'" style="width:',y.width,"px;height:",y.height,'px;">','<table border="0" cellspacing="0" cellpadding="0" width="100%">',"<tr>",'<td class="lhgdg_leftTop_',y.skin,'"></td>','<td id="lhgdg_drag_',y.id,'" class="lhgdg_top_',y.skin,'">',y.titleBar?'<div class="lhgdg_title_icon_'+y.skin+'">'+(y.iconTitle?'<div class="lhgdg_icon_'+y.skin+'"></div>':"")+'<div class="lhgdg_title_'+y.skin+'">'+y.title+"</div>"+(y.minBtn?'<a class="lhgdg_minbtn_'+y.skin+'" id="lhgdg_minbtn_'+y.id+'" href="javascript:void(0);" target="_self"></a>':"")+(y.maxBtn?'<a class="lhgdg_maxbtn_'+y.skin+'" id="lhgdg_maxbtn_'+y.id+'" href="javascript:void(0);" target="_self"></a>':"")+(y.xButton?'<a class="lhgdg_xbtn_'+y.skin+'" id="lhgdg_xbtn_'+y.id+'" href="javascript:void(0);" target="_self"></a>':"")+"</div>":"","</td>",'<td class="lhgdg_rightTop_',y.skin,'"></td>',"</tr>","<tr>",'<td class="lhgdg_left_',y.skin,'"></td>',"<td>",'<table border="0" cellspacing="0" cellpadding="0" width="100%">',"<tr>",'<td id="lhgdg_content_',y.id,'" style="background-color:#fff">',a,'<div id="lhgdg_load_',y.id,'" class="lhgdg_load_',y.skin,'"><span>',y.loadingText,"</span></div>","</td>","</tr>",y.btnBar?'<tr><td id="lhgdg_btnBar_'+y.id+'" class="lhgdg_btnBar_'+y.skin+'"><div class="lhgdg_btn_div_'+y.skin+'"></div></td></tr>':"","</table>","</td>",'<td class="lhgdg_right_',y.skin,'"></td>',"</tr>","<tr>",'<td class="lhgdg_leftBottom_',y.skin,'"></td>','<td class="lhgdg_bottom_',y.skin,'"></td>','<td id="lhgdg_drop_',y.id,'" class="lhgdg_rightBottom_',y.skin,'"></td>',"</tr>","</table>",g,"</div>"].join("");return b},F=function(){d=a("#lhgdgCover",c)[0];if(!d){var e='<div id="lhgdgCover" style="position:absolute;top:0px;left:0px;background-color:'+y.bgcolor+';">'+g+"</div>";d=a(e,c).css("opacity",y.opacity).appendTo(c.body)[0]}y.lockScroll&&a("html",c).addClass("lhgdg_lockScroll"),a(b).bind("resize",p),p(),a(d).css({display:"",zIndex:i()})},G=function(b,c,d,e){var g=k(),h=j(),i=parseInt(b.style.width,10),l=parseInt(b.style.height,10),m,n,o,p,q,r,s,t;e?(o=f?h.x:0,p=f?g.w+h.x-i:g.w-i,q=f?(p+h.x-20)/2:(p-20)/2,r=f?h.y:0,s=f?g.h+h.y-l:g.h-l,t=f?(s+h.y-20)/2:(s-20)/2):(o=h.x,q=h.x+(g.w-i-20)/2,p=h.x+g.w-i,r=h.y,t=h.y+(g.h-l-20)/2,s=h.y+g.h-l);switch(d){case"center":m=q;break;case"left":m=o;break;case"right":m=p;break;default:e&&f&&(d=d+h.x),m=d}switch(c){case"center":n=t;break;case"top":n=r;break;case"bottom":n=s;break;default:e&&f&&(c=c+h.y),n=c}n<h.y&&!e&&(n=h.y),a(b).css({top:n+"px",left:m+"px"}),e&&f&&D(b)},H=function(d){m.curWin=window,m.curDoc=document,a(d).bind("contextmenu",function(a){a.preventDefault()}).bind("mousedown",N),y.html&&y.html.nodeType&&(a(q).append(y.html),y.html.style.display=""),w=[window],b!=window&&w.push(b),y.page&&(m.dgFrm=a("#lhgfrm_"+y.id,c)[0],y.link||(m.dgWin=m.dgFrm.contentWindow,m.dgFrm.lhgDG=m),a(m.dgFrm).bind("load",function(){this.style.display="block";if(!y.link){var b=a.browser.msie?m.dgWin.document:m.dgWin;a(b).bind("mousedown",N),w.push(m.dgWin),m.dgDoc=m.dgWin.document,y.autoSize&&K(),a.isFunction(y.dgOnLoad)&&y.dgOnLoad.call(m)}n.style.display="none"})),y.xButton&&y.titleBar&&a(r).bind("click",y.onXclick||m.cancel),y.maxBtn&&y.titleBar&&(a(z).bind("click",m.maxSize),a(s).bind("dblclick",m.maxSize)),y.minBtn&&y.titleBar&&a.isFunction(y.onMinSize)&&a(C).bind("click",y.onMinSize)},I=function(a){var b=s.offsetHeight,c=t.offsetHeight,d=y.btnBar?v.offsetHeight:0,e=parseInt(a.style.height,10)-b-c-d;e<0&&(e=20),n.style.lineHeight=e+"px",u.style.height=e+"px"},K=function(){var a=s.offsetHeight,b=t.offsetHeight,c=y.btnBar?v.offsetHeight:0,d=t.offsetWidth*2,e,f,g;if(y.html)e=Math.max(q.scrollHeight,q.clientHeight||0),f=Math.max(q.scrollWidth,q.clientWidth||0);else if(y.page&&!y.link){if(!m.dgDoc)return;g=h(m.dgDoc),e=Math.max(g.scrollHeight,g.clientHeight||0),f=Math.max(g.scrollWidth,g.clientWidth||0)}e=e+a+b+c,f=f+d,m.reDialogSize(f,e),G(m.dg,"center","center",y.fixed)},L=function(b){function p(d){for(var e=0,g=i.length;e<g;e++)a(i[e].document).unbind("mousemove",o),a(i[e].document).unbind("mouseup",p);c=null,b=null,h.y<n.y&&(m.dg.style.top=n.y+"px"),y.fixed&&f&&D(m.dg),a.browser.msie&&m.dg.releaseCapture()}function o(a){var b={x:a.screenX,y:a.screenY};h={x:h.x+(b.x-c.x),y:h.y+(b.y-c.y)},c=b,y.rang&&(h.x<n.x&&(h.x=n.x),h.y<n.y&&(h.y=n.y),h.x>d&&(h.x=d),h.y>g&&(h.y=g)),m.dg.style.top=y.fixed&&!f?h.y-n.y+"px":h.y+"px",m.dg.style.left=y.fixed&&!f?h.x-n.x+"px":h.x+"px"}var c,d,g,h,i=w,l,n;a(b).bind("mousedown",function(b){if(b.target.id!=="lhgdg_xbtn_"+y.id){l=k(),n=j();var q=m.dg.offsetLeft,r=m.dg.offsetTop,s=m.dg.clientWidth,t=m.dg.clientHeight;h=y.fixed&&!f?{x:q+n.x,y:r+n.y}:{x:q,y:r},c={x:b.screenX,y:b.screenY},d=l.w+n.x-s,g=l.h+n.y-t,m.dg.style.zIndex=parseInt(e,10)+1;for(var u=0,v=i.length;u<v;u++)a(i[u].document).bind("mousemove",o),a(i[u].document).bind("mouseup",p);b.preventDefault(),a.browser.msie&&m.dg.setCapture()}})},M=function(b){function p(d){for(var e=0,f=h.length;e<f;e++)a(h[e].document).unbind("mousemove",o),a(h[e].document).unbind("mouseup",p);c=null,b=null,a.browser.msie&&m.dg.releaseCapture()}function o(a){var b={x:a.screenX,y:a.screenY};i={w:b.x-c.x,h:b.y-c.y},i.w<200&&(i.w=200),i.h<100&&(i.h=100),m.dg.style.top=y.fixed?g.y-n.y+"px":g.y+"px",m.dg.style.left=y.fixed?g.x-n.x+"px":g.x+"px",m.reDialogSize(i.w,i.h)}var c,d,f,g,h=w,i,l,n;a(b).bind("mousedown",function(b){f=m.dg.clientWidth,d=m.dg.clientHeight,i={w:f,h:d},l=k(),n=j();var q=m.dg.offsetLeft,r=m.dg.offsetTop;g=y.fixed?{x:q+n.x,y:r+n.y}:{x:q,y:r},c={x:b.screenX-f,y:b.screenY-d},m.dg.style.zIndex=parseInt(e,10)+1;for(var s=0,t=h.length;s<t;s++)a(h[s].document).bind("mousemove",o),a(h[s].document).bind("mouseup",p);b.preventDefault(),a.browser.msie&&m.dg.setCapture()})},N=function(a){m.dg.style.zIndex=parseInt(e,10)+1,e=parseInt(m.dg.style.zIndex,10),a.stopPropagation()},O=function(){y.autoPos===!0&&(y.autoPos={left:"center",top:"center"}),G(m.dg,y.autoPos.top,y.autoPos.left,y.fixed)},P=function(){a.isFunction(y.onCancel)&&y.onCancel.call(m),m.cancel()},Q=function(){m.dgFrm&&(y.link||a(m.dgFrm).unbind("load"),m.dgFrm.src="about:blank",m.dgFrm=null),y.html&&y.html.nodeType&&(a(m.curDoc.body).append(y.html),y.html.style.display="none"),y.autoPos&&a(b).unbind("resize",O),w=[],a(m.dg).remove(),m.dg=null,B=!1,A={},n=q=r=s=t=v=u=z=C=null};m.ShowDialog=function(){if(a("#lhgdlg_"+y.id,c)[0])return m;y.cover&&F(),y.fixed&&(y.maxBtn=!1,y.minBtn=!1);var d=y.fixed&&!f?"fixed":"absolute",e=E();m.dg=a(e,c).css({position:d,zIndex:i()}).appendTo(c.body)[0],n=a("#lhgdg_load_"+y.id,c)[0],q=a("#lhgdg_inbox_"+y.id,c)[0],r=a("#lhgdg_xbtn_"+y.id,c)[0],s=a("#lhgdg_drag_"+y.id,c)[0],t=a("#lhgdg_drop_"+y.id,c)[0],v=a("#lhgdg_btnBar_"+y.id,c)[0],u=a("#lhgdg_content_"+y.id,c)[0],z=a("#lhgdg_maxbtn_"+y.id,c)[0],C=a("#lhgdg_minbtn_"+y.id,c)[0],I(m.dg),G(m.dg,y.top,y.left,y.fixed),H(m.dg),y.drag?L(s):s.style.cursor="default",y.resize?M(t):t.style.cursor="default",f&&a(t).css("ie6png")&&a(m.dg).fixie6png(),y.btnBar&&y.cancelBtn&&m.addBtn("dgcancelBtn",y.cancelBtnTxt,P),y.html&&(n.style.display="none",q.style.display="",y.autoSize&&K()),y.timer&&m.closeTime(y.timer,y.autoCloseFn),y.html&&a.isFunction(y.dgOnLoad)&&y.dgOnLoad.call(m),y.autoPos&&a(b).bind("resize",O)},m.reDialogSize=function(b,c){a(m.dg).css({width:b+"px",height:c+"px"}),I(m.dg)},m.maxSize=function(){var b,c;b=k(),c=j(),B?(m.reDialogSize(A.dgW,A.dgH),a(m.dg).css({top:A.dgT,left:A.dgL}),a(z).addClass("lhgdg_maxbtn_"+y.skin).removeClass("lhgdg_rebtn_"+y.skin),y.drag&&(L(s),s.style.cursor="move"),y.resize&&(M(t),t.style.cursor="nw-resize"),B=!1):(A.dgW=m.dg.offsetWidth,A.dgH=m.dg.offsetHeight,A.dgT=m.dg.style.top,A.dgL=m.dg.style.left,a(m.dg).css({top:c.y+"px",left:c.x+"px"}),m.reDialogSize(b.w,b.h),a(z).addClass("lhgdg_rebtn_"+y.skin).removeClass("lhgdg_maxbtn_"+y.skin),y.drag&&a(s).unbind("mousedown").css("cursor","default"),y.resize&&a(t).unbind("mousedown").css("cursor","default"),B=!0)},m.SetMinBtn=function(b){y.minBtn&&y.titleBar&&a.isFunction(b)&&a(C).unbind("click").bind("click",b)},m.addBtn=function(b,d,e,f){f=f||"left";if(y.btnBar)if(a("#lhgdg_"+y.id+"_"+b,c)[0])a("#lhgdg_"+y.id+"_"+b,c).html("<em>"+d+"</em>").unbind("click").bind("click",e);else{var g='<a id="lhgdg_'+y.id+"_"+b+'" class="lhgdg_button_'+y.skin+'" href="javascript:void(0);" target="_self"><em>'+d+"</em></a>",h=a(g,c).bind("click",e)[0];f==="left"?a(".lhgdg_btn_div_"+y.skin,v).prepend(h):a(".lhgdg_btn_div_"+y.skin,v).append(h)}},m.removeBtn=function(b){a("#lhgdg_"+y.id+"_"+b,c)[0]&&a("#lhgdg_"+y.id+"_"+b,c).remove()},m.SetIndex=function(){m.dg.style.zIndex=parseInt(e,10)+1,e=parseInt(m.dg.style.zIndex,10)},m.SetXbtn=function(b,c){y.xButton&&y.titleBar&&(a.isFunction(b)&&a(r).unbind("click").bind("click",b),c?r.style.display="none":r.style.display="")},m.SetTitle=function(b){y.titleBar&&typeof b=="string"&&a(".lhgdg_title_"+y.skin,m.dg).html(b)},m.cancel=function(){Q();if(d){if(y.parent&&y.parent.isCover){var b=y.parent.dg.style.zIndex;d.style.zIndex=parseInt(b,10)-1}else d.style.display="none";y.lockScroll&&a("html",c).removeClass("lhgdg_lockScroll")}},m.cleanDialog=function(){m.dg&&Q(),d&&(a(d).remove(),d=null)},m.closeTime=function(a,b,c){x&&clearTimeout(x),b&&b.call(m),a&&(x=setTimeout(function(){c&&c.call(m),m.cancel(),clearTimeout(x)},1e3*a))},m.SetPosition=function(a,b){G(m.dg,b,a,y.fixed)},m.iWin=function(b){if(a("#lhgfrm_"+b,c)[0])return a("#lhgfrm_"+b,c)[0].contentWindow;return null},m.iDoc=function(b){if(a("#lhgfrm_"+b,c)[0])return a("#lhgfrm_"+b,c)[0].contentWindow.document;return null},m.iDG=function(a){return c.getElementById("lhgdlg_"+a)||null},m.SetCancelBtn=function(b,d){d=d||m.cancel,a("#lhgdg_"+y.id+"_dgcancelBtn",c)[0]&&a("#lhgdg_"+y.id+"_dgcancelBtn",c).html("<em>"+b+"</em>").unbind("click").bind("click",d)},m.setArgs=function(a){y.args=a},m.getArgs=function(){return y.args},m.dialogId=y.id,m.parent=y.parent,m.isCover=y.cover?!0:!1,a(window).bind("unload",m.cleanDialog)},a(function(){var b=setTimeout(function(){(new a.dialog({id:"reLoadId",html:"lhgdialog",width:100,title:"reLoad",height:100,left:-9e3,btnBar:!1})).ShowDialog(),clearTimeout(b)},150)})})(window.lhgcore||window.jQuery);
