/**
 * Scroll function of the social widget (window left side)
 * @param html element
 */
function socials(elem) {
    
    this.element = jQuery(elem);

    this.init = function() {
        var self = this;
        this.realign();
        
        jQuery(window).scroll(function() { self.realign(); });
    }

    this.realign = function() {
        var elemHeight = this.element.height();
        var clientHeight = jQuery('.page-main').height();
        var position = clientHeight - jQuery(window).scrollTop() - elemHeight -30;

        if (position <= 0) {
            this.element.css('top', 316 + position);
        } else {
            this.element.css('top', 336);
        }
    }

    this.init();
}
