 /* mini plugin Edge Sticker
	   * moves elements to the edge of containerDiv independently of window resize
	   * containerDiv must be inside BODY element but not in containerDiv
	   * ex: 
	   * <body>
			<div id="#container"></div>
			<div id="#skyscrapperDiv"></div>
	     </body>
	   * by @Dominik 2011-12-01 ver 1.1
	   */
	  (function($){
			$.fn.extend({ 
				  moveElementToTheEdge: function(opts) {
						return this.each(function() { 
									var horiz = false;
									var vert  = false;
									if(opts.edge.indexOf('right')!=-1)   horiz = 'right';
									if(opts.edge.indexOf('left')!=-1)    horiz = 'left';
									if(opts.edge.indexOf('top')!=-1)     vert = 'top';
									if(opts.edge.indexOf('bottom')!=-1)  vert = 'bottom';
									if(horiz){ /* horizontal positioning */
										var bh = $('body').outerWidth();
										var ch = $(opts.containerDiv).outerWidth();
										var marginH = ((bh-ch)/2) + ((opts.stickFromInside) ? opts.plusPxFromEdge : -1*opts.plusPxFromEdge);
										var h = marginH - ((opts.stickFromInside) ? 0 : $(this).outerWidth());
										$(this).css(horiz, h+'px');
									}
									if(vert){ /* vertical positioning */
										var cv = $(opts.containerDiv).outerHeight();
										var contTop = $(opts.containerDiv).position().top;
										var elH = $(this).outerHeight();
										if(vert=='top'){
											var v = contTop;
										}
										else if(vert=='bottom'){
											var v = (cv + contTop) - elH;
											vert = 'top';
										}
										if(v) $(this).css(vert, v+'px');
									}
									$(this).css({position: 'absolute'});
								});
					
				  },
				  stickElementsToEdge: function(opts){
						var thisRef = $(this);
						var defaults = {
							edge: 'right', 				/* values: left, right, top, bottom, right-top, right-bottom, left-top, left-bottom  */
							containerDiv:'#container',	/* container rule - to which element`s edge we wan`t to stick our element */
							plusPxFromEdge: 0,			/* pixels from edge of containerDiv */
							stickFromInside: false 		/* is element sticked to the edge from inside of containerDiv */
						}
						var opts =  $.extend(defaults, opts);
						$(window).resize(function(){
							thisRef.moveElementToTheEdge(opts);
						});
						return this.moveElementToTheEdge(opts);
				}			
		  });
		  
		  
			/****** AJAX LOADER SETTINGS BEGIN ********************************/
			 function trackStylCommonLoader(event){
				  $('#stylCommonAjaxLoader').css({left: (event.pageX + 5) +'px', top: (event.pageY - 30) +'px'});
			 }
			//dodanie loadera do akcji ajaxowych
			function addStylCommonLoader(){
				$(document.body).prepend('<div id="stylCommonAjaxLoader" style="width:130px;height:12px;background:yellow;font-weight:bold;font-size:15px;padding:10px;text-align:center;position:absolute;z-index:999999">Trwa ładowanie...<br /></div>');
				$(document).mousemove(trackStylCommonLoader); 
			}
			//zdjecie loadera po wykonaniu akcji ajaxowej
			function doneStylCommonLoader(){
				$(document).unbind('mousemove', trackStylCommonLoader);
				$('#stylCommonAjaxLoader').remove();
			}
			//cos poszlo nie tak i akcja ajaxowa nie zostala wykonana poprawnie
			function failStylCommonLoader(){
				$(document).unbind('mousemove', trackStylCommonLoader);
				$('#stylCommonAjaxLoader').remove();
			}
			//kontrola ajaxowych requestów	  
			/* $.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
				addStylCommonLoader();
				jqXHR.done(function(){
					doneStylCommonLoader();
				})
				.fail(function(){
					failStylCommonLoader();
				});
			}); */
			/****** LOADER END *******************************************************/
	  
	  
	  })(jQuery);
	  /* END ************************************************/
	  
