
/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Site: ovaqe
File: ovaqe.js

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */


$(function() {
		
	/*--------------------------------------------------
	  m5LazyDisplay
	----------------------------------------------------*/
	$('#content img, #footer img').m5LazyDisplay();
	
	/*--------------------------------------------------
	  scrollFollow
	----------------------------------------------------*/
	$('#header').scrollFollow({
		container: 'container',
		easing: 'easeOutCirc',
		delay: 100,
		speed: 700,
		offset: 100
	});
	
	/*--------------------------------------------------
	  pageTop
	----------------------------------------------------*/
	var $pageTop = $('#pageTop');
	$pageTop.css({ 'position':'fixed', 'top':100 });
	
	function updatedPageTopPosition() {
		var contentW = 950,
			ww = $(window).width();
			
		if (ww>contentW) {
			$pageTop.css('left',contentW+((ww-contentW)*0.5));
		} else {
			$pageTop.css('left',contentW);
		}		
	}
	
	$(window).bind('load scroll', function(){
		updatedPageTopPosition();
		$pageTop.css('display','block');
	});
	
	
	/*--------------------------------------------------
	  Page Scroll
	----------------------------------------------------*/
	$('a.scroll').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			$(this).blur();
			var t = navigator.appName.match(/Opera/) ? "html" : "html,body";
			$(t).queue([]).stop();
			var $targetElement = $(this.hash);
			var scrollTo = $targetElement.offset().top;
			if (window.scrollMaxY) {
				var maxScroll = window.scrollMaxY;
			} else {
				var maxScroll = document.documentElement.scrollHeight - document.documentElement.clientHeight;
			}
			if (scrollTo > maxScroll){
				scrollTo = maxScroll;
			}
			$(t).animate({ scrollTop: scrollTo }, 600, 'easeOutExpo');
			//return false;
		}
	});
});


