﻿/*
 Name            :       emailsubscriptions.js
 Purpose         :       Handles JS for email subscription user control and related subscription managment pages
 Author          :       Kevin
 Date            :       4/29/10
 */
//----------------------------------------------------------------------------------------------------------------------------

/*
 Name            :       selectAll 
 Purpose         :       Selects all check boxes in the exact-target user control
 Author          :       Kevin
 Date            :       4/29/10
 */
function selectAll() {    
    var collection = document.getElementById("ctl00_ContentPlaceHolder1_ucET_divCheckBoxes").getElementsByTagName('INPUT');
    for (var count=0; count<collection.length; count++) {
        if (collection[count].type.toUpperCase()=='CHECKBOX')
            collection[count].checked = true;
    }
}

function unselectAll() {    
    var collection = document.getElementById("ctl00_ContentPlaceHolder1_ucET_divCheckBoxes").getElementsByTagName('INPUT');
    for (var count=0; count<collection.length; count++) {
        if (collection[count].type.toUpperCase()=='CHECKBOX')
            collection[count].checked = false;
    }
}


function checkForAll() {
    var allChecked = true;
    var collection = document.getElementById("ctl00_ContentPlaceHolder1_ucET_divCheckBoxes").getElementsByTagName('INPUT');
    for (var count=0; count<collection.length; count++) {
        if (collection[count].type.toUpperCase()=='CHECKBOX') {
            if(collection[count].checked != true){
                allChecked = false;
                //alert("not checked!");
            }
        }
    }
    
    if(allChecked) {
        document.getElementById("cbxCheckAll").checked = true;
    } else {
        document.getElementById("cbxCheckAll").checked = false;
    }
    
}


