function getFeature(id) {
	
		$('#feature_nav > ul > li').removeClass('selected');
		$('#' + id).parent('li').addClass('selected');
		$('div.feature:visible').fadeOut(200, function() {
			$('div.feature').hide();
			$('#styler_'+id).fadeIn(400);
		});

}

function _getFeature(id) {
	$('#feature_nav > ul > li').removeClass('selected');
	$('#' + id).parent('li').addClass('selected');
	var page = $('#' + id).attr('href');
	$('#feature').fadeOut(200, function() {
		$.ajax({
			url: page,
			success: function(msg){
				$('#feature').html(msg).fadeIn(400);
			}
		});
	});
}

$(document).ready(function() {

	// select styler feature
	$('#feature_nav > ul > li > a').click(function() {
		if( !$(this).parent('li').hasClass('selected') ) {
			var id = $(this).attr('id');
			getFeature(id);
		};
		return false;
	});
	
	$('#feature_prev').click(function() {
		if( !$('#feature_nav > ul > li:first').hasClass('selected') ) {
			var current = $('#feature_nav > ul > li.selected > a');
			var id = parseInt($(current).attr('id')) - 1;
			getFeature(id);
		} else {
			var id = parseInt($('#feature_nav > ul > li:last > a').attr('id'));
			getFeature(id);
		}
		
		return false;
	});
	$('#feature_next').click(function() {
		if( !$('#feature_nav > ul > li:last').hasClass('selected') ) {
			var current = $('#feature_nav > ul > li.selected > a');
			var id = parseInt($(current).attr('id')) + 1;
			getFeature(id);
		} else {
			var id = parseInt($('#feature_nav > ul > li:first > a').attr('id'));
			getFeature(id);
		}
		return false;
	});
	
	// select thermodynamics range
	$('#thermo_select > div.shop_quarter').click(function() {
		if( !$(this).hasClass('selected') ) {
			$('#thermo_select > div.selected').removeClass('selected');
			$(this).addClass('selected');
			/*
			var id = $(this).attr('id');
			$('#thermo_display').slideUp(450, function() {
				$.ajax({
					type: "GET",
					url: id + ".php",
					success: function(msg){
						$('#thermo_display').html(msg).slideDown(750);
					}
				});
			});
			*/
			var div = $(this).attr('id');
			
			$('#thermo_display_wrapper').slideUp(450, function() {
				$('div.thermo_display').hide();
				$('#products_'+div).show();
				$('#thermo_display_wrapper').slideDown(750);
			});
		}
		return false;
	});
	
});