/*
 * jQuery Sticky Layer Plugin for WYSIWYG Web Builder 8
 * Copyright Pablo Software solutions 2011
 * http://www.wysiwygwebbuilder.com/
 */
(function(f){f.fn.stickylayer=function(c){return this.each(function(){f.stickylayer(this,c)})};f.stickylayer=function(c,b){var a={orientation:1,position:[0,0],delay:0};$obj=f(c);b&&(a=f.extend(a,b));if(a.delay==0&&a.orientation<5)switch($obj.css("position","fixed"),a.orientation){case 1:$obj.css("left",a.position[0]);$obj.css("top",a.position[1]);break;case 2:$obj.css("left","");$obj.css("right",a.position[0]);$obj.css("top",a.position[1]);break;case 3:$obj.css("left","");$obj.css("top","");$obj.css("right",
a.position[0]);$obj.css("bottom",a.position[1]);break;case 4:$obj.css("top",""),$obj.css("left",a.position[0]),$obj.css("bottom",a.position[1])}else{$obj.css("position","absolute");f.stickylayer.updatePosition($obj,a);var d="scroll."+$obj.attr("id")+" resize."+$obj.attr("id");a.id=$obj.attr("id");jQuery(window).bind(d,a,function(){$obj=f("#"+a.id);f.stickylayer.updatePosition($obj,a)})}};f.stickylayer.updatePosition=function(c,b){b.delay>0&&c.stop();var a=jQuery(window),d=a.scrollLeft(),e=a.scrollTop();
switch(b.orientation){case 1:d+=b.position[0];e+=b.position[1];break;case 2:d=d+a.width()-c.outerWidth()-b.position[0];e+=b.position[1];break;case 3:d=d+a.width()-c.outerWidth()-b.position[0];e=e+a.height()-c.outerHeight()-b.position[1];break;case 4:d+=b.position[0];e=e+a.height()-c.outerHeight()-b.position[1];break;case 5:d=d+(a.width()-c.outerWidth())/2+b.position[0];e+=b.position[1];break;case 6:d=d+a.width()-c.outerWidth()-b.position[0];e=e+(a.height()-c.outerHeight())/2+b.position[1];break;case 7:d=
d+(a.width()-c.outerWidth())/2+b.position[0];e=e+a.height()-c.outerHeight()-b.position[1];break;case 8:d+=b.position[0],e=e+(a.height()-c.outerHeight())/2+b.position[1]}b.delay>0?c.animate({left:d,top:e},b.delay):c.css({left:d+"px",top:e+"px"})}})(jQuery);
