function gEC(oElm, strTagName, strClassName){
 var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
 var arrReturnElements = new Array();
 strClassName = strClassName.replace(/-/g, "\-");
 var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
 var oElement;
 for(var i in arrElements){
  oElement = arrElements[i];
  if(oRegExp.test(oElement.className)){
   arrReturnElements.push(oElement);
  }
 }
 return (arrReturnElements)
}


//following function checks all the checkboxes on the page wrapped in a div with id = "id" and the checkbox that you will check for checking all boxes will have id = "toggle"


function SelectAll(id, toggle) {
 this.inputs = null;
 if(document.getElementById(id)) {
  this.inputs = document.getElementById(id).getElementsByTagName("input");
 }
 
 if(document.getElementById(toggle)) {
  document.getElementById(toggle).onclick =function (instance) {
    return function() {
      for(i= 0; i<instance.inputs.length;i++) {
       if(this.type == "checkbox") {
          instance.inputs[i].checked = this.checked;
       }
      }
    }
  }(this);
 }

 
}
