/**弹出页面窗口代码开始**/
/**
顺序 	参数 	功能 	备注
1 	title 	弹出层的标题 	必填，纯文本
2 	content 	弹出层的内容 	:url 	get或post某一页面里的html，该页面要求只包含body的子标签
							:text 	直接写入内容
							:id 	显示页面里某id的子标签
							:iframe 	层内内容以框架显示
3 	width 	弹出层的宽 	必填，css值，比如“200px”
4 	height 	弹出层的高 	如上，但是可用“auto”
5 	cssName 	弹出层的css 	给id floatBox加入的样式名，层内样式可以通过这个样式名来定制

$("#form1").submit(function(){
var str=escape($("#str").val());
dialog("我的标题","url:post?test.asp?str="+str+"","200px","auto","from");
return false;
}); 

dialog("我的标题","test.html","200px","auto","text");

dialog("我的标题","text:我的内容","200px","auto","text");

<div id="testID" style="display:none;"><h2>Lee dialog</h2></div>
dialog("我的标题","id:testID","300px","auto","id");

把blueidea加载进来，定义css:body .iframe .content{padding:0;}复盖一下，因为.content默认padding:20px;
dialog("blueidea","iframe:http://www.blueidea.com","500px","500px","iframe");
**/
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=50);opacity:0.5;\"></div>";
  temp_float+="<div id=\"floatBox\" class=\"floatBox\">";
  temp_float+="<div class=\"title\"><h4></h4><span>关闭</span></div>";
  temp_float+="<div class=\"content\"></div>";
  temp_float+="</div>";
  $("body").append(temp_float);
  dialogFirst=false;
  
  $("#floatBox .title span").click(function(){
    $("#floatBoxBg").hide();
    $("#floatBox").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(){
    $(this).html("loading...");
  });
  $.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);
    }
  });
  break;
  case "text":
  $("#floatBox .content").html(content);
  break;
  case "id":
  $("#floatBox .content").html($("#"+content+"").html());
  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>");
}

$("#floatBoxBg").css({display:"block",height:$(document).height()});
$("#floatBox").removeClass();
$("#floatBox").attr("class","floatBox "+cssName);
$("#floatBox").css({display:"block",left:(($(document).width())/2-(parseInt(width)/2))+"px",top:($(document).scrollTop()+350)+"px",width:width,height:height});
}
/**弹出页面窗口代码结束**/
