﻿function DoAll(Action) {
    var radios = document.getElementsByTagName("input");
    for (var i = 0; i < radios.length; i++) {
        if (radios[i].type == "radio") {
            if (Action == "Subscribe") {
                if (radios[i].value == "Subscribe") { radios[i].checked = true; }
            }
            else {
                if (radios[i].value == "UnSubscribe")
                { radios[i].checked = true; }
            }
        }
    }
}

function UnCheckAll() {
    var allRadios = document.getElementsByName("All");
    for (var i = 0; i < allRadios.length; i++) {
        allRadios[i].checked = false;
    }
}

function ShowHideOtherTextBox() {
    var cbx = document.getElementById("cbxOther");
    var divOTxt = document.getElementById("divOtherText");   
    if (cbx.checked) {        
        divOTxt.style.display = "block";
    }
    else {        
        divOTxt.style.display = "none";
    }
}

function validate(frm)
{
    if (frm.cbxOther != null) {
        if (frm.cbxOther.checked) {
            var Othertext = new String(frm.txtOther.value)
            Othertext = Othertext.trim();
            if ((Othertext == "")) {
                //alert("*Sorry, we're missing information required to continue.");
                document.getElementById("errOther").style.display = "block";
                frm.txtOther.focus();
                return false;
            }
            if (Othertext.length > 250) {
                alert("Description should be less than  250 characters.");
                frm.txtOther.focus();
                return false;
            }                     
        } 
    }
}

String.prototype.trim = function() {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}




