﻿
function GotoTravelTipResult(traveltipurl, origin, period, maxPrice, form) {
    var query = traveltipurl + '?D_City=' + origin + '&Period=' + period + '&MaxPrice=' + maxPrice + '&DestinationGroup=' + getCheckedValue(document.forms[form].elements['DestinationGroup']);
        window.location.href = query;
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
    if (!radioObj)
        return "";
    var radioLength = radioObj.length;
    if (radioLength == undefined)
        if (radioObj.checked)
        return radioObj.value;
    else
        return "";
    for (var i = 0; i < radioLength; i++) {
        if (radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";
}
