// JavaScript Document

$(document).ready(function () {
	//1. create sccroll effect
	//2. handle the selection of the navigation
	//3. previous and next images - image buttons
	//4. support veertical and horizontal
	
	var horizontal = true;
	var $panels = $('#newRegistered .scrollContainer div.panel');
	var $container = $('#newRegistered .scrollContainer');
	var $scroll = $('#newRegistered .scroll').css('overflow','hidden');
	// float the panels left if we're going horizontal
if (horizontal) {
  $panels.css({
    'float' : 'left',
    'position' : 'relative' // IE fix to ensure overflow is hidden
  });
  
}
	
	
	$('#newRegistered .linkDots a').click(selectNav);
	
	function selectNav() {
		$(this)
			.parents('ul:first')
				.find('a')
					.removeClass('selected')
				.end()
			.end()
			.addClass('selected');
	}
	
	
	var scrollOptions = {
		target: $scroll,
		items: $panels,
		navigation: '.linkDots a',
		prev: 'img.left',
		next: 'img.right',
		axis: 'xy',
		duration: 500,
		easing: 'swing',
		onAfter: trigger,
		start: 0
	
	};
	
	function trigger(data) {
		var el = $('#newRegistered .linkDots').find('a[href$="' + data.id + '"]').get(0)
		selectNav.call(el);
	}
	
	if (window.location.hash) {
		trigger({ id: window.location.hash.substr(1) })
	} else {
		$('#newRegistered .linkDots a:first').click();
	}
	
	$('#newRegistered').serialScroll(scrollOptions);
	
	$.localScroll(scrollOptions);
	
	
});
