﻿//This is a respository for commonly used JavaScript functions, add new functions as needed


function queryString(key) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == key) {
            return ft[1];
        }
    }
}

function RadioButtonValue(RBGroupName) {
    var retVal = '';
    for (i = document.getElementsByName(RBGroupName).length - 1; i > -1; i--) {
        if (document.getElementsByName(RBGroupName)[i].checked) {
            retVal = document.getElementsByName(RBGroupName)[i].value;
            i = -1;
        }
    }
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}
