(function($) {
	/**
	 * @author Mirosław Bogacz
	 * @version 0.1 2010.08.30
	 */
	$.fn.widgetSocial = function () {
		return this.each(function () {

			var that = this;
			
			var WidgetSocial = function () {
				var WidgetSocial = {			
					that: that,
					handleContainer: that,
					handleIcon: '',
					
					init: function() {
						$(WidgetSocial.handleContainer).appendTo("body");
						$(WidgetSocial.handleContainer).append('<div class="widgetSocialIcon"><img src="tpl_front/tpl/img/iconFacebook.png" alt="" /></div>');
						$(WidgetSocial.handleContainer).mouseover(WidgetSocial.mouseOver);
						$(WidgetSocial.handleContainer).mouseout(WidgetSocial.mouseOut);
						WidgetSocial.setCss();
					},
					
					setCss: function() {
						$(WidgetSocial.handleContainer).css({'width': 245});
						$(WidgetSocial.handleContainer).css({
							'position': 'fixed',
							'z-index': '9999',
							'left': -($(WidgetSocial.handleContainer).width() + 10),
							'top': ($(window).height()  / 2) - (485  / 2) + $(window).scrollTop()
						});
					},
					
					mouseOver: function() {
						WidgetSocial.animationIn();
					},
					
					mouseOut: function() {
						WidgetSocial.animationOut();
					},
					
					animationIn: function() {
						$(WidgetSocial.handleContainer).stop().animate({
							left: 0
						}, 300);
					},
					
					animationOut: function() {
						$(WidgetSocial.handleContainer).stop().animate({
							left: -($(WidgetSocial.handleContainer).width() + 10)
						}, 300);
					}
				};
				
				return WidgetSocial;
			}
			
			var widgetSocial = new WidgetSocial();			
			widgetSocial.init();
		});
	}
	
})(jQuery)
