function SwapPlaylist(strPlaylist) {
    var oPlayer = document.getElementById("frmPlayer");
    frmPlayer.location = "player.aspx?xmlPath=" + strPlaylist;
    return false;
}
function ShowHide(oDiv) {
    oDiv = document.getElementById(oDiv);
    if (oDiv.style.display == "inline")
        oDiv.style.display = "none";
    else
        oDiv.style.display = "inline";
}
function ValidateText(oObject, strAlert) {
    oObject = document.getElementById(oObject);
    if (oObject != null && trim(oObject.value) == "") {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    return true;
}
function ValidateNumber(oObject, strAlert) {
    oObject = document.getElementById(oObject);
    if (oObject != null && trim(oObject.value) == "") {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    if (oObject != null && isNumber(oObject.value) == false) {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    return true;
}
function ValidateDropDown(oObject, strAlert) {
    oObject = document.getElementById(oObject);
    if (oObject != null && oObject.selectedIndex == 0) {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    return true;
}
function ValidateDate(oObject, strAlert) {
    oObject = document.getElementById(oObject);
    if (oObject != null && trim(oObject.value) == "") {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    if (oObject != null && isDate(oObject.value) == false) {
        alert(strAlert);
        SetFocus(oObject);
        return false;
    }
    return true;
}
function ValidateRadioButtons(oObject1, oObject2, strAlert) {
    oObject1 = document.getElementById(oObject1);
    if (oObject1.checked == true)
        return true;
    else {
        oObject2 = document.getElementById(oObject2);
        if (oObject2.checked == true)
            return true;
        else {
            alert(strAlert);
            SetFocus(oObject1);
            return false;
        }
    }
    return true;
}
function trim(str) {
    str = str.replace(/^\s+/g, "");
    str = str.replace(/\s+$/g, "");
    return str;
}
function isNumber(str) {
    var ValidChars = "0123456789.";
    var Char;
    for (ii = 0; ii < str.length; ii++) {
        Char = str.charAt(ii);
        if (ValidChars.indexOf(Char) == -1)
            return false;
    }
    if (str.length == 0)
        return false;
    return true;
}
function isDate(dateStr) {
    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
    var matchArray = dateStr.match(datePat);
    if (matchArray == null) {
        alert("Please enter date in one of the following formats:\nmm/dd/yy, mm/dd/yyyy, mm-dd-yyyy, or mm-dd-yyyy.");
        return false;
    }
    month = matchArray[1];
    day = matchArray[3];
    year = matchArray[5];
    if (month < 1 || month > 12) {
        alert("Month must be between 1 and 12.");
        return false;
    }
    if (day < 1 || day > 31) {
        alert("Day must be between 1 and 31.");
        return false;
    }
    if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
        alert("Month " + month + " doesn't have 31 days!")
        return false;
    }
    if (month == 2) {
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day > 29 || (day == 29 && !isleap)) {
            alert("February " + year + " doesn't have " + day + " days!");
            return false;
        }
    }
    return true;
}
function SetFocus(oObject) {
    try {
        oObject.focus();
    }
    catch (ex) {
    }
}