function rdModal(args){
	//user variables
	var id = args.id;
	var ajaxPath = args.ajaxPath;
	var content = args.content;
	var height = args.height ? args.height : 500;
	var width = args.width ? args.width : 500;
	var title = args.title ? args.title : "Title";
	var ajaxPostData = args.ajaxPostData;
	var oModal;
	
	//user functions
	

	//class methods
	return{
		open : function() {
			var self = this;	
			//init new task window
			var modalDiv = $("#"+id).attr('id') ? $("#"+id) : $("<div id='"+id+"'></div>");
			var $modal = modalDiv
				.dialog({
					bgiframe: true,
					autoOpen: false,
					resizable: false,
					height: height,
					width: width,
					modal: true,
					title : title,
					close : function(){
		                /*
		                var i, t = tinyMCE.editors;
		                for (i in t){
		                    if (t.hasOwnProperty(i)){
		                        t[i].remove();
		                    }
		                }
		                */
		                self.onClose();
		                $("#"+modalDiv.attr('id')+" textarea").each( function(){
		                	var elID = $(this).attr('id');
		                	if (tinyMCE.get(elID)){
		                		$("#"+elID).tinymce().remove();
		                	}
		                });
		                
						$('#'+id).dialog('destroy');
						$('#'+id).remove();
					}
				})
				.hover(
					function(){ 
						$(this).addClass("ui-state-hover"); 
					},
					function(){ 
						$(this).removeClass("ui-state-hover"); 
					}
				)
				.mousedown(function(){
					$(this).addClass("ui-state-active"); 
				})
				.mouseup(function(){
						$(this).removeClass("ui-state-active");
				});
			
			if(ajaxPath){
				$modal.load(ajaxPath,ajaxPostData,this.onLoad);
			}else if(content){
				$modal.html( content );
			}
			
			$modal.dialog('open');
			oModal = $modal;
		},
		onClose: typeof(args.onClose) == 'function' ? args.onClose : function () {},
		onLoad: typeof(args.onLoad) == 'function' ? args.onLoad : function () {}
	}
};