﻿/*Setting the collapse\expand state of the filters.  
The function is called from each filter object but appears once in the search page*/
var filterName = ""

function SwitchStyle(imgObj, option) {
    if (imgObj.title == 'Expand') {
        //img.td.tr.tbody.table.siblingTable = children table

        document.getElementById("option_" + option).style.display = "block"

        imgObj.title = 'Collapse';
        imgObj.src = '/img/min_ps_blue.gif';

    }
    else {
        //img.td.tr.tbody.table.siblingTable = children table
        document.getElementById("option_" + option).style.display = "none"
        imgObj.title = 'Expand';
        imgObj.src = '/img/max_ps_blue.gif';
    }
}

function Hover(imgObj, imgOn) {
    var imgType = imgOn ? "_hover" : ""
    var imgSize = imgObj.title == "Expand" ? "max" : "min"

    imgObj.src = "/img/" + imgSize + "_ps_blue" + imgType + ".gif"

}

function ShowAll(option) {
    var show
    var hide

    if (all) {
        show = document.getElementById("div" + option + "_all")
        hide = document.getElementById("div" + option)
    }
    else {
        show = document.getElementById("div" + option)
        hide = document.getElementById("div" + option + "_all")
    }

    show.style.display = "block"
    hide.style.display = "none"
}

function MoreLess(option) {
    if (document.getElementById("lnkMoreLess_" + option)) {
        var elPattern = ".li_" + option + "_all"

        var text = document.getElementById("lnkMoreLess_" + option).innerHTML.substring(0, 4)

        document.getElementById("lnkMoreLess_" + option).innerHTML = text == "Less" ? "More..." : "Less..."
        $(elPattern).toggle();
    }

}

function SortPage(dd) {
    document.location.href = dd.options[dd.selectedIndex].value
}

function ChangePageSize(dd) {
    document.location.href = dd.options[dd.selectedIndex].value
}