function cropText(id, amount) {
    var x = document.getElementById(id).value;
    if (x.length > amount) {
        x = x.substring(0, amount);
    }
    document.getElementById(id).value = x;
}

function toggleHiddenDiv(id) {
    try {
        if (document.getElementById(id).style.display == "none") {
            document.getElementById(id).style.display = "block";
        } else {
            document.getElementById(id).style.display = "none";
        }
    } catch (e) {
        alert(e);
    }
}

function isEmptyString(x) {
    var result = true;
    for (count = 0; count < x.length; count++) {
        if (x.charAt(count) != ' ') {result = false; break;}
    }
    return result;
}

function isValidString(x) {
    return ((x.length > 0) && !isEmptyString(x));
}

function doPopUp(width, height, url) {
    var day = new Date();
    var id = day.getTime();
    var xpos = (screen.width / 2) - (width / 2);
    var ypos = (screen.height / 2) - (height / 2);
    eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left = " + xpos + ",top = " + ypos + "');");
}



function testBrowser_isOldIE() {
    var ua = navigator.userAgent.toLowerCase();
    return ((ua.indexOf("msie 7") != -1) || (ua.indexOf("msie 6") != -1) || (ua.indexOf("msie 5") != -1) || (ua.indexOf("msie 4") != -1));
}

function testBrowser_isMobile() {
    return (screen.width < 700);
}

