jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

// Preload the images common to all pages
var bp = "App_Themes/Washington/images/";//basePath
$.preloadImages(bp + "top1.jpg", bp + "bottom.jpg", bp + "backgroundrepeat.jpg",bp + "top_imageareaBeefStory.jpg",bp + "top_imagearea.jpg",bp + "top_imagearea2.jpg",bp + "top_imagearea3.jpg",bp + "top_imagearea4.jpg",bp + "top_imagearea5.jpg");

$(document).ready(function()
{
    //wireup the search box events
    var searchBox = $("#txtRecipeSearch");
    
    if(searchBox)
    {
        //Detect enter key press
        $("#txtRecipeSearch").keypress(function(e){
            //check for key code in FF and IE respectively
            if(e.which == 13 || e.keyCode == 13)
            {
                RecipeSearch(this);
                return false;
            }
        });
        
        $("#txtRecipeSearch").focus();
    }
}
);

function RecipeSearch()
{
    var searchTerm = $("#txtRecipeSearch").val();
    if(searchTerm.length > 0)
    {
        window.location='recipesearch.aspx?q=' + searchTerm;
    }
}
