//
// main.js
//
jQuery(function($) {

	var deviceAgent = navigator.userAgent.toLowerCase();
	var agentID = deviceAgent.match(/(iphone|ipod|ipad|android|webos|blackberry)/);

	if (!agentID) {

		var	$navigation = $('div#navigation'),
			$content = $('content'),
			$window	= $(window),
			leftNavigation = $navigation.offset().left - parseFloat($navigation.css("margin-left").replace(/auto/, 0)),
			top = $navigation.offset().top - parseFloat($navigation.css("margin-top").replace(/auto/, 0));

		$window.scroll(function(event) {
			var y = $window.scrollTop();
			var currentScrollLeft = $window.scrollLeft();

			if (y >= 152) {
				$navigation.addClass("fixed");
			}
			else {
				$navigation.removeClass("fixed");
				$navigation.css('left', $content.css('left'));
			}

			if (currentScrollLeft >= (leftNavigation - 51)) {
				$navigation.css('left', (currentScrollLeft * -1) + 50);
			}
		});
	}

	$('div.lazy-load').lazyLoad();
});


function initSlider() {
jQuery(function($) {

	$('.interactive-note-content').each(function(i) {

		$(this).css({
			'position': 'absolute',
			'z-index': 50
		}).hide();

		if (i == 0) {
			$(this).show().css('z-index', 100);
			$('.interactive-note').height($(this).outerHeight());
		}
	});

	$('.interactive-slider').anythingSlider({
		expand: false,
		resizeContents: false,
		buildArrows: true,
		buildNavigation: true,
		buildStartStop: false,
		appendNavigationTo: '.interactive-pagination',
		toggleArrows: true,
		hashTags: false,
		infiniteSlides: false,
		onSlideComplete: function (slider) {
			var selected = $('#interactive-note-content-' + slider.currentPage);
			var siblings = selected.siblings();

			selected.css('z-index', '100').fadeIn('normal');
			siblings.css('z-index', '50').fadeOut("normal");

			$('.interactive-note').animate({
				height: selected.outerHeight()
			}, 500);
		}
	});
	$('.anythingBase').anythingSliderVideo();
});
}

