// Lee dialog 1.0 http://www.xij.cn/blog/?p=68

var logindialogFirst=true;
function ShowDialog(title,content,width,height,cssName){

if(logindialogFirst==true){
  var temp_float=new String;
  temp_float="<div id=\"loginBoxBg\" style=\"height:"+$(document).height()+"px;filter:alpha(opacity=0);opacity:0;\"></div>";
  temp_float+="<div id=\"loginBox\" class=\"loginBox\">";
  temp_float+="<div class=\"content\"></div>";
  temp_float+="</div>";
  $("body").append(temp_float);
  logindialogFirst=false;
}



$("#loginBox .title h4").html(title);
contentType=content.substring(0,content.indexOf(":"));
content=content.substring(content.indexOf(":")+1,content.length);

switch(contentType){
  case "url":
  $("#loginBox .content").html("loading...").load(content,function(){
		  $("#loginBox .closebtn").click(function(){
		  $("#loginBoxBg").hide();
		  $("#loginBox").hide();
		  $('#Form1 select').show();
		  if(requireLogin){
			requireLogin=false;
			location.replace("/index.php/skipintro");
		 }
		  return false;
		});
  });

  break;
  case "text":
  $("#loginBox .content").html(content);
  break;
  case "id":
  $("#loginBox .content").html($("#"+content+"").html());
  break;
  case "iframe":
  $("#loginBox .content").html("<iframe src=\""+content+"\" width=\"100%\" height=\""+(parseInt(height)-30)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");
}

$("#loginBox .closebtn").click(function(){
	
  $("#loginBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();});
  $("#loginBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){
	  $(this).hide();
	 
	  });
  $('#Form1 select').show();
  return false;
});

$("#loginBoxBg").show();
$("#loginBoxBg").animate({opacity:"0.8"},"normal");
$("#loginBox").attr("class","loginBox "+cssName);
$("#loginBox").css({display:"block",left:(($(document).width())/2-(parseInt(width)/2))+"px",top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px",width:width,height:height});
$("#loginBox").animate({top:($(document).scrollTop()+250)+"px"},"normal"); 
}