$(document).ready(function(){

    // fetch our current product category name
    var classArray = $('body').attr("class").split(" ");
    var productCat = classArray[1];

    $(".details a").click(function () {
        $(this).parent('h2').siblings('ul,p,table').toggle();
        if($(this).children('img').attr('src').indexOf("right") != -1){
            $(this).children('img').attr({src:"/img/arrow-down-"+productCat+".gif"});
            $(this).attr({title:"Close section"});
        }
        else{
            $(this).children('img').attr({src:"/img/arrow-right-"+productCat+".gif"});
            $(this).attr({title:"Expand section"});
        }
        return false;
    });

    $("a#Recipe").click(function () {
        $("#Technical").hide();
        $("#Method").show();
        $(this).attr({className:"selected"});
        $("a#Technicaldetails").attr({className:""});
        return false;
    });

    $("a#Technicaldetails").click(function () {
        $("#Technical").show();
        $("#Method").hide();
        $(this).attr({className:"selected"});
        $("a#Recipe").attr({className:""});
        return false;
    });

    $(".details.closed").children('ul,p,table').hide();
    $("#Technical").hide();
});