/*

   jQuery SlideNotice Plugin 1.0
   http://slidenotice.pro-idea.cz/
   Release Date: February 22, 2011
   
   Require jQuery 1.4+
   
   Copyright (c) 2010 David Bílý
   Dual licensed under the MIT or GPL Version 2 licenses.
   http://jquery.org/license

*/

if(jQuery) {
   
   ( function($) {
   
      $(window).ready(function(e) {
         
         if ($('#slidenotice_container').length == 0) {
            $('body').append('<div id="slidenotice_container"><div id="notice"><p></p><span class="ico"></span><a class="close"></a></div></div>');
         }
         
         $("#slidenotice_container > #notice > .close").click($.slideNoticeHide);
         
      });
      
      $.extend({
         
         slideNotice: function(message, options) {
            
   			if( options == undefined ) options = {};
   			if( options.duration == undefined ) options.duration = 300;
   			if( options.type == undefined ) options.type = 'info';
   			if( options.hideTimeout == undefined ) options.hideTimeout = 3000;
   			
            $("#slidenotice_container > #notice > p").html(message);
            $("#slidenotice_container > #notice").attr('class', options.type).animate({ top: "0" }, options.duration);
            
            if ($.slideNotice.hideTimeoutId != undefined) clearTimeout($.slideNotice.hideTimeoutId);
   			if (options.hideTimeout > 0) $.slideNotice.hideTimeoutId = setTimeout($.slideNoticeHide, options.hideTimeout);
   			
   			$.slideNotice.options = options;
   			
   		},
   		
   		slideNoticeHide: function() {
   		 
   			$("#slidenotice_container > #notice").animate({ top: "-150px" }, 200);
   			
   		}
   		
   	});
   
   })(jQuery);
   
}
