﻿function applyDestinationsSelectListStyles(buttonId, bottomId, middleId) {
    if (window == window.top) {
        jQuery(document).ready(function() {
            ApplyDestinationStyle(buttonId, bottomId, middleId);
        });
    }
    else {
        if (typeof (window.windowLoaded) == "undefined")
            jQuery(window).load(function() {
                window.windowLoaded = true;
                window.setTimeout(ApplyDestinationStyle, 1000, buttonId, bottomId, middleId);
            });
        else {
            ApplyDestinationStyle(buttonId, bottomId, middleId);
        }
    }
}
function ApplyDestinationStyle(buttonId, bottomId, middleId) {
    var bottom = jQuery("#" + bottomId);
    var middle = jQuery("#" + middleId);
    if (bottom.attr("disabled") != undefined) {
        jQuery(".DestinationPicker:first").css("height", "416px");
    }
    else
        if (middle.attr("disabled") != undefined) {
            jQuery(".DestinationPicker:first").css("height", "371px");
        }
        else {
            jQuery(".DestinationPicker:first").css("height", "326px");
        }
        
    jQuery(".DestinationPickerUpdateWrapper:first").css("visibility", "visible");
    var btn = jQuery("#" + buttonId);
    if (btn.attr("disabled") != undefined) {
        if (btn.attr("disabled"))
            btn.attr("src", "/Functions/DestinationPicker/Images/DestinationPickerBtnDsbld.gif");
        else
            btn.attr("src", "/Functions/DestinationPicker/Images/DestinationPickerBtn.gif");
    }
    var options = {
        maxHeight: typeof _selectListHeight != "undefined" ? _selectListHeight : 0
    };
    jQuery("div.DestinationPicker .SelectList").remove();
    jQuery('div.DestinationPicker select').selectList(options);
    var gWindow = window;
    if (gWindow != null) {
        var haveToSay = window.WhatToSay;
        if (haveToSay != null)
            alert(haveToSay);
    }
}

