document.write("<link type='text/css' href='/js/tools/jquery/themes/custom-theme/jquery-ui-1.7.2.custom.css' rel='stylesheet' />");
document.write("<script type='text/javascript' src='/js/tools/jquery/ui/ui.core.js'></script>");
document.write("<script type='text/javascript' src='/js/tools/jquery/ui/ui.draggable.js'></script>");
document.write("<script type='text/javascript' src='/js/tools/jquery/ui/ui.resizable.js'></script>");
document.write("<script type='text/javascript' src='/js/tools/jquery/jquery.bgiframe.js'></script>");
document.write("<script type='text/javascript' src='/js/tools/jquery/ui/ui.dialog.js'></script>");

function showLoginDialog(){
		$("#loginDialog").dialog({
			modal:true,
			bgiframe:true,
			width:270,
			height:180,
			close:function(){
				$(this).dialog('destroy');
			}
		});
}

function alert(msg,title,callback,close){
	if(typeof(title)=="undefined"){
		title="消息";
	}
	var div=$("<div title='"+title+"' style='text-align:left;'></div>");
	var p=$("<p>"+msg+"</p>");
	
	div.append(p);
	
	div.dialog({
		modal:true,
		dialogClass:'alert',
		bgiframe:true,
		buttons:{
			'确定':function(){
				$(this).dialog('destroy');
				if(callback){
					callback.apply(callback.arguments);
				}
			}
		},
		close:function(){
				$(this).dialog('destroy');
				if(callback){
					if(close)
						callback.apply(callback.arguments);
				}

		}
	});
}

function confirm(msg,title,confirmCallback,cancelCallback){
	if(typeof(title)=="undefined"){
		title="确认";
	}
	var div=$("<div title='"+title+"' style='text-align:left;'></div>");
	var p=$("<p>"+msg+"</p>");
	
	div.append(p);
	
	div.dialog({
		modal:true,
		bgiframe:true,
		modal:true,
		buttons:{
			'取消':function(){
				$(this).dialog('destroy');
				if(cancelCallback){
					cancelCallback.apply(cancelCallback.arguments);
				}
			},
			'确定':function(){
				$(this).dialog('destroy');
				if(confirmCallback){
					confirmCallback.apply(confirmCallback.arguments);
				}
			}
		},
		close:function(){
				$(this).dialog('destroy');
		}
	});
}
