/**
 * @author	Derk Gommers <ik@derkgommers.eu>
 */

var doc = $(document),
	ios = false;

doc.ready(function () {

	$('#nav a').append('<span></span>');
	$('.home #blocks li').click(function () { window.location = this.getElementsByTagName('a')[0].href; });

	var fullSlider = $('.animated');
	if (fullSlider.length != 0) {
		slideMe.init({
			images: $('li', fullSlider),
			btnNext: $('.next', fullSlider),
			btnPrev: $('.back', fullSlider),
			aSpeed: 500,
			aInterval: 3600,
			groupBy: 4,
			leftSpace: 0
		});
	}

	$('.home #blocks li').hover(function () {
		var elem = $(this);
		elem
			.animate({backgroundPosition:-165*elem.index()+'px -278px'}, 500)
			.find('a')
			.fadeIn(200);
	}, function () {
		var elem = $(this);
		elem
			.animate({backgroundPosition:-165*elem.index()+'px 0px'}, 500)
			.find('a')
			.fadeOut(200);
	});
	
	window.ondevicemotion = function () {
		if (ios == false) {
			$('#bg').css({width: doc.width(), height: doc.height()});
			ios = true;
		}
	};

});
























