/* Author: 

*/


$(document).ready(function() {
	
	function updateAbout(id) {
		$(".about_description").removeClass('about_selected');
		$(".about_thumb").removeClass('selected');
		$("#about_description_"+id).addClass('about_selected');
		$("#about_thumb_"+id).addClass('selected');
		$(".about_link").removeClass('selected');
		$("#about_link_"+id).addClass('selected');
	}
	
	$(".about_link").click(function() {
		
		var id = $(this).attr('id').substr(11);
		updateAbout(id);
		
	});
	
	$(".about_thumb").click(function() {
		
		var id = $(this).attr('id').substr(12);
		updateAbout(id);
	});
	
	$(".thumbs a").colorbox({maxHeight:'95%', maxWidth:'95%'});
	
	$(".specs_show").click(function() {
		$(".tab_cntr").hide();
		$("#specifications_tab").show();
		$('.buttons a').removeClass('selected');
		$(this).addClass('selected');
	});
	
	$(".additional").click(function() {
		$(".tab_cntr").hide();
		$("#add_cntr").show();
		$('.buttons a').removeClass('selected');
		$(this).addClass('selected');
	})
	
	$(".specs_button").click(function(){ 
		var id = $(this).attr('id').substr(13);
		
		$(".specs_tab_cntr").hide();
		$("#specs_"+id).show();
		$('#specs_links .specs_button').removeClass('selected');
		$(this).addClass('selected');
	});
	
	$(".features").click(function(){ 
		$(".tab_cntr").hide();
		$("#features").show();
		$('.buttons a').removeClass('selected');
		$(this).addClass('selected');
	});
	
	$(".other").click(function(){ 
		$(".tab_cntr").hide();
		$("#other_information").show();
		$('.buttons a').removeClass('selected');
		$(this).addClass('selected');
	});
	
	$("#contact_form").submit(function(e) {
		e.preventDefault();
		var formdata = $(this).serialize();
		
		$.ajax({
			type: 'POST',
			url: 'ajax_form.php',
			data: formdata,
			success: function(ret) {
				
				if(ret == 'success') {
					alert('Thank you for your comments. You will hear from us soon.');
					$("#contact_form").find('input, textarea').not('#submit').val('');
				}
				
			}
		});
		
	});
	
});









