$(document).ready(function()
{
	// recipe tabs
	$('div#recipe_tabs_contents .recipe_box').css('display', 'none');
	$('div#recipe_tabs_contents .recipe_box:first-child').css('display', 'block');

	$('div#recipe_tabs a').click(function()
	{
		$('#recipe_tabs a').parent().removeClass('active');
		$(this).parent().addClass('active');

		var thisTarget = $(this).attr('href');

		$('#recipe_tabs_contents div.recipe_box').css('display', 'none');
		$(thisTarget).css('display', 'block');
		this.blur();
		return false;
	});

	// character counter
	$('textarea#comment_field').keyup(function() {
		var maxChars = 500;
		var charLength = $(this).val().length;
		var text = $(this).val();
		if ( charLength > maxChars)
		{
			$(this).val(text.substr(0, maxChars));
			charLength = maxChars;
		}
		$('span#char_count').html('Mai aveti ' + (maxChars - charLength ) + ' caractere');
		$('div#progress').css('width', charLength/2);
	});

});



//  Detail Page ~

	original_img_name = '';


	function set_default_img(img_name){
		original_img_name = img_name;
	}
	
	function reset_img(){
		$("#big_image").attr("src",original_img_name);
	}
	
	function switch_img(img_name){
		$("#big_image").attr("src",img_name);
	}
	
	function switch_visible(hide, show){
		$(hide).attr("style","display:none");
		$(show).attr("style","display:visible");
	}
	
	$(document).ready(function() {
		$('li#recipe a').click(function () { 
			$('li#photos a').removeClass('sel');
			$(this).addClass('sel');
		});
		$('li#photos a').click(function () { 
			$('li#recipe a').removeClass('sel');
			$(this).addClass('sel');
		});
	})
