//Section changer
var sections = ['overview','features','gallery'];

function section(section_id) {
	for(s_n in sections) {
		sec_name = sections[s_n];
		if(section_id == sec_name) {
			$('#top_' + sec_name).slideDown('slow');
			$('#bottom_' + sec_name).slideDown('slow');
			$('#nav_' + sec_name).addClass('active');
			console.log($('#nav_' + sec_name))
		} else {
			$('#top_' + sec_name).slideUp('slow');
			$('#bottom_' + sec_name).slideUp('slow');
			$('#nav_' + sec_name).removeClass('active');
		}
		
	}
}

//Gallery code
curr_photo = 0;

function photo(photo_id) {
	if(photo_id != curr_photo) {
		curr_thumb = $('#thumb_' + curr_photo);
		//curr_thumb = $('#pth_' + curr_photo);
		thumb = $('#thumb_' + photo_id);
		//thumb = $('#pth_' + photo_id);
		curr_thumb.removeClass('active');
		thumb.addClass('active');
		
		//main_src = thumb.attr('src').replace(/thumb/g, "main");
		main_src = thumb.attr('src').replace(/pth/g, "photo");
		$('#gallery_main img').attr('src', main_src);
		
		curr_photo = photo_id;
		$('#gallery_min').text(curr_photo);
	}
}

//Init
function init() {
	section('overview');
	photo('1');
	
	//Count and show num of photos
	$('#gallery_max').text($('#gallery_thumbs a').length);
}
