/**
 * common.js
 *	-Common Javascript functions
 **/
  //Most functions require jQuery
  
  //Create a cookie to tell us user has JS
		var tday = new Date();
		
		tday.setTime(tday.getTime() + 1800000); //expires in a 1/2 hour
		//Set the cookie to expire in a minute
		//That's enough time for HPP to use it, but if user disables js it'll disappear
		document.cookie="FRENCH_js=1;path=/;expires="+tday.toGMTString();
  
	$(document).ready(function(){
		if($('#recipesearch_submit_button').length>0){
			$('#recipesearch_submit_submit').css('display','none');
			$('#recipesearch_submit_button').css('display','');
		}
		
		//display print recipe link
		if($('#print-recipe').length>0) $('#print-recipe').css('display','');
		
		$('#search-toggle').click(function(e){
			e.preventDefault();
			$('#recipe-search-box-condensed').hide();
			$('#recipe-search-box').show();
		});
		
		$('.close-search').click(function(){
			$('#recipe-search-box').hide();
			$('#recipe-search-box-condensed').show();
		});
		
		$('#nutrition-link, .nutrition-link').colorbox({fixedWidth:'557',fixedHeight:'544',inline:true,href:"#nutrition-popup"});
		$('#nutrition-link-2, .nutrition-link-2').colorbox({fixedWidth:'557',fixedHeight:'544',inline:true,href:"#nutrition-popup-2"});
		
		if($('#top-search-field').length>0){
			$('#top-search-field #keywords').keypress(function(e){
				//if enter is pressed, submit form
				if(e.which == 13) $('#top-search-field button').click();
			});	
		}
	});