How to condense and call each function in a for loop or if statement under one larger function?
<pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;link rel="stylesheet" href="css/general.css" /&gt;
        &lt;link id="style_replace" rel="stylesheet" href="css/default.css" /&gt;
        &lt;script type="text/javascript" src="js/jquery-1.5.min.js"&gt;&lt;/script&gt;
        &lt;style type="text/css"&gt;.pretty { color:pink; }&lt;/style&gt; 
        &lt;script type="text/javascript"&gt;
        function showApple(bakedGood)
        {
            $("#applepie_off, .apple_description").show();
            $("#applepie_on").hide();
        }

        function hideApple(bakedGood)
        {
            $("#applepie_off, .apple_description").hide();
            $("#applepie_on").show();
        }

        function showBanana(bakedGood)
        {
            $("#banana_off, .banana_description").show();
            $("#banana_on").hide();
        }

        function hideBanana(bakedGood)
        {
            $("#banana_off, .banana_description").hide();
            $("#banana_on").show();
        }

        function showCarrot(bakedGood)
        {
            $("#carrot_off, .carrot_description").show();
            $("#carrot_on").hide();
        }

        function hideCarrot(bakedGood)
        {
            $("#carrot_off, .carrot_description").hide();
            $("#carrot_on").show();
        }

        function showCookie(bakedGood)
        {
            $("#cookie_off, .cookie_description").show();
            $("#cookie_on").hide();
        }

        function hideCookie(bakedGood)
        {
            $("#cookie_off, .cookie_description").hide();
            $("#cookie_on").show();
        }

        function changeStyleSheet(styleName)
        {
            $("#style_replace").attr("href", "css/" + styleName + ".css");
        }

    $(function()
        {
            $(".contract, .apple_description, .banana_description, .carrot_description, .cookie_description").hide();

        });

&lt;/script&gt;
</code></pre>

<p>

    
        
        Original&nbsp; &nbsp;
        Larger Text 
    <br /></p>

<pre><code>&lt;h1&gt;Recepie List&lt;/h1&gt;

&lt;div id="list"&gt;

    &lt;div id="apple_pie" class="recepie"&gt;

        &lt;h3&gt;Apple Pie&lt;/h3&gt;

        &lt;a class="expand" id="applepie_on" href="#" onClick="showApple()"&gt;expand&lt;/a&gt; 
        &lt;a class="contract" href="#" id="applepie_off" onClick="hideApple()"&gt;contract&lt;/a&gt;

        &lt;img class="desert_img" src="images/apple_pie.jpg" /&gt;

        &lt;p class="apple_description"&gt;   
            This was my grandmother's apple pie recipe. &lt;br /&gt;
            I have never seen another one quite like it. &lt;br /&gt;
            It will always be my favorite and has won me &lt;br /&gt;
            several first place prizes in local competitions. &lt;br /&gt;
            I hope it becomes one of your favorites as well!
        &lt;/p&gt;

    &lt;/div&gt;

    &lt;div id="banana_bread" class="recepie"&gt;

        &lt;h3&gt;Banana Bread&lt;/h3&gt;

        &lt;a class="expand" id="banana_on" href="#" onClick="showBanana('banana_bread')"&gt;expand&lt;/a&gt; 
        &lt;a class="contract" id="banana_off" href="#" onClick="hideBanana('banana_bread')"&gt;contract&lt;/a&gt; 

        &lt;img class="desert_img" src="images/banana_bread.jpg" /&gt;

        &lt;p class="banana_description"&gt;  
            Why compromise the banana flavor? This banana &lt;br /&gt;
            bread is moist and delicious with loads of &lt;br /&gt;
            banana flavor! Friends and family love my recipe &lt;br /&gt;
            and say it's by far the best! It's wonderful toasted!! Enjoy!
        &lt;/p&gt;

    &lt;/div&gt;

    &lt;div id="carrott_cake" class="recepie"&gt;

        &lt;h3&gt;Carrott Cake&lt;/h3&gt;

        &lt;a class="expand" id="carrot_on" href="#" onClick="showCarrot('carrot_cake')"&gt;expand&lt;/a&gt; 
        &lt;a class="contract" id="carrot_off" href="#" onClick="hideCarrot('carrot_cake')"&gt;contract&lt;/a&gt; 

        &lt;img class="desert_img" src="images/carrott_cake.jpg" /&gt;

        &lt;p class="carrot_description"&gt;  
            Why compromise the banana flavor? This banana &lt;br /&gt;
            bread is moist and delicious with loads of &lt;br /&gt;
            banana flavor! Friends and family love my recipe &lt;br /&gt;
            and say it's by far the best! It's wonderful toasted!! Enjoy!
        &lt;/p&gt;

    &lt;/div&gt;

    &lt;div id="holiday_cookies" class="recepie"&gt;

        &lt;h3&gt;Holiday Cookies&lt;/h3&gt;

        &lt;a class="expand" id="cookie_on" href="#" onClick="showCookie('holiday_cookies')"&gt;expand&lt;/a&gt; 
        &lt;a class="contract" id="cookie_off" href="#" onClick="hideCookie('holiday_cookies')"&gt;contract&lt;/a&gt; 

        &lt;img class="desert_img" src="images/holiday_cookies.jpg" /&gt;

        &lt;p class="cookie_description"&gt;  
            This is an old family recipe that makes a very &lt;br /&gt;
            delicious cookie.
        &lt;/p&gt;

    &lt;/div&gt;

&lt;/div&gt;
</code></pre>

<p>
</p>
