// IE will stop playing an animated GIF if a server trip is triggered from within the page
// displaying the animated GIF.  Showing/hiding the hotel map will cause such a server trip,
// thereby halting the animation of the property image.
// This function locates the property image and then resets it's "src" attribute, effectively
// reloading the image and restarting the animation.
function reloadPropertyImage() {
    var propImage = document.getElementById('map');
    if (propImage) {
        propImage.setAttribute("src", propImage.getAttribute("src"));
    }
}
    
/** Row Highlighting functions **/
function highlightSupplierRow(row) {
    if (row.className.indexOf('wothotelhover') == -1) {
        if (row.className.indexOf('wothotel') != -1) {
            row.className = row.className.replace(' wothotel', ' wothotelhover');
        }
        else {
            row.className = row.className + ' hover';
        }
    }
}

function unhighlightSupplierRow(row) {
    if (row.className.indexOf('wothotelhover') != -1) {
        row.className = row.className.replace(' wothotelhover', ' wothotel');
    }
    else {
        row.className = row.className.replace(' hover', '');
    }
}

function switchToView(viewType) {
    document.viewForm.viewType.value = viewType;
    document.viewForm.startDay.value = getUrlParameter('startDay');
    document.viewForm.submit();
}

function createQueryString(theForm, ignoreParams) {
    var result = document.location.pathname;
    var first = true;
    var inputs = theForm.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        if (!ignoreParams || ignoreParams.indexOf(inputs[i].name) < 0) {
            if (first) {
                result += "?";
                first = false
            } else {
                result += "&";
            }
            result += inputs[i].name + "=" + inputs[i].value;
        }
    }
    return result;
}

function togglePolicyTextVisibility(divId) {
    var element = document.getElementById(divId);
    if (element.className != '') {
        element.className = '';
        document.getElementById(divId + "ButtonDown").className = 'policyTextButtonImageHidden';
        document.getElementById(divId + "ButtonUp").className = 'policyTextButtonImage';
    } else {
        element.className = 'policyTextHidden';
        document.getElementById(divId + "ButtonDown").className = 'policyTextButtonImage';
        document.getElementById(divId + "ButtonUp").className = 'policyTextButtonImageHidden';
    }
}
