function get_page_info() {
	var pi = {
		'index': {
			'left':'50px'
			},
		'about': {
			'left':'-910px'
			},
		'collections': {
			'left':'-1870px'
			},
		'cards': {
			'left':'-2830px'
			},
		'custom': {
			'left':'-3790px'
			},
		'ordering': {
			'left':'-4750px'
			},
		'fine_print': {
			'left':'-5710px'
			}	
		}
		
	return pi;
	}

function next_gallery_image(wrapper_id) {
	var gal_width = 462;
	
	var wrapper = $('#' + wrapper_id);
	var w_left = parseInt(wrapper.css('left'));
	
	//if it's not found, set it to 0
	if(!w_left)
		w_left = 0;
		
	var gal_count = $('#' + wrapper_id + ' img').length;
	
	if(w_left <= -((gal_count - 1) * gal_width)) {
		var new_left = 0;
		}
	else {
		var new_left = w_left - gal_width;
		}	

	new_left += 'px';
	wrapper.css('left', new_left);		
	}
	
function previous_gallery_image(wrapper_id) {
	gal_width = 462;
	
	var wrapper = $('#' + wrapper_id);
	var w_left = parseInt(wrapper.css('left'));
	
	//if it's not found, set it to 0
	if(!w_left)
		w_left = 0;
		
	var gal_count = $('#' + wrapper_id + ' img').length;
	
	if(w_left >= 0) {
		new_left = -((gal_count - 1) * gal_width);
		}
	else {
		new_left = w_left + gal_width;
		}
	
	new_left += 'px';
	wrapper.css('left', new_left);		
	}
	
	
function move_content(calculated_left) {
	$('#content').animate({
		left: calculated_left
		}, 1000);
	}
	
function page_init() {
	jQuery.easing.def = 'easeInOutQuart';
	var page_info = get_page_info();
	
	$('#logo').click(function(e) {
		$('#nav a').removeClass('selected');
		e.preventDefault();
		move_content(page_info.index.left);
		});

	$('#nav a').click(function(e) {
		$('#nav a').removeClass('selected');
		$(this).addClass('selected');
		
		
		switch($(this).attr('id')) {
			case 'nav_about':
				move_content(page_info.about.left);
				e.preventDefault(); /*including this within case so blog and shop links will work (we don't want them "prevented"*/
				break;
			case 'nav_collections':
				move_content(page_info.collections.left);
				e.preventDefault();
				break;
			case 'nav_custom':
				move_content(page_info.custom.left);
				e.preventDefault();
				break;
			case 'nav_cards':
				move_content(page_info.cards.left);
				e.preventDefault();
				break;			
			}
		});
	
	$('.sub_menu a').click(function(e) {
		e.preventDefault();
		
		if($(this).hasClass('nav_wedding'))
			move_content(page_info.collections.left);
		if($(this).hasClass('nav_cards'))
			move_content(page_info.cards.left);
		if($(this).hasClass('nav_ordering'))
			move_content(page_info.ordering.left);
		if($(this).hasClass('nav_fine_print'))
			move_content(page_info.fine_print.left);
		if($(this).hasClass('nav_showcase'))
			move_content(page_info.custom.left);		
		});
	
	$('a.next').live('click', function(e) {
		e.preventDefault();
		next_gallery_image($(this).attr('rel'));
		});
	$('a.previous').live('click', function(e) {
		e.preventDefault();
		previous_gallery_image($(this).attr('rel'));
		});	
$('a.nav_wedding, #nav_collections').click(function() {
  $('#collections_wedding #wedding_description').html($('#collections_wedding .hidden #intro .description').html());
  $('#collections_wedding #wedding_gallery').html($('#collections_wedding .hidden #intro .gallery_holder').html());
  $('#collections_wedding a.previous, #collections_wedding a.next').hide();
  $('#wedding_buttons a').removeClass('active');
});
$('#wedding_buttons a').click(function() {
  $('#collections_wedding #wedding_description').html($('#collections_wedding .hidden #' + $(this).attr('rel') + ' .description').html());
  $('#collections_wedding #wedding_gallery').html($('#collections_wedding .hidden #' + $(this).attr('rel') + ' .gallery_holder').html());
  $('#collections_wedding a.previous, #collections_wedding a.next').show();
  $('#wedding_buttons a').removeClass('active');
  $(this).addClass('active');
  $('#wedding_gallery').css('left',0);
});
	}

