﻿


function HideMostPopularTabs() {
    document.getElementById("dvRecipes").style.display = "none";
    document.getElementById("dvArticles").style.display = "none";
    document.getElementById("dvKeywords").style.display = "none";
    document.getElementById("tdRecipes").className = "NormalTab";
    document.getElementById("tdArticles").className = "NormalTab";
    document.getElementById("tdKeywords").className = "NormalTab";
}
function ShowHideMostPopularTab(TabId, DivId) {
    HideMostPopularTabs();
    document.getElementById(DivId).style.display = "block";
    document.getElementById(TabId).className = "SelectedTab";
    document.getElementById("hdnTab").value = TabId;
}
function HighLightMostPopularTab(TabId) {
    document.getElementById(TabId).className = "SelectedTab";
}
function SetNormalMostPopularTab(TabId) {
    var HdnTabId;
    HdnTabId = document.getElementById("hdnTab");
    if (HdnTabId.value != TabId)
        document.getElementById(TabId).className = "NormalTab";
}


    function PopulateSearchLabel(obj) {
        //debugger;
        var mySelection = "";        
        if (obj == '1')
            mySelection = "RECIPE SEARCH";
        if (obj == '3')
            mySelection = "COLLECTION SEARCH";
        if (obj == '4')
            mySelection = "MENU SEARCH";
        if (obj == '5')
            mySelection = "PRODUCT SEARCH";        
        var HiddenSelection = document.getElementById('ctl00_PageHeaderUC_SearchBarUC_HiddenSelection');        
        HiddenSelection.value = mySelection;        
    }
    var posX;
    var posY;
    
    function findPos(obj) {
        posX = obj.offsetLeft;
        posY = obj.offsetTop;
        while (obj.offsetParent) {
            if (obj == document.getElementsByTagName('body')[0])
            { break }
            else {
                posX = posX + obj.offsetParent.offsetLeft;
                posY = posY + obj.offsetParent.offsetTop;
                obj = obj.offsetParent;
            }
        }
    }

    function ShowProductSearchDropDown() {
        if (document.getElementById('ProductSearchDropDown').style.display == 'none') {
            document.getElementById('ProductSearchDropDown').style.display = 'block';
        }
    }
    function HideProductSearchDropDown() {
        if (document.getElementById('ProductSearchDropDown').style.display == 'block')
            document.getElementById('ProductSearchDropDown').style.display = 'none';
    }   

    function SelectProductDropDown(NewLabel, ty) {
        if (ty == 'r') {

            document.getElementById('SearchLabel').innerHTML = NewLabel;
            HideProductSearchDropDown();
            PopulateSearchLabel('1');
        }
        else if (ty == 'a') {
            document.getElementById('SearchLabel').innerHTML = NewLabel;
            HideProductSearchDropDown();
            PopulateSearchLabel('3');
        }
        else if (ty == 'm') {
            document.getElementById('SearchLabel').innerHTML = NewLabel;
            HideProductSearchDropDown();
            PopulateSearchLabel('4');
        }
        else {
            document.getElementById('SearchLabel').innerHTML = NewLabel;
            HideProductSearchDropDown();
            PopulateSearchLabel('5');
        }
    }

