function espcms_dialog(title,type,url,width,height,cssName,callback,bgclose){var temp_float='<div id="floatBoxBg"></div>';temp_float+='<div id="floatBox" class="floatBox"><div id="headtitle"><div class="title" id="titlediv"></div></div><div id="dialogcontentlist" class="content"></div></div>';$("body").append(temp_float);var w=parseInt(width);var h=parseInt(height);$("#floatBox .content").css({width:w});if(!bgclose){$("#floatBoxBg").unbind("click").bind("click",function(){$("#floatBoxBg").remove();$("#floatBox").remove()})}$("#floatBox .title").html(title);switch(type){case"url":$("#floatBox .content").css({height:h});$("#dialogcontentlist").load(url,function(){if(callback){eval(callback)}});break;case"text":$("#floatBox .content").html(url);break;case"id":$("#floatBox .content").html($("#"+url+"").html());break;case"iframe":url=url+"&digheight="+(parseInt(height)-30);$("#dialogcontentlist").html('<iframe name="diglogfirameclass" id="diglogfirameclass" src="'+url+'" width="100%" height="'+(parseInt(height)-30)+'px" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>')}$("#floatBoxBg").show();$("#floatBoxBg").animate({opacity:"0.4"},"fast");$("#floatBox").show();var box01=(($(window).height()-(parseInt(height)+13))/2);var client_width=$(window).width();var left=(client_width-(parseInt(width)+2))/2;$("#floatBox").css({left:parseInt(left)+"px",top:parseInt(box01)+"px",width:width});$("#floatBox").attr("class","floatBox "+cssName);var divdialog=document.getElementById("floatBox");var checkdialog=document.getElementById("headtitle");DragAndDrop.Register(divdialog,checkdialog)}function dialog_heigth(a,e){e=!e?60:parseInt(e);var d=parseInt(a)+e;var b=$("#floatBoxBg").outerHeight()-300;if(d<b){$("#diglogfirameclass").height(d)}else{d=b;$("#diglogfirameclass").height(d)}var c=(($(window).height()-(parseInt(d)+13))/2);$("#floatBox").css({top:parseInt(c)+"px"})}function closeifram(){$("#floatBoxBg").remove();$("#floatBox").remove()}var DragAndDrop=function(){var l;var h;var g;var c;var e=false;var a;var d;var f=function(m){return m.ownerDocument||m.document};var b=function(m){if(c){m=m||window.event;l=document.body.clientWidth;h=document.documentElement.scrollHeight;e=true;a={x:$(c).offset().left,y:$(c).offset().top};d={x:m.screenX,y:m.screenY};$(document).bind("mousemove",k);$(document).bind("mouseup",j);if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}}};var k=function(m){if(e){m=m||window.event;var n={x:m.screenX,y:m.screenY};a.x=a.x+(n.x-d.x);a.y=a.y+(n.y-d.y);d=n;$(c).css("left",a.x+"px");$(c).css("top",a.y+"px");if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}}};var j=function(m){if(e){m=m||window.event;i();e=false}};var i=function(){if(g){$(g.document).unbind("mousemove");$(g.document).unbind("mouseup")}};return{Register:function(m,n){c=m;g=n;$(g).bind("mousedown",b)}}}();(function(a){a.fn.espcms_dig=function(){a(this).unbind("click").bind("click",function(){var c=a(this).attr("data-url");var e=a(this).attr("data-title");var d=a(this).attr("data-w");var b=a(this).attr("data-h");parent.espcms_dialog(e,"iframe",c,d,b,"dialogname")})}})(jQuery);
