(function($){
    $.fn.toTop = function(options) {

        var defaults = {
            text: 'Į viršų',
            min: 200,
            inDelay:600,
            outDelay:400,
            containerID: 'toTop',
            containerHoverID: 'toTopHover',
            scrollSpeed: 500,
            easingType: 'linear'
        };

        var settings = $.extend(defaults, options);
        var containerIDhash = '#' + settings.containerID;
		
        $('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');
        $(containerIDhash).hide().click(function(){
            $('html, body').animate({
                scrollTop:0
            }, settings.scrollSpeed, settings.easingType, function(){
                $(containerIDhash).stop().fadeOut(settings.Outdelay);
            });
            return false;
        })
					
        $(window).scroll(function() {
            var sd = $(window).scrollTop();
            if(typeof document.body.style.maxHeight === "undefined") {
                $(containerIDhash).css({
                    'position': 'absolute',
                    'top': $(window).scrollTop() + $(window).height() - 50
                });
            }
            if ( sd > settings.min ) 
                $(containerIDhash).fadeIn(settings.inDelay);
            else 
                $(containerIDhash).fadeOut(settings.Outdelay);
        });

    };
})(jQuery);
function wh() {
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return myHeight;
}
$(document).ready(function() {
    $().toTop();
    $('.scroll-text').bind('marquee', function() {
        var ob = $(this);
        var tw = ob.width();
        var ww = ob.parent().width();
        ob.css({
            right: -tw
        });
        ob.animate({
            right: ww
        }, 15000, 'linear', function() {
            ob.trigger('marquee');
        });
        jQuery.queue(ob, "fx", function() {
            jQuery.dequeue(this);
        });
    }).trigger('marquee').hover(function(){
        $.queue($(this), 'fx', []);
        $(this).stop();
    },
    function(){
        var ob = $(this);
        var ww = ob.parent().width();
        $(this).animate({
            right: ww
        }, 15000, 'linear', function() {
            ob.trigger('marquee');
        });
    });
                
    $('a[href*="#meniu"]').click(function(){
        var par = $(this).parent();
        $('ul', par).toggle();
        $('.main').css('height', $('.sub').height()+'px');
        return false;
    })
    var winh = wh() - 264;
    if($('.cnt').height() < winh) {
        $('.cnt').css('height', winh);
    }
    $('.main').css('height', $('.sub > .row').height()+'px');
    $("a.lightbox").fancybox({
        'overlayShow'	:	true,
        'hideOnContentClick': true
    });
});
domagic = function(){
    $('body, ul#left-menu > a').css('font-size', '14px')
}
