/*
=============================================================
						 COPY RIGHTS			
			-------------------------------------
			Przedsiebiorstwo Informatyczne WTSOFT
			-------------------------------------
=============================================================
*/

(function($){

	$.fn.jqMessage = function(settings){
		var sets = jQuery.extend({
			// Szybkosc pokazywania
			showSpeed: 350,
			// Szybkosc chowania
			hideSpeed: 350,
			// Typ animacji
			showAnimation: 'fade',
			hideAnimation: 'fade'
		},settings);
		
		// Przepisanie pasujacych elementow
		var jQueryMatchedObj = this;
		
		
		// Pokaz komunikat
		function show(){
			switch(sets.showAnimation){
				case 'slide':
					jQueryMatchedObj.slideDown(sets.showSpeed);
					break;
				case 'show':
					jQueryMatchedObj.show(sets.showSpeed);
					break;
				case 'fade':
				default:
					jQueryMatchedObj.fadeIn(sets.showSpeed);
					break;
			}
		}
		// Schowaj komunikat
		function hide(){
			switch(sets.hideAnimation){
				case 'slide':
					$(this).parent().slideUp(sets.hideSpeed);
					break;
				case 'fade':
					$(this).parent().fadeOut(sets.hideSpeed);
					break;
				case 'hide':
				default:
					$(this).parent().hide(sets.hideSpeed);
					break;
			}
			return false;
		}
		
		function setNavigation(){
			// Schowaj komunikat
			$('.jq-message-close, .closeMessage').unbind('click').click(hide);
		}
		
		show();
		setNavigation();
		return true;
	}
	
})(jQuery)