﻿ /*

 * Compressed JBOX

 */

var jBox={minClass:"jbtnMin",closeClass:"jbtnClose",restoreClass:"jbtnRestore",resizeClass:"jbtnResize",boxes:[],minimizeorder:0,findBoxIndex:function(_){for(var $=0;$<jBox.boxes.length;$++)if(jBox.boxes[$].jBoxID==_)return $;return null},findBox:function(_){for(var $=0;$<jBox.boxes.length;$++)if(jBox.boxes[$].jBoxID==_)return jBox.boxes[$];return null},_maxZIndex:999,ie:document.all&&!window.opera,opera:window.opera,domBody:(document.compatMode=="CSS1Compat")?document.documentElement:document.body,pageXYOffset:function(){return[(jBox.ie)?jBox.domBody.scrollLeft:window.pageXOffset,(jBox.ie)?jBox.domBody.scrollTop:window.pageYOffset]},pageInnerSize:function(){var $=document.documentElement&&parseInt(document.documentElement.clientWidth)||100000;return[(jBox.ie)?jBox.domBody.clientWidth:(/Safari/i.test(navigator.userAgent))?window.innerWidth:Math.min($,window.innerWidth-16),(jBox.ie)?jBox.domBody.clientHeight:window.innerHeight]},pageSize:function(){var $;if(jBox.ie)$=[(document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth,(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight];else if(jBox.opera)$=[(document.body.scrollWidth>document.body.offsetWidth)?document.body.offsetWidth:document.body.scrollWidth,(document.body.scrollHeight>document.body.offsetHeight)?document.body.offsetHeight:document.body.scrollHeight];else $=[document.body.scrollWidth,window.innerHeight+window.scrollMaxY];return $},init:function(B){
var _=$("#jBoxHolder");if(_==undefined||_.length==0){_=$("<div id=\"jBoxHolder\"></div>");$(document.body).append(_)}
var A=$("<div class=\"jBox\" id=\""+B+"\"></div>").appendTo(_);
A.append("<div class=\"jBoxHandler\">jBox<div class=\"jBoxControls\"><div class=\""+jBox.minClass+"\" title=\"Minimize\"></div><div class=\""+jBox.closeClass+"\" title=\"Close\"></div></div></div>").append("<div class=\"jBoxContent\"></div>").append("<div class=\"jBoxButtons\"></div>").append("<div class=\"jBoxStatus\"><div class=\""+jBox.resizeClass+"\">&nbsp;</div></div>").append("<div class=\"jBoxUnderlay\" id=\"jBoxUnderlay\">&nbsp;</div>");A.css("zIndex",$("div.jBox").length+99);A.handler=A.find("div.jBoxHandler");A.controls=A.find("div.jBoxControls");A.content=A.find("div.jBoxContent");A.status=A.find("div.jBoxStatus");A.buttons=A.find("div.jBoxButtons");A.resize=A.find("div."+jBox.resizeClass);A.open=function(_,A,$){jBox.open(this,_,A,$)};A.load=function(_,A,$){jBox.load(this,_,A,$)};A.close=function(){if(A==undefined){A=jBox.boxes[0]}if(undefined!=this.onClosed)this.onClosed();return true};A.show=function(){jBox.show(this)};A.hide=function(){jBox.hide(this)};A.isResize=function($){jBox._isResize(this,$)};A.hasScroll=function($){jBox._hasScroll(this,$)};A.hasButtons=function($){jBox._hasButtons(this,$)};A.setSize=function($,_){jBox.setSize(this,$,_)};A.moveTo=function(_,$){jBox.moveTo(this,_,$)};A.jBoxID=B;jBox._maxZIndex;A.css("z-index",jBox._maxZIndex);A.bringUp=function(){if(A.css("z-index")<jBox._maxZIndex){jBox._maxZIndex++;A.css("z-index",jBox._maxZIndex)}};A.click(function(){jBox.findBox(this.id).bringUp()});this.boxes[this.boxes.length]=A;return A},open:function(id,type,source,title,attr){function getValue(Name){var config=new RegExp(Name+"=([^,]+)","i");return(config.test(attr))?eval("("+RegExp.$1+")"):0}var box=jBox.findBox(id);if(null==box){box=this.init(id);box.css("visibility","hidden");box.css("display","none");box.content.css("display","block");box.hasScroll(getValue("scrolling"));box.hasButtons(getValue("buttons"));box.isModel=getValue("model");if(box.isModel)jBox.showModel();box.minimizable=getValue("minimizable");if(!box.minimizable)box.controls.find("div[@title=Minimize]").remove();if(getValue("draggable"))box.handler.mousedown(function($){jBox.etarget=this;jBox.setupDrag($)});box.isResize(getValue("resize"));if(box.resizeBool)box.resize.mousedown(function($){jBox.etarget=this;jBox.setupDrag($)});box.controls.click(function($){jBox.setupControls($)});box.showTipPic=getValue("tip");if(box.showTipPic&&type!="iframe")source="<table><tr><td class=\"jBoxContentImg\">&nbsp;</td><td class=\"jBoxContentFloat\">"+source+"</td></tr></table>";box.load(type,source,title);box.setSize(getValue(("width")),(getValue("height")));$("#jBoxUnderlay").width(box.width()).height(box.height());var xpos=getValue("center")=="1"?"middle":getValue("left"),ypos=getValue("center")=="1"?"middle":getValue("top");box.moveTo(xpos,ypos)}else{if(box.state=="minimized")jBox.restore(box.controls.find("div[@title=Restore]").get(0),box);box.bringUp()}return box},load:function(B,A,D,_){var A=A.toLowerCase();if(typeof _!="undefined")B.handler.get(0).firstChild.nodeValue=_;if(_==""){B.handler.css("backgroundColor","#fff");B.handler.css("padding","0px");B.content.css("padding","0px 10px")}if(A=="inline")B.content.html(D);else if(A=="div"){var C=$("#"+D).clone();C.attr("id",B.jBoxID+C.attr("id"));C.appendTo(B.content);C.css("display","block")}else if(A=="iframe"){B.content.css("overflow","hidden");if(B.content.children().length<1||B.content.children().get(0).tagName!="IFRAME")B.content.html("<iframe src=\"\" frameborder=0 style=\"margin:0; padding:0; width:100%; height: 100%\" name=\"jb_iframe-"+B.jBoxID+"\"></iframe>");window.frames["jb_iframe-"+B.jBoxID].location.replace(D)}else if(A=="ajax"){B.content.html("loading...");$.ajax({type:"GET",url:D,success:function($){B.content.html($)},error:function($){B.content.html($.responseText)}})}B.content.datatype=A;return B},close:function(A){if(A==undefined){A=jBox.boxes[0]}try{var C=A.close()}catch(B){C=true}finally{if(typeof C=="undefined"){alert("An error has occured somwhere inside your \"onclose\" event handler");C=true}}if(C){var $=jBox.findBoxIndex(A.jBoxID);delete jBox.boxes[$];for(var _=$;_<jBox.boxes.length;_++)if((_+1)<jBox.boxes.length)jBox.boxes[_]=jBox.boxes[_+1];jBox.boxes.length--;A.remove();if(A.isModel)jBox.hideModel();delete A.handler;delete A.content;delete A.buttons;delete A.resize;delete A.controls;delete A.status;if(A.state=="minimized"){jBox.minimizeorder--;for(_=0;_<jBox.boxes.length;_++)if(jBox.boxes[_].state=="minimized")if(jBox.boxes[_].minimizeorder>A.minimizeorder){jBox.boxes[_].minimizeorder--;jBox._minimizeRedraw(jBox.boxes[_])}}}return C},show:function($){$.css("display","block");$.css("visibility","visible");if($.isModel)jBox.showModel();return $},showHolder:function(){$("#jBoxHolder").css("display","block")},hide:function($){$.css("display","none");if($.isModel)jBox.hideModel()},_hasScroll:function($,_){$.content.css("overflow",(_)?"auto":"hidden")},_isResize:function($,_){$.status.css("display",(_)?"block":"none");$.resizeBool=(_)?1:0},_hasButtons:function(B,C){B.buttons.css("display",(C>0)?"block":"none");if(C>0){if((C&1)>0){var _=$("<input value=\" \u786e\u8ba4 \" class=\"jBoxButton\" type=\"button\"/>");_.appendTo(B.buttons);_.click(function(){if(undefined!=B.onOkClick)B.onOkClick(B);else jBox.close(B)})}if((C&2)>0){var A=$("&nbsp;&nbsp;<input value=\" \u53d6\u6d88 \" class=\"jBoxButton\" type=\"button\"/>");A.appendTo(B.buttons);A.click(function(){if(undefined!=B.onCancelClick)B.onCancelClick(B);else jBox.close(B)})}}B.buttonsBool=C>0?1:0},setSize:function(A,$,_){$=parseInt($);_=parseInt(_);if($<=0)$=320;A.css("width",$+"px");if(_==0){A.content.css("height","auto");return}else if(_<0)_=100;A.content.css("height",_+"px")},moveTo:function($,D,_){var C=jBox.pageInnerSize(),B=jBox.pageXYOffset(),A=[(D=="middle")?B[0]+(C[0]-$.get(0).offsetWidth)/2:B[0]+parseInt(D),(_=="middle")?B[1]+(C[1]-$.get(0).offsetHeight)/2:B[1]+parseInt(_)];if(D=="middle")A[0]=A[0]-$.width()/2;if(_=="middle")A[1]=A[1]-$.height()/2;$.css("left",A[0]+"px");$.css("top",A[1]+"px")},minimize:function(_,A){jBox.saveViewState(A);A.state="minimized";$(_).removeClass().addClass(jBox.restoreClass).attr("title","Restore");A.content.css("display","none");A.buttons.css("display","none");A.status.css("display","none");if(typeof A.minimizeorder=="undefined"){jBox.minimizeorder++;A.minimizeorder=jBox.minimizeorder}jBox._minimizeRedraw(A);$("#jBoxUnderlay").width(A.width()).height(A.height())},_minimizeRedraw:function(_){_.css("left","10px");_.css("width","200px");var B=_.minimizeorder*10,$=jBox.pageXYOffset(),A=jBox.pageInnerSize();_.css("top",$[1]+A[1]-(_.handler.get(0).offsetHeight*_.minimizeorder)-B+"px")},restore:function(A,B){if(B.state=="minimized"){jBox.minimizeorder--;for(var _=0;_<jBox.boxes.length;_++)if(jBox.boxes[_].state=="minimized")if(jBox.boxes[_].minimizeorder>B.minimizeorder){jBox.boxes[_].minimizeorder--;jBox._minimizeRedraw(jBox.boxes[_])}B.minimizeorder=undefined}var C=jBox.pageXYOffset();B.state="restore";$(A).removeClass().addClass(jBox.minClass).attr("title","Minimize");B.content.css("display","block");if(B.buttonsBool)B.buttons.css("display","block");if(B.resizeBool)B.status.css("display","block");B.css("left",parseInt(B.lastPos[0])+C[0]+"px");B.css("top",parseInt(B.lastPos[1])+C[1]+"px");B.css("width",parseInt(B.lastSize[0])+"px");$("#jBoxUnderlay").width(B.width()).height(B.height())},showModel:function(){var A=$("#jBox_hideIframe");if(A.length==0){A=$("<iframe id=\"jBox_hideIframe\" scrolling=\"no\" frameborder=\"0\" style=\"position:absolute; top:0px; left:0px;-moz-opacity:0.1; opacity:0.1;filter:alpha(opacity=0);overflow:hidden;\" ></iframe>");A.css("background","#000000");A.appendTo(document.body);$(window).bind("resize",function(){jBox.showModel()})}var _=jBox.pageSize();A.css("width",_[0]+"px");A.css("height",_[1]+"px");var B=$("#jBox_hideDIV");if(B.length==0){B=$("<div id=\"jBox_hideDIV\" scrolling=\"no\" frameborder=\"0\" style=\"position:absolute; top:0px; left:0px;-moz-opacity:0.0; opacity:0.0;filter:alpha(opacity=0);overflow:hidden;\" >&nbsp;</div>");B.css("background","#000000");B.appendTo(document.body);$(window).bind("resize",function(){jBox.showModel()})}B.css("width",_[0]+"px");B.css("height",_[1]+"px")},hideModel:function(){$(window).unbind("resize");var _=$("#jBox_hideIframe");if(_.length>0)_.remove();$(window).unbind("resize");var A=$("#jBox_hideDIV");if(A.length>0)A.remove()},setupControls:function(A){var _=window.event?window.event.srcElement:A.target,$=jBox._retBox(_);if(/Minimize/i.test(_.getAttribute("title")))jBox.minimize(_,$);else if(/Restore/i.test(_.getAttribute("title")))jBox.restore(_,$);else if(/Close/i.test(_.getAttribute("title")))jBox.close($);return false},reDraw:function($,_){$.css("width",Math.max(jBox.width+jBox.distancex,150)+"px");$.content.css("height",Math.max(jBox.contentheight+jBox.distancey,100)+"px")},setupDrag:function(A){var _=jBox.etarget,$=jBox._retBox(_),A=window.event||A;jBox.initmousex=A.clientX;jBox.initmousey=A.clientY;jBox.initx=parseInt($.get(0).offsetLeft);jBox.inity=parseInt($.get(0).offsetTop);jBox.width=parseInt($.get(0).offsetWidth);jBox.contentheight=parseInt($.content.get(0).offsetHeight);if($.content.datatype=="iframe");document.onmousemove=jBox.getDistance;document.onmouseup=function(){if($.content.datatype=="iframe")$.content.css("visibility","visible");jBox.stopDrag()};return false},getDistance:function(A){var _=jBox.etarget,A=window.event||A;jBox.distancex=A.clientX-jBox.initmousex;jBox.distancey=A.clientY-jBox.initmousey;var $=jBox._retBox(_);if(_.className=="jBoxHandler"){$.css("left",jBox.distancex+jBox.initx+"px");$.css("top",jBox.distancey+jBox.inity+"px")}else if(_.className==jBox.resizeClass)jBox.reDraw($,A);return false},stopDrag:function(){jBox.etarget=null;document.onmousemove=null;document.onmouseup=null},saveViewState:function($){var _=jBox.pageXYOffset();$.lastPos=[parseInt(($.css("left")||$.get(0).offsetLeft))-_[0],parseInt(($.css("top")||$.get(0).offsetTop))-_[1]];$.lastSize=[parseInt($.css("width")),parseInt($.css("height"))]},_retBox:function(_){return jBox.findBox($(_).parents("div.jBox").get(0).id)}};jBox.alert=function(C,_,$,A,E){if(undefined==$)$=500;if(undefined==A)A=0;if(undefined==_)_="\u4fe1\u606f\u63d0\u793a";var D="1";if(E)D="0";var B=jBox.open("jBoxAlert","inline",C,_,"center=1,buttons=1,draggable=1,tip="+D+",model=1,minimizable=0,scrolling=1,width="+$+",height="+A,null);B.show();return B};jBox.confirm=function(C,_,$,A,E){if(undefined==$)$=500;if(undefined==A)A=100;if(undefined==_)_="\u4fe1\u606f\u63d0\u793a";var D="1";if(E)D="0";var B=jBox.open("jBoxAlert","inline",C,_,"center=1,buttons=3,draggable=1,tip="+D+",model=1,minimizable=0,width="+$+",height="+A,null);B.show();return B};jBox.iframe=function(C,_,$,A){if(undefined==$)$=600;if(undefined==A)A=400;if(undefined==_)_="\u4fe1\u606f\u63d0\u793a";var B=jBox.open("jBoxAlert","iframe",C,_,"center=1,buttons=1,draggable=1,tip=0,model=1,minimizable=0,width="+$+",height="+A,null);B.show();return B};jBox.window=function(param){if(typeof param=="string")param=eval("("+param+")");param=param||{};if(undefined==param.w)param.w=600;if(undefined==param.h)param.h=400;if(undefined==param.title)param.title="\u4fe1\u606f\u63d0\u793a";if(undefined==param.type)param.type="div";if(undefined==param.content)param.content="hi";if(undefined==param.model)param.model="0";var result=jBox.open("jBoxAlert",param.type,param.content,param.title,"center=1,buttons=0,draggable=1,tip=0,model="+param.model+",minimizable=0,width="+param.w+",height="+param.h,null);result.show();return result};jBox._tipTimeout=function(){var $=jBox.findBox("jBoxTip");if(null!=$)if(undefined==$.isMouseOver||null==$.isMouseOver||!$.isMouseOver)jBox.close($);else setTimeout(jBox._tipTimeout,3000)};jBox.tip=function(D,C,_,B){var A=jBox.findBox("jBoxTip");if(null==A){var G=D||window.event;if(undefined==_)_=150;if(undefined==B)B=20;var E=jBox.pageInnerSize(),F=jBox.pageXYOffset(),$=[G.clientX,G.clientY];A=jBox.open("jBoxTip","inline",C,"","top="+$[1]+",left="+$[0]+",minimizable=0,width="+_+",height="+B,null);A.content.mouseover(function(){var $=jBox.findBox("jBoxTip");$.isMouseOver=true});A.content.mouseout(function(){var $=jBox.findBox("jBoxTip");$.isMouseOver=false});setTimeout(jBox._tipTimeout,2000)}return A}

