// Lee dialog 1.0 http://www.xij.cn/blog/?p=68

var dialogFirst=true;
function dialog(title,content,width,height,cssName){

if(dialogFirst==true){
  var temp_float=new String;
  temp_float="<div id=\"floatBoxBg\"></div>";
  temp_float+="<div id=\"floatBox\" class=\"floatBox\">";
  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 "id":
  $("#floatBox .content").html($("#"+content+"").html());  
  $("#floatBox .content span").click(function(){
    $("#floatBoxBg").hide();
    $("#floatBox").hide();
  });
  

}

$("#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()+150)+"px",width:width,height:height});
//alert((($(document).width())/2-(parseInt(width)/2))+"px")
}
