function InitMouseOverMenus() {
    //set up all mouseover states for items that open up
    $(".searchBtn,#searchMenu").hover(
        function() {
            $("#searchMenu").show();
            $(this).addClass("current");
        },
        function() {
            $("#searchMenu").hide();
            $(this).removeClass("current");
        }
    );
    $("#myFolder, #myFolderMenu").hover(
      function(){
        $("#myFolderMenu").show();
        $(this).addClass("current");
      },
      function(){
        $("#myFolderMenu").hide();
        $(this).removeClass("current");
      }
    );

    //set up all mouseover states for the map menu items
                $(".MapMenuItem").hover(
                function () {
                    $("ul:first", this).css("display", "block");
                    //$(this).attr("old_id", $(this).attr("id"));
                    $(this).addClass("current");
                },
                function () {
                    $("ul:first", this).css("display", "none");
                    $(this).removeClass("current");
                    //$(this).attr("id", $(this).attr("old_id"));
                }
            );
    FixIE7IndexingContainer($("#contentBoxHeader"), 7900);
    FixIE7IndexingContainer($("#contentNav"), 9000);
}

function SetUpInteractivityProperty(pProperty) {
    //TODO: Make dragging to my folder work
    //    pProperty.draggable(
    //    {
    //        start: function(event, ui) {
    //            var myClone = $($(ui)[0].helper[0]);
    //            myClone.css({ height: "400px", opacity: ".5", filter: "alpha(opacity=50)" });

    //            //enlarge the drag zone
    //            $("#myFolderDropArea").css({ height: "400px", bottom: "0px", backgroundImage: "url(images/map/myFolderDrop.png)" });
    //            FixIE7IndexingContainer(myClone, 10000);
    //        },
    //        stop: function(event, ui) {
    //            //retrun the drag zone
    //        $("#myFolderDropArea").css({ height: "55px", top: "0px", backgroundImage: "none" });
    //        },
    //        revert: 'invalid', // when not dropped, the item will revert back to its initial position
    //        helper: 'clone',
    //        appendTo: '#dragResultHelper'
    //    }
    //    );





    //set up all mouseover states for items that open up
    //    $(".GeoRefineLink", pProperty).hover(
    //                function() {
    //                    $("ul:first", this).css("display", "block");
    //                    $(this).attr("id", "current");
    //                },
    //                function() {
    //                    $("ul:first", this).css("display", "none");
    //                    $(this).attr("id", "");
    //                }
    //            );



    //Set up the save sliders. Functionallity is, mouse over the imagebox, they open up. Mouseout closes. If you close manually, they stay
    //closed until you open them manually and then they resume normal functionallity.       
    $(pProperty).hover(
        function() {
            if ($(".saveSliderOpen:first", this).attr("ClosedManually") != "true") {
                $(".saveSliderOpen:first", this).css("display", "block");
                $(".saveSliderOpen:first", this).attr("IsOpen", "true");
            }

            var myMarker = FindPropertyMarker($(pProperty).attr("id"));
            if (myMarker !== null)
                myMarker.Highlight();
            $(this).addClass("mouseover");
        },
        function() {
            $(".saveSliderOpen:first", this).css("display", "none");
            $(".saveSliderOpen:first", this).attr("IsOpen", "false");

            var myMarker = FindPropertyMarker($(pProperty).attr("id"));
            if (myMarker !== null)
                myMarker.Lowlight();
            $(this).removeClass("mouseover");
        }
    );


    $(".saveSlider", pProperty).click(
                 function(e) {
                     var $mySlider = $(".saveSliderOpen:first", this);
                     if ($mySlider.attr("IsOpen") == "true") {
                         $mySlider.hide();
                         $mySlider.attr("IsOpen", "false");

                         if ($(e.target).hasClass("saveSliderOpen")) {
                             $mySlider.attr("ClosedManually", "true");
                         }
                     } else {
                         $mySlider.show();
                         $mySlider.attr("IsOpen", "true");

                         if ($(e.target).parent().hasClass("saveSliderClosed")) {
                             $mySlider.attr("ClosedManually", "false");
                         }
                     }
                 }
                );



    //fix z-indexing eac
    var myRelativeZIndex = 4000 - (parseInt(pProperty.attr("resultID") - $(pProperty.parent().children()[0]).attr("resultID"),10) * 50);
    FixIE7IndexingContainer(pProperty, myRelativeZIndex);



} //end function

function RemoveInteractivityProperty(pProperty) {
    pProperty.contents().andSelf().unbind();
} //end function


function AddDroppedItemToFolder(pElement) {
    alert("Not implemented at this time.");
}


function ShowSearch(pWhatSearch) {
    _searchWindow.Show(pWhatSearch);
    SetSearchButtonsRightPosition();
} //end function ShowSearch

function RefineSearch() {
    var myType = _SSR._CurrentViewType;
    ShowSearch(myType);
} //end function

function ShowSubSearch(pSearchForm, pSubSearch) {
    //load the subsearch window if not already added to the DOM

    $("#windowBoxSpace .loadingResults").css("display", "block");
    $(".searchTypeSubWindow").css("display", "none");

    if ($("#search_" + pSearchForm.toLowerCase() + "_" + pSubSearch).length === 0) {
        $.ajax({
            url: ZPEClient.GetSearchSubsetFragmentUrl(pSearchForm, pSubSearch),
            cache: false, //TODO: insures the latest version (we may want to consider turning this off after development)
            success: function(html) {
                $("#windowBoxSpace").append("<div>" + html + "</div>");

                ShowSubSearch_SubWindow(pSearchForm, pSubSearch);
                ShowSubSearch_HightlightCurrentSubType(pSearchForm, pSubSearch);
            }, //end success
            error: function(XMLHttpRequest, textStatus, errorThrown) {

            }
        });   //end ajax
    } else {
        if (pSubSearch == 2){ // Needed to initialize the right subtab on location search
            LoadGeoEntities("CITIES", "City", pSearchForm.toUpperCase());
        }

        ShowSubSearch_SubWindow(pSearchForm, pSubSearch);
        ShowSubSearch_HightlightCurrentSubType(pSearchForm, pSubSearch);
    }  //end if not added
} //end function

function ShowSubSearch_SubWindow(pSearchForm, pSubSearch) {
    // show only the correct window
    $(".searchTypeSubWindow").each(
        function() {
            var myCSSDisplayValue = $(this).attr("id") == "search_" + pSearchForm.toLowerCase() + "_" + pSubSearch ? "block" : "none";
            $(this).css("display", myCSSDisplayValue);
        }
    );  //end for each subwindow

    $("#windowBoxSpace .loadingResults").css("display", "none");
} //end function

function ShowSubSearch_HightlightCurrentSubType(pSearchForm, pSubSearch) {
    //highlight (set parent class to current) the sub menu item
    $("li", "#windowMenu").each(
        function() {
            $(this).attr("class", $("a:first", this).attr("id").replace("windowMenu_", "") == pSubSearch.toLowerCase() ? "current" : "");
        }
    ); //end for each subwindow
} //end function


function SetupSubSearchMenu(pWhatType) {
    //change the menu
    var myType = pWhatType;
    //title
    $("#windowMenuTitle").html("Find " + myType + " by: ");
    //links
    $("#windowMenu_1").attr("href", "javascript:ShowSubSearch('" + myType + "','1');");
    $("#windowMenu_2").attr("href", "javascript:ShowSubSearch('" + myType + "','2');");
    $("#windowMenu_3").attr("href", "javascript:ShowSubSearch('" + myType + "','3');");
    $("#windowMenu_4").attr("href", "javascript:ShowSubSearch('" + myType + "','4');");

    switch (myType) {
        case "sites":
            $("#windowMenu_1").html("Basic").attr("title", "Specify basic search criteria");
            $("#windowMenu_2").html("Geography").attr("title", "Specify location information like; street, city, county, region, and MSA");
            $("#windowMenu_3").html("Assets").attr("title", "Specify specific assets like water and rail access");
            $("#windowMenu_4").html("Advanced").attr("title", "Specify advanced features like ceiling height and brownfield");
            break;
        case "buildings":
            $("#windowMenu_1").html("Basic").attr("title", "Specify basic search criteria");
            $("#windowMenu_2").html("Geography").attr("title", "Specify location information like; street, city, county, region, and MSA");
            $("#windowMenu_3").html("Assets").attr("title", "Specify specific assets like water and rail access");
            $("#windowMenu_4").html("Advanced").attr("title", "Specify advanced features like ceiling height and brownfield");
            break;
        case "communities":
            $("#windowMenu_1").html("Basic").attr("title", "Specify basic search criteria");
            $("#windowMenu_2").html("People").attr("title", "More options on people like budgets and eduction");
            $("#windowMenu_3").html("Transportation").attr("title", "Specify transporation needs");
            $("#windowMenu_4").html("Advanced").attr("title", "Speficy advanced features like patents and venture capital");
            break;
        case "businesses":
            $("#windowMenu_1").html("Basic").attr("title", "Specify basic search criteria");
            $("#windowMenu_2").html("Location").attr("title", "Specify location information like; street, city, county, region, and MSA");
            $("#windowMenu_3").html("Clusters").attr("title", "Create of choose business clusters");
            $("#windowMenu_4").html("Advanced").attr("title", "Specify advanced features");
            break;
      default:break;
    } //end case
}

function HideSearch() {
    _searchWindow.Hide();
}

function SwitchOrientation(pOrientation) {
    if ($("#ContentItemHolder .property").length === 0) {
        setTimeout(function () { SwitchOrientation(pOrientation); }, 100);
    }
    else {
        if (pOrientation === undefined && pOrientation === null) {
            pOrientation = /(horizontal|vertical)/.exec($("#orientationContainer").attr("class"))[1];
        }
        if (pOrientation == "horizontal" || pOrientation == "vertical") {
            //var myType = _SSR._CurrentViewType;
            //var myTracker = _SSR._Trackers[myType];
            //myTracker.ResultOrientation = pOrientation
            ResetContentItemHolder();
            //CreateLoadingScreen("CONTENT");
            ChangeResultOrientation(pOrientation);
            setTimeout(ManagePropertyResults, 200);
        }
    }
}

function ToggleResultOrientation() {
    var IsVertical = DetermineIfResultsAreVertical();
    var orientation = IsVertical ? "horizontal" : "vertical";
    SwitchOrientation(orientation);
} //end function

function DetermineIfResultsAreVertical() {
    return $("#orientationContainer").hasClass('vertical');
} //end function

function ActivateTool(pWhatTool) {
    _mapBar.ActivateTool(pWhatTool);
} //end function

function AddLayerToMenu(pLayerClass, pLayerID, pLayerDisplayName) {
    $("#MapMenuItem_Layers").append('<li class="' + pLayerClass + '"><span></span><a href="javascript:ToggleLayer(' + pLayerID + ');">' + pLayerDisplayName + '</a></li>)');
} //end function


function ToggleLayer(pWhatLayer) {
    alert("Not Implemented Yet");
} //end function

function ShowDynamicModal(pHtmlContent, pHideButton) {
    $('#dynamicModalContent').empty().html(pHtmlContent);
    $("#tblExport").css("display", "none");
    if (pHideButton === undefined) {
        $('#actionSubmit').show();
    }
    else if (!pHideButton) {
        $('#actionSubmit').hide();
    }
    $('#dynamicModalWindow').jqm({"toTop":true}).jqmShow();
}

function ShowExternalContentInModal(pURL) {
    $('#dynamicModalContent').empty().load(pURL);
    $('#actionSubmit').css("display", "none");
    $('#dynamicModalWindow').jqm({ "toTop": true }).jqmShow();
} //end function

function ShowExternalContentInModalWithCallback(pURL, pCallback) {
    $('#dynamicModalContent').empty().load(pURL, null, pCallback);
    $('#actionSubmit').css("display", "none");
    $('#dynamicModalWindow').jqm({ "toTop": true }).jqmShow();
} //end function

function ShowLinkToReportInModal() {
    $('#dynamicModalContent').empty().html('<div id=\'dynamicWindowMenu\'><div id=\'dynamicWindowMenuText\'>Copy and paste this address in order to link directly to this site:</div></div><div class=\'reportLinkBox\'><input class=\'reportLinkText\' type=\'text\' readonly=\'readonly\' value=\'' + $.trim($("#reportLink").html()) + '\'></div>');
    $('#actionSubmit').css("display", "none");
    $('.reportLinkText').click(function() { this.focus(); this.select(); });
    $('#dynamicModalWindow').jqm({ "toTop": true }).jqmShow();
} //end function

function HideDynamicModal() {
    $('#dynamicModalWindow').jqm({ "toTop": true }).jqmHide();
} //end function

function HideDynamicModalExport(url) {
    HideDynamicModal();
    window.location = url;
}
function HideDynamicModalExportNewWindow(url){
    HideDynamicModal();
    window.open(url);
}

function IsLoadingWindowVisible() {
    return $('#dynamicModalWindow').css('display') == 'block';
}

function ShowLoadingWindow(msg) {
    HideDynamicModal();
    if (msg === null)
        msg = "Loading...";
    $('#dynamicModalContent').empty().html('<div class="loadingResults"><p><img src="/common/images/loading/loadingOnGreen.gif" width="62px" height="13px" /></p><p class="infoMessage">' + msg + '</p><p class="additionalMessage"></p></div>');
    $('#dynamicModalWindow').jqm({ "toTop": true }).jqmShow();
    $('#actionSubmit').css("display", "none");

    return function(pMsg, pAdditionalMessage) {
        var $myInfoMessage = $("#dynamicModalContent .infoMessage");
        var $myAdditionalMessage = $("#dynamicModalContent .additionalMessage");

        if (pMsg !== null) {
            $myInfoMessage.html(pMsg);
        }
        if (pAdditionalMessage !== null) {
            $myAdditionalMessage.html(pAdditionalMessage);
        }

    };
}

function ShowLoadingWindowUntilFalse(pMessage, pFunctionToEval) {
    //if not showing, show
    if ($(".jqmOverlay").length <= 0) {
        ShowLoadingWindow(pMessage);
    }
    //Evaluate function, if false, Hide the modal
    if (!pFunctionToEval()) {
        HideDynamicModal();
    }
    else {
        //Check again in 3 seconds
        setTimeout(function() { ShowLoadingWindowUntilFalse(pMessage, pFunctionToEval); }, 3000);
    }
}

var _resultsPosition = 0;
var _resultsSlidingContainerWidth = 0;

function ResetContentItemHolder() {
    var $contentItemHolder = $("#ContentItemHolder");
    _resultsSlidingContainerWidth = 0;
    $contentItemHolder.css("left", "0px");
    $contentItemHolder.css("width", "100%");
    $contentItemHolder.removeClass(".results");
} //end function

function SetContentItemHolderWidth(pWidth) {
    _resultsSlidingContainerWidth = pWidth;
    $("#ContentItemHolder").css("width", pWidth + "px");
} //end function
function SetContentItemHolderLeft(pLeft) {
    _resultsPosition = pLeft;
    $("#ContentItemHolder").css("left", -pLeft + "px");
} //end function

function SetContentItemContainerForReports() {
    $.event.remove(this, "resize", onWindowResizeDelegate); //remove window resize handler so we dont accidently trip it in IE
    $("#ContentItemContainer").css({ height: "100%" });
    $("#ContentItemHolder").css("position", "static");
    $(".contentStats").css("display", "none");
    $("#backNavigation").css("display", "block");
    $.event.add(this, "resize", onWindowResizeDelegate); //restore the handler

} //end function
function SetContentItemContainerForResults() {
    $.event.remove(this, "resize", onWindowResizeDelegate); //remove window resize handler so we dont accidently trip it in IE
    var myOrientation = _SSR._Trackers[_SSR._CurrentViewType].ResultOrientation;
    //$("#ContentItemContainer").css({ height: myOrientation == "vertical" ? GISP_PROPERTY_HEIGHT + "px" : "100%" });
    $("#ContentItemHolder").css("position", "relative");
    $(".contentStats").css("display", "block");
    $("#backNavigation").css("display", "none");
    $.event.add(this, "resize", onWindowResizeDelegate); //restore the handler
}
function PanContent(pDirection) {
    log.info("PanContent(" + pDirection + ")");
    if (_SSR._CurrentViewClass == "RESULTS") {
        PanResults(pDirection);
    } else {
        PanResult(pDirection);
    } //end if/else type
} //end function

function PanResult(pDirection) {
    var myType = _SSR._CurrentViewType;
    var myTracker = _SSR._Trackers[myType];
    _SSR.ClearCurrentReportOverlays(); //cfurrow - test to remove radius from business reports on pan left or right
    var myIndex = myTracker.CurrentIndex + pDirection;
    if (myIndex < 0) {
        myIndex = myTracker.Count - 1;
    }
    if (myIndex == myTracker.Count) {
        myIndex = 0;
    }

    LoadResultByIndex(myIndex, myType);

} //end function

function PanResults(pDirection) {
    var myType = _SSR._CurrentViewType;
    var myTracker = _SSR._Trackers[myType];
    var myBaseMoveAmount = GISP_PROPERTY_WIDTH * CalcCurrentPageSizeBasedOnClientWidth();
    var myMoveAmount = myBaseMoveAmount * pDirection;
    var myViewPortWidth = GetClientWidth() - GISP_PROPERTY_CONTAINER_MARGIN;

    //Hide the buttons until the action is completed
    $("#contentNav .back").css("display", "none");
    $("#contentNav .next").css("display", "none");

    //stop from clicking the left button when at the begining
    if ((pDirection == -1) && (myMoveAmount + _resultsPosition < 0)) {
        myBaseMoveAmount = _resultsPosition;
    }
    //stop from cliking the right button when at the end
    if ((pDirection == 1) && (myMoveAmount + _resultsPosition) >= _resultsSlidingContainerWidth) {
        myBaseMoveAmount = 0;
    }

    //adjust the current page

    myTracker.SlideDirection = pDirection;


    //if viewing horizontally, set base moveamount to zero....
    if (myTracker.ResultOrientation == "horizontal") {
        myBaseMoveAmount = 0;
    } //end if horizontal results

    //animate the movement (or just show skip if horizontal)
    if (myTracker.ResultOrientation == "vertical") {
        $("#ContentItemHolder").animate({ "left": (pDirection == 1 ? "-=" : "+=") + myBaseMoveAmount + "px" },
        "slow", "easeOutElastic", function() {
            _resultsPosition += myBaseMoveAmount * pDirection;

            var myNewTempIndex = myTracker.CurrentIndex + myTracker.PageSize * pDirection;
            if (myNewTempIndex >= 0 && myNewTempIndex < myTracker.Count) {
                myTracker.CurrentIndex += myTracker.PageSize * pDirection;
                setTimeout(ManagePropertyResults, 200);
            } //end if not at the ends
        });
    } else {
        SkipResults(_SSR._GetCurrentPage(myType) + pDirection);
    } //end if/else vertical
} //end function


function LockNavigationBoundaries(pTracker) {

    if (_SSR._CurrentViewClass == "RESULTS") {

        if (pTracker.CurrentIndex < pTracker.PageSize)
            $("#contentNav .back").css("display", "none");
        else
            $("#contentNav .back").css("display", "block");

        if (pTracker.CurrentIndex >= pTracker.Count - pTracker.PageSize)
            $("#contentNav .next").css("display", "none");
        else
            $("#contentNav .next").css("display", "block");
    }
    else if (_SSR._CurrentViewClass == "REPORT") {

        if (pTracker.CurrentIndex === 0)
            $("#contentNav .back").css("display", "none");
        else
            $("#contentNav .back").css("display", "block");

        if ((pTracker.CurrentIndex == pTracker.Count - 1) || (pTracker.Count === 0))
            $("#contentNav .next").css("display", "none");
        else
            $("#contentNav .next").css("display", "block");

    }
    else {
        $("#contentNav .back").css("display", "block");
        $("#contentNav .next").css("display", "block");
    }

}

function SkipResults(pPage) {
    //adjust the current page
    var myType = _SSR._CurrentViewType;
    var myTracker = _SSR._Trackers[myType];
    myTracker.SlideDirection = 0;
    var myNewTempIndex = pPage * myTracker.PageSize;
    myTracker.CurrentIndex = myNewTempIndex;


    ResetContentItemHolder();
    if (myTracker.ResultOrientation == "vertical") {
        var myWidth = GISP_PROPERTY_WIDTH * GISP_PROPERTY_PAGE_BUFFER * myTracker.PageSize;
        SetContentItemHolderWidth(myWidth);

        //set the slider
        var myLeft = GISP_PROPERTY_WIDTH * CalcCurrentPageSizeBasedOnClientWidth();
        if (pPage === 0) {
            myLeft = 0;
        } //end if start page
        if (pPage == myTracker.NumPages - 1) {
            //In order to determine how far to move the slder, we need to know how many results are in the div
            var mySliderInfo = CalcSliderInfo();
            myLeft = GISP_PROPERTY_WIDTH * (mySliderInfo.FirstViewable - mySliderInfo.FirstQueable);
        } //end if last page
        SetContentItemHolderLeft(myLeft);
    } //end if vertical


    setTimeout(ManagePropertyResults, 300);
} //end function

function onWindowResizeDelegate() {
    //basically deals with resize problems in IE
    if (_windowResizeTimer) {
        clearTimeout(_windowResizeTimer);
    }
    _windowResizeTimer = setTimeout(onWindowResize, 200);
}
function onWindowResize() {
    var IsWidthResize = $(window).width() != _windowWidth;
    if (_SSR._CurrentViewClass == "RESULTS" && IsWidthResize) {
        _windowWidth = $(window).width(); //new global ref
        var myType = _SSR._CurrentViewType;
        var myTracker = _SSR._Trackers[myType];
        if (myTracker.ResultOrientation == "vertical") {
            var myCurrentPageSize = CalcCurrentPageSizeBasedOnClientWidth();
            _SSR._SetPageSize(myCurrentPageSize, myType);
            var myNewPage = _SSR._GetCurrentPage(myType);
            SkipResults(myNewPage);
        } //end if vertical
    } //end if viewing results

    //set the position of the search button and geo list
    if (IsWidthResize) {
        SetSearchButtonsRightPosition();
        PositionCurrentGeoList();
    }

    ResizeLegend();

} //end function

function SetSearchButtonsRightPosition() {
    var myWindowWidth = $(window).width();
    //Search window is 920 px and buttons should hang by 50 pixels
    var theSearchWindow = $("#search-window");
    var myRightPos = (myWindowWidth - theSearchWindow.width()) / 2;
    theSearchWindow.find("#searchButton").css("right", myRightPos + "px");
    theSearchWindow.find("#closeSearch").css("right", myRightPos + 18 + "px");
}

function ResetSearch() {
    ResetClientSearch();
} //end function

function SwitchMapType(pWhatType) {
    _mapBar.SetMapType(pWhatType); //pass off control to the mapBar
} //end function

function LoadContentMenu(pMenuType) {
    var $headerMenu = $("#contentHeaderMenu");
    var $footerMenu =$("#contentFooterMenu");
    var hoverSelector = [];
    var subHoverSelector = [];
    var $this = null;
    var menuContent = "";

    // Load the content
    menuContent =  $("#"+pMenuType).html();
    $headerMenu.empty().html(menuContent);
    $footerMenu.empty().html(menuContent);

    FixIE7IndexingContainer($("#contentHeaderMenu"));

    hoverSelector.push(".building_detail .ContentToolsItem");
    hoverSelector.push(".buildingsSaved .ContentToolsItem");
    hoverSelector.push(".buildingsResults .ContentToolsItem");
    hoverSelector.push(".businessResults .ContentToolsItem");
    hoverSelector.push(".businessesSaved .ContentToolsItem");
    hoverSelector.push(".communitiesDetail .ContentToolsItem");
    hoverSelector.push(".communityResults .ContentToolsItem");
    hoverSelector.push(".communitiesSaved .ContentToolsItem");
    hoverSelector.push(".points_detail .ContentToolsItem");
    hoverSelector.push(".reportsSaved .ContentToolsItem");
    hoverSelector.push(".site_detail .ContentToolsItem");
    hoverSelector.push(".siteResults .ContentToolsItem");
    hoverSelector.push(".sitesSaved .ContentToolsItem");

    subHoverSelector.push(".businessesSaved .contentBoxHeader_menu");
    subHoverSelector.push(".buildingsSaved .contentBoxHeader_menu");
    subHoverSelector.push(".communitiesSaved .contentBoxHeader_menu");
    subHoverSelector.push(".reportsSaved .contentBoxHeader_menu");
    subHoverSelector.push(".siteResults .contentBoxHeader_menu");
    subHoverSelector.push(".sitesSaved .contentBoxHeader_menu");

    if(/_DETAIL/i.test(pMenuType)){
      ChangeSavePropertyText(); // call this on Buildings_Detail, and PointsDetail, and SitesDetail
    }

    //set up all mouseover states for this menu
    $(hoverSelector.join(','),"#contentBox").unbind('hover').hover(
        function() {
          $this = $(this);
          $this.find("ul:first").show();
          $this.attr("id", "ContentToolCurrent");
        },
        function() {
          $this = $(this);
          $this.find("ul:first").hide();
          $this.attr("id", "");
        }
    );

    //set up all mouseover states for items that open up
    $(subHoverSelector.join(","),"#contentBox").unbind("hover").hover(
        function() {
          $this = $(this);
          $this.find("ul:first").show();
          $this.addClass("contentBoxHeader_menu_current");
        },
        function() {
          $this = $(this);
          $this.find("ul:first").hide();
          $this.removeClass("contentBoxHeader_menu_current");
        }
    );
} //end LoadContentMenu() function


function LoadStyleSheet(pWhatSheet) {
    var $currentReportCSS = $("link[id$=cssCurrentReport]");
    switch (pWhatSheet) {
        case "FULL_PROPERTY_REPORT":
            //$currentReportCSS.attr("href", "/common/styles/Reports_PropertyDetails" + _scriptType + ".css?V=" + _AssemblyVersion);
            break;
        case "DEMOGRAPHIC_REPORT":
            //$currentReportCSS.attr("href", "/common/styles/Reports_Demographics" + _scriptType + ".css?V=" + _AssemblyVersion);
            break;
        case "BUSINESS_REPORT":
            //$currentReportCSS.attr("href", "/common/styles/Reports_Business" + _scriptType + ".css?V=" + _AssemblyVersion);
            break;
        case "REPORT_NULL":
            //$currentReportCSS.attr("href", "");
            break;
        default:break;
    } //end switch
} //end function


function InitializePromptInputs(pDOMElement) {
    //set up the prompt checkboxesHO
    $(".promptInput", pDOMElement).each(
    function() {
        var myPrompt = $(this).attr("prompt");
        $(this).val(myPrompt);
    }
    ).bind("focus",
        function() {
            var myVal = $(this).val();
            var myPrompt = $(this).attr("prompt");
            if (myVal == myPrompt) {
                $(this).val("");
            }
        }
    ).bind("blur",
        function() {
            var myVal = $(this).val();
            var myPrompt = $(this).attr("prompt");
            if (myVal === "") {
                $(this).val(myPrompt);
            }
        }
    );
} //end function



function DisplayCommunitySearch() {
    ShowCommunitySearch();
}

function DisplayMemberDirectoryWhenLoaded() {
    setTimeout(DisplayMemberDirectory, 1000); //extra delay is required
} //end function

function DisplayMemberDirectory() {
    ShowMembersDirectory();
} //end function

function CreateCookie(name, value, days) {
    var expires = "";
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = "; expires=" + date.toGMTString();
    }
    else {
      expires = "";
    }
    document.cookie = name + "=" + value + expires + "; path=/";
}

function ReadCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' '){ c = c.substring(1, c.length);}
        if (c.indexOf(nameEQ) === 0) {return c.substring(nameEQ.length, c.length);}
    }
    return null;
}

function EraseCookie(name) {
    CreateCookie(name, "", -1);
}

function LogAccessStatistic(pSites, pAccessType) {
    $.ajax({
        url: "/common/services/Utilities.asmx/LogAccessStatistic",
        async: true,
        data: "{'pSites': '" + pSites.join(',') + "', 'pAccessType': '" + pAccessType + "', 'pClientAddress': '" + _ClientAddress + "', 'pReferrer': '" + _ReferrerUrl + "'}",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        type: "POST",
        cache: false,
        error: function(XMLHttpRequest, textStatus, errorThrown) { /*error logging stat*/ }
    });
}
function SendDocumentHeight(){
  var D = document;
  try{
    var height = $("body").height();
    if(top){
      // Get current height of page
      log.info("SendingDocumentHeight(): "+height);
      top.postMessage("height_"+height,"*");
    }
  }
  catch(error){}
}

