

function selectCategory(categoryCode, oCheckBox)
{
    var bln = oCheckBox.checked;
    var checkboxes = document.getElementsByTagName("input");
    var size = checkboxes.length;
    for (var i = 0; i < size; i++)
    {
        var checkboxElement = checkboxes[i];
        if (checkboxElement.type == "checkbox")
        {
           var cc = checkboxElement.parentNode.getAttribute("cc");
           if (cc != undefined && cc != null && cc == categoryCode) 
           {
             var optionDiv = checkboxElement.parentNode.parentNode;
              if(optionDiv != null)
              {
                  if(oCheckBox.checked)
                  {                         
                    optionDiv.style.display = 'block';
                  }
                  else
                  {
                    optionDiv.style.display = 'none';                  
                  }             
            
              }  
              
           }
        
        }
    }
}

function checkBusinessAccount(element)
{
    if (element.checked)
    {
        document.getElementById("geacbirthdayvalidation").style.display = "none";
    }
    else
    {
        document.getElementById("geacbirthdayvalidation").style.display = "block";
    }
}

function changeGeacNumber(element)
{
    var newGeac = element.value;
    if (newGeac != "")
    {
        if (isNaN(newGeac))
        {
            alert("Giant Eagle Advantage Card must be a number");
            element.value = "";
            return;
        }

        if (newGeac.length != 12)
        {
            alert("Giant Eagle Advantage Card must be 12 digits long.  You can find this number on the back of the card.  It starts with a number 4.");
            return;
        }

        if (newGeac.substring(0, 1) != "4")
        {
            alert("Giant Eagle Advantage Card must start with a number 4.");
            return;
        }

        // document.getElementById("geacconfirmationsection").style.display = "block";
    }
    //else
    //{
        // document.getElementById("geacconfirmationsection").style.display = "none";
    //}   
}

function displayGeacSection(element)
{

  var node = element;
  var spanTags = document.getElementsByTagName("span");
  for(i=0;i<spanTags.length;i++)
  {
     if(spanTags[i].getAttribute("geacsection")!= null)
     {
       var geacSectionElementId =  spanTags[i].id;
     } 
     
 }
  
    if(element.checked)
    {
      document.getElementById(geacSectionElementId).style.display = "none";       
    }
    else
    {      
       document.getElementById(geacSectionElementId).style.display = "inline";
    }

}

function DisplayGeacSection(obj)
{  
    var spanTags = document.getElementsByTagName("span");
    for(i=0;i<spanTags.length;i++)
    {
        if(spanTags[i].getAttribute("geacsection")!= null)
        {
           var geacSectionElement =  spanTags[i];
        }    
    } 
    var geacSectionTable = geacSectionElement.firstChild;
    if(geacSectionTable.style.display != "inline")
    {
      document.getElementById(geacSectionTable.id).style.display = "inline";  
    }  
}
