var dialogFirst=true;function dialog(title,content,width,height,cssName){if(dialogFirst==true){var temp_float=new String;temp_float="<div id=\"floatBoxBg\" style=\"height:"+$(document).height()+"px;filter:alpha(opacity=0);opacity:0;\"></div>";temp_float+="<div id=\"BoxLoad\"></div>";temp_float+="<div id=\"floatBox\" class=\"floatBox\">";temp_float+="<div class=\"title\"><h4></h4><span>&times;</span></div>";temp_float+="<div class=\"content\"></div>";temp_float+="</div>";$("body").append(temp_float);dialogFirst=false;}$("#floatBox .title span").click(function(){$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();});$("#floatBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$(this).hide();});});$("#floatBox .title h4").html(title);contentType=content.substring(0,content.indexOf(":"));content=content.substring(content.indexOf(":")+1,content.length);switch(contentType){case "url":var content_array=content.split("?");$("#floatBox .content").ajaxStart(function(){$("#BoxLoad").show();$("#BoxLoad").css({display:"block",left:(($(document).width())/2-16)+"px",top:($(document).scrollTop()+re_ltpx("#BoxLoad"))+"px"});});$.ajax({type:content_array[0],url:content_array[1],data:content_array[2],error:function(){$("#floatBox .content").html("error...");},success:function(html){$("#floatBox .content").html(html);$("#floatBox").animate({top:($(document).scrollTop()+re_ltpx("#floatBox"))+"px"},"normal");$("#BoxLoad").hide();}});break;case "text":$("#floatBox .content").html(content);$("#floatBox").animate({top:($(document).scrollTop()+re_ltpx("#floatBox"))+"px"},"normal");break;case "id":$("#floatBox .content").html($("#"+content+"").html());$("#floatBox").animate({top:($(document).scrollTop()+re_ltpx("#floatBox"))+"px"},"normal");break;case "iframe":$("#floatBox .content").html("<iframe src=\""+content+"\" width=\"100%\" height=\""+(parseInt(height)-30)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");$("#floatBox").animate({top:($(document).scrollTop()+re_ltpx("#floatBox"))+"px"},"normal");}$("#floatBoxBg").show();$("#floatBoxBg").animate({opacity:"0.5"},"normal");$("#floatBox").attr("class","floatBox "+cssName);$("#floatBox").css({display:"block",left:(($(document).width())/2-(parseInt(width)/2))+"px",top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px",width:width,height:height});}function re_ltpx(obj){var windowHeight = document.documentElement.clientHeight;var popupHeight = $(obj).height();var box_top=(windowHeight-popupHeight)/2;if(popupHeight>windowHeight){box_top=0}return box_top;}
