$(document).ready(function() {
  	var pageWidth = 0;
	var pageHeight = 0;
	var pageWidth = screen.width;
	var pageHeight = screen.height;
	if (screen.height == 0) {
        	pageWidth = document.documentElement.offsetWidth;
        	pageHeight = document.documentElement.offsetHeight;
 	} else if (pageWidth == 0) {
	        pageWidth = window.innerWidth;
	        pageHeight = window.innerHeight;
    		}

	if(pageHeight > 800) {
		$('.container').css('padding-top', (pageHeight-800)/2 + 'px');
	}
	$('.box').css('top',(pageHeight-800) + 'px');
	$("a#single_image").fancybox();
	$('.container').css('padding-left', (pageWidth-960)/2 + 'px');
    
    	$("#twitter").getTwitter({
					userName: "Web2oPontEu",
					numTweets: 1,
					loaderText: "Betöltés...",
					slideIn: true,
					slideDuration: 750,
					showHeading: true,
					headingText: "Azt csiripelik...",
					showProfileLink: false,
					showTimestamp: true
				});	
	
    $(function () {
        $('.bubbleInfo').each(function () {
            var distance = 10;
            var time = 250;
            var hideDelay = 500;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('.trigger', this);
            var info = $('.popup', this);


            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;

                    info.css({
                        top: -150,
                        left: -33,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px'
                        //opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px'
                        //opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });
    });

});

