/*	Javascript by Pasz.nl
	Magic by jQuery.
*/

$(document).ready(function() {
	
	// Upgrade script (for IE6 users)
	upgrade.init();
	
	
	$('a#triangle-small').css({
		left : '268px'
	})
	
	function animatetriangle(times) {
		times = times - 1;
		var dir = "+="
		
		if (times%2 == 0) dir = "-=";
		
		$('a#triangle-small').animate({'left' : dir + '10px'}, 250, function() {
			if (times > 0) {
				animatetriangle(times)
			} else {
				setTimeout(function(){animatetriangle(6)}, 4000)
			}
		})
	};
	animatetriangle(6);
	
	// Footer positioning for home
	window.onresize = function() {
		footerFixed();
	}
	
	function footerFixed() {
		if ($(window).height() < 963) {
			if (!$('body').hasClass('footerFixed')) $('body').addClass('footerFixed')
		} else {
			$('body').removeClass('footerFixed')
		}
		
		if ($(window).height() < 680) {
			if (!$('body').hasClass('small-viewport')) $('body').addClass('small-viewport')
		} else {
			$('body').removeClass('small-viewport')
		}
	}
	
	footerFixed();
});
