jQuery.fn.doolindialog = function(options) {
	var settings = {
	Header: 'Header',
	Content: 'Content',
	ContentType:'text',
	Position:{top:20,left:20},
	Size:{width:300,height:300},
	LockBackground:false,
	Opacity:0.3
	};
	if(options){
		jQuery.extend(settings, options);
	}
	$('head').append("<LINK media=screen href=\" jquery/doolindialog.css \" type=text/css rel=stylesheet>");
	
	Init();//³υΚΌ»―
	genDialog();
	function Init()
	{
		
	}
	function genDialog()
	{
		var temp_float=new String;
		temp_float+='<div class="dd_bg"></div>';
		temp_float+='<div class="dd_box">';
		temp_float+='<div class="dd_title"><span class="dd_header">'+settings.Header+'</span><span class="dd_close">x</span></div>';
		temp_float+='<div class="dd_content"></div>';
		temp_float+='</div>';
		$("body").append(temp_float);
		$('.dd_bg').css({'height':document.documentElement.scrollHeight});
		
		$('.dd_close').click(function(){
			$('.dd_bg').remove();
			$('.dd_box').remove();
		});
		if(settings.LockBackground)
		{
			$('.dd_bg').css('opacity',settings.Opacity);
		}
		else
		{
			$('.dd_bg').remove();
		}
		if(settings.Position.left=='auto' && settings.Position.top=='auto' )
		{
			
			if($.browser.msie &&  $.browser.version=='6.0')
			{
				$('.dd_box').css({'left':'50%','top':'50%','margin':'-'+(settings.Size.height-30)/2+'px 0 0 -'+settings.Size.width/2+'px'});
			}
			else
			{
				$('.dd_box').css({'position':'fixed','left':'50%','top':'50%','margin':'-'+(settings.Size.height-30)/2+'px 0 0 -'+settings.Size.width/2+'px'});
			}
		}
		else
		{
			$('.dd_box').css({'left':settings.Position.left,'top':settings.Position.top});
		}
		$('.dd_box').css({'width':settings.Size.width,'height':settings.Size.height});
		$('.dd_content').css({'width':settings.Size.width,'height':settings.Size.height-30});
		getContent();
	}
	function getContent()
	{
		switch(settings.ContentType){
		  case "url":
			$.ajax({
				type: "get",
				url: settings.Content,
				beforeSend: function(XMLHttpRequest){
					$(".dd_content").append('<img id="loading" src="jquery/ajax-loader.gif" />');
				},
				success: function(data, textStatus){
					$(".dd_content").html($(data));
				},
				complete: function(XMLHttpRequest, textStatus){
					$('#loading').remove();
				},
				error: function(){
					$(".dd_content").html('error...');
				}
			});
		  break;
		  case "text":
		  	$(".dd_content").html(settings.Content);
		  break;
		  case "id":
		  	$(".dd_content").html($("#"+settings.Content+"").html());
		  break;
		  case "html":
		  	alert(settings.Content);
		  	$(settings.Content).appendTo($(".dd_content"));
		  break;
		  case "iframe":
		  var hml="<iframe src=\""+settings.Content+"\" width=\"100%\" height=\""+(settings.Size.height-30)+"px"+"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>";
		  $(".dd_content").append(hml);
		  case "img":
		  $(".dd_content").append('<img src="'+settings.Content+'" width='+settings.Size.width+' height='+(settings.Size.height-30)+' />');
		  break;
		}
	}
};