var dialogFirst=true; function dialog(d,a,e,b,f){if(dialogFirst==true){var c=new String;c='<div id="floatBoxBg" style="height:'+$(document).height()+'px;filter:alpha(opacity=0);opacity:0;"></div>';c+='<div id="floatBox" class="floatBox">';c+='<div class="title"><h4></h4><span>\u5173\u95ed</span></div>';c+='<div class="content"></div>';c+="</div>";$("body").append(c);dialogFirst=false}$("#floatBox .title span").click(function(){$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide()});$("#floatBox").animate({top:$(document).scrollTop()- (b=="auto"?300:parseInt(b))+"px"},"normal",function(){$(this).hide()})});$("#floatBox .title h4").html(d);contentType=a.substring(0,a.indexOf(":"));a=a.substring(a.indexOf(":")+1,a.length);switch(contentType){case "url":d=a.split("?");$("#floatBox .content").ajaxStart(function(){$(this).html("loading...")});$.ajax({type:d[0],url:d[1],data:d[2],error:function(){$("#floatBox .content").html("error...")},success:function(g){$("#floatBox .content").html(g)}});break;case "text":$("#floatBox .content").html(a); break;case "id":$("#"+a+"").appendTo($("#floatBox .content"));break;case "iframe":$("#floatBox .content").html('<iframe src="'+a+'" width="100%" height="'+(parseInt(b)-30)+'px" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0"></iframe>')}$("#floatBoxBg").show();$("#floatBoxBg").animate({opacity:"0.5"},"normal");$("#floatBox").attr("class","floatBox "+f);$("#floatBox").css({display:"block",left:$(document).width()/2-parseInt(e)/2+"px",top:$(document).scrollTop()-(b=="auto"?300:parseInt(b))+ "px",width:e,height:b});$("#floatBox").animate({top:$(document).scrollTop()+50+"px"},"normal")};