/**
 * By: Hamed F.
 * Sep 2009
 * Based on jquery.message-center plugin, with some changes to make it better fit for iMedia.
 * 
 */
(function($){  
	$.fn.message_center = function(options) {  
		if (options.text != '') {
      var id = (options.id && (options.id.toString() != '')) ? options.id.toString() : 'message_center';
      var message = '<span class="mc_text">' + options.text + '</span><img id="'+id+'_close" alt="" />';
      $('#'+id).html(message);
      options.delay = options.delay || 500;
      
      $('#'+id).addClass("mc_message"); 
      $('#'+id+'_close').addClass("mc_close");

      if (options.type && (options.type != '')) {
        $('#'+id).addClass("mc_"+options.type); 
        $('#'+id+'_close').addClass("mc_"+options.type+"_close");
      }
      
      function mc_closeMessage() {
        $('#'+id).animate({
          top: -$('#'+id).innerHeight().toString()+'px'
        }, 
        options.delay, '', function(){
          $('#'+id).hide();
        });        
      }
      
      $('#'+id+'_close').click(mc_closeMessage);
      
      $('#'+id).css('top', -$('#'+id).innerHeight().toString()+'px');
      $('#'+id).show();
      $('#'+id).animate({top:"0px"},options.delay);
		}
	}
})(jQuery); 
