Message = function(){
 var msgShown;

 function createBox(t, s){
  return ['<div class="msg">',
  '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
  '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', t, '</h3>', s, '</div></div></div>',
  '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
  '</div>'].join('');
  }

 return {
  msg : function(title, subtitle){
  
    	
  jQuery.modal(createBox(title,subtitle),{  		
  		overlay:50,
  		// Close the dialog after a certain time.
		onShow: function (dialog) {
					jQuery('#modalContainer').fadeTo(2500,1,function (){							 				
		 				dialog.data.fadeOut(200, function () {
						dialog.container.fadeOut(200, function () {
								dialog.overlay.fadeOut(200, function () {					
									jQuery.modal.close(external);;
								});
							});
						});						 				
		 			});
				}
  		});
			
  		
  	},
   
   msgLoading : function(title, subtitle){
   	jQuery.modal(createBox(title,subtitle),{  		
  		overlay:50,
  		// Close the dialog after a certain time.
		onShow: function (dialog) {
					msgShown = true;					
				}
  		});
   },
   
   msgDone : function(title, subtitle){
   	
   	jQuery.modal.close(external);
   	
   	jQuery.modal(createBox(title,subtitle),{  		
  		overlay:50,
  		// Close the dialog after a certain time.
		onShow: function (dialog) {
					var msgShown = true;
					jQuery('#modalContainer').fadeTo(2500,1,function (){							 				
		 				dialog.data.fadeOut(200, function () {
						dialog.container.fadeOut(200, function () {
								dialog.overlay.fadeOut(200, function () {					
									jQuery.modal.close(external);;
								});
							});
						});						 				
		 			});
				}
  		});
   }							 			
  }; 
}();

