
if (!window['$hnj'] || !$hnj.registry.included('/scripts/components/webRecipeSidebarComponent.js')) { 
$hni.components.webRecipeSidebarComponent = function(elementId) {
    var base = new $hni.components.manager(elementId);

    return $hnj.extend(
		base,
		{
		    initialize: function() {
		    $hnj('.hnie_RelatedContentPrimary').children('.hni_RelatedTopicsHeading').wrap('<div id="arrowContainerPrimary" onclick="$hni.components.manager.get(\'hni_RecipeSidebar\').toggleCategory(\'primary\');return false;">');
		    $hnj('.hnie_RelatedContentSecondary').children('.hni_RelatedTopicsHeading').wrap('<div id="arrowContainerSecondary" onclick="$hni.components.manager.get(\'hni_RecipeSidebar\').toggleCategory(\'secondary\');return false;">');
		        $hnj('#arrowContainerPrimary').prepend('<span class="hni_RecipeSidebarArrow alternate"></span>');
		        $hnj('#arrowContainerSecondary').prepend('<span class="hni_RecipeSidebarArrow alternate"></span>');
		        $hnj('.hnie_RelatedContentPrimary').children('.hnise_RelatedContentList').hide();
		        $hnj('.hnie_RelatedContentSecondary').children('.hnise_RelatedContentList').hide();
		    },
		    toggleCategory: function(category) {
		        switch (category) {
		            case 'quickfacts':
		                $hnj('.hnie_RelatedContentPrimary').children('.hnise_RelatedContentList').hide();
		                $hnj('.hnie_RelatedContentSecondary').children('.hnise_RelatedContentList').hide();
		                $hnj('#arrowContainerPrimary').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('#arrowContainerSecondary').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('.hni_RecipeSidebar').toggle();
		                $hnj('.hni_RecipeSidebarSubhead').children('.hni_RecipeSidebarArrow').toggleClass('alternate');
		                break;
		            case 'primary':
		                $hnj('.hni_RecipeSidebar').hide();
		                $hnj('.hni_RecipeSidebarSubhead').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('.hnie_RelatedContentSecondary').children('.hnise_RelatedContentList').hide();
		                $hnj('#arrowContainerSecondary').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('.hnie_RelatedContentPrimary').children('.hnise_RelatedContentList').toggle();
		                $hnj('#arrowContainerPrimary').children('.hni_RecipeSidebarArrow').toggleClass('alternate');
		                break;
		            case 'secondary':
		                $hnj('.hni_RecipeSidebar').hide();
		                $hnj('.hni_RecipeSidebarSubhead').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('.hnie_RelatedContentPrimary').children('.hnise_RelatedContentList').hide();
		                $hnj('#arrowContainerPrimary').children('.hni_RecipeSidebarArrow').addClass('alternate');
		                $hnj('.hnie_RelatedContentSecondary').children('.hnise_RelatedContentList').toggle();
		                $hnj('#arrowContainerSecondary').children('.hni_RecipeSidebarArrow').toggleClass('alternate');
		                break;
		        }
		    }
		});
};

}
if (window['$hnj']) { $hnj.registry.register('/scripts/components/webRecipeSidebarComponent.js', false); };


