
hideUrlBar = function () {
   !pageYOffset && !location.hash && setTimeout(function () {
      window.scrollTo(0, 1);
    }, 1000);
};


$(document).ready(function() {
						   
	var deviceAgent = navigator.userAgent.toLowerCase();
	var iOSdevice = deviceAgent.match(/(iphone|ipod|ipad)/);
	if (iOSdevice) {
		hideUrlBar();
	}
						   					   
	$('a[href^=#]:not([href=#])').click(function(event){
		$('html, body').animate({ 
			 scrollTop: $($(this).attr("href"))
			 .offset().top }, 1000);
	 	event.preventDefault();
	});

	$('a').bind('touchstart', function(event){
		$(this).addClass('hover');						   
	}).bind('touchend', function(event){
		$(this).removeClass('hover');						   
	});
	
	$('.flexslider').flexslider({
		animation: "slide",
		controlsContainer: '.flex-container',
		slideshowSpeed: 3000, 
		animationDuration: 1000, 
		directionNav: false   
	});
	
	$('.gallery a').touchGallery();
	
	
});


