
function resumeBrowse(browseUrl)
{
  location.href = _geApplicationRoot + browseUrl;
}

function Continue(exitId)
{
    document.getElementById(exitId).value = true;
}
function ConfirmDelete()
{
    var name = document.getElementById("BabyDetails_ctl02_Name");
   var deleteChild = confirm("Are you sure you want to delete child " + "'" + name.innerText + "'" + " from the Baby Rewards program?");
      
}
function UserExpecting()
{
    var hospitalTag = document.getElementById("HospitalTag");
    var hospitalName = document.getElementById("HospitalName");
    var EmailSpecialOffers = document.getElementById("EmailSpecialOffers");
    var expecting = document.getElementById("Expecting_Yes");
   if(expecting.checked)
   {
        hospitalTag.style.visibility = "visible";
        hospitalTag.style.display = "inline";
        hospitalName.style.visibility = "visible";
        hospitalName.style.display = "inline";
        EmailSpecialOffers.checked = true;
    }
    else
    {
        hospitalTag.style.visibility = "hidden";
        hospitalTag.style.display = "none";
        hospitalName.style.visibility = "hidden";
        hospitalName.style.display = "none";
        EmailSpecialOffers.checked = false;
    }
}

function Hide()
{
var td = document.getElementById('BenifitsData');
var image = document.getElementById('ToggleArrow');

  if(td.style.display=='none')
   {
   image.src = "/InternetSites/Images/Users/TActiveRcp.gif";
    td.style.display='block';
   }
   else
   {
    td.style.display='none';
    image.src = "/InternetSites/Images/Users/Up.gif";
   }
}

function HidePerm()
{
   var td = document.getElementById('BenifitsData');  
   td.style.display='none';  
  
}

//opens a popup window to display help information, when blue question mark image is clicked 
function OpenHelpWindow()
{
    helpWindow = window.open(_geApplicationRoot + "/FAQ/Faqs.aspx","Help", "width=300,height=300");
    helpWindow.moveTo(0,0);
}

//display the birthday and month drop downs
/*function showValidationSection(id)
{
    document.getElementById(id).style.display = "inline";
}*/

//selects the options nested below when the category checkbox is selected
function SelectOptionCategory(CategoryCheckBox)
{    
    var CategoryOptionsContainer = document.getElementById(CategoryCheckBox.getAttribute("ChildOptionContainerId"));
    for(i=0 ; i < CategoryOptionsContainer.childNodes.length ; i++)
	{
	     if(CategoryOptionsContainer.childNodes[i].tagName == "INPUT")
	     {
	        CategoryOptionsContainer.childNodes[i].checked = true;
	     }
	}
}

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 aoi = checkboxElement.parentNode.getAttribute("aoi");
            if (aoi != undefined && aoi != null && aoi == categoryCode)
            {
                var rowDiv =  checkboxElement.parentNode.parentNode;
                var checkboxText = undefined;
                var rowDivText = undefined;
                if(document.all)
                {
                 rowDivText = rowDiv.innerText.toLowerCase().trim();
                 checkboxText = oCheckBox.parentNode.innerText.toLowerCase().trim();
                }
                else 
                {
                    rowDivText = rowDiv.textContent.toLowerCase().trim();
                 checkboxText = oCheckBox.parentNode.textContent.toLowerCase().trim();
                }
                if(checkboxText == rowDivText)
                {
                    rowDiv.style.display = "none";
                    checkboxElement.checked = bln;
                }
                
            }
        }
    }
    
    var containerElement = document.getElementById("c" + categoryCode);
    if (bln)
    {
        containerElement.style.display = "inline";
    }
    else
    {
        containerElement.style.display = "none";
    }
}

function showGeacRequired(element)
{
    if (element.value != "")
    {
        document.getElementById("GeacValidationSection").style.display = "inline";
    }
    else
    {
        document.getElementById("GeacValidationSection").style.display = "none";
    }
}

function displayBirthDateDiv(element)
{
    if(element.checked)
    {
        document.getElementById("BirthDateCheckDiv").style.display = "none";
       
    }
    else
    {      
       document.getElementById("BirthDateCheckDiv").style.display = "inline";
    }

}

function setDisclaimerFields(element)
{   
    var urlAttribute = element.getAttribute("urltext"); 
    
    if(element.checked)
    {
        showFieldAsRequired("StreetAddress1");
        showFieldAsRequired("Phone");
        showFieldAsRequired("City");
        showFieldAsRequired("StateCode");
        
        if(urlAttribute == "baby")
        {
            showFieldAsRequired("GEACNumber");
            showFieldAsRequired("BirthMonth");
            showFieldAsRequired("Birthday");
        }
    }
    else
    {
        showFieldAsBlank("StreetAddress1");
        showFieldAsBlank("Phone");
        showFieldAsBlank("City");
        showFieldAsBlank("StateCode");
        
        if(urlAttribute == "baby")
        {
            showFieldAsBlank("GEACNumber");
            showFieldAsBlank("BirthMonth");
            showFieldAsBlank("Birthday");
        }
    }
}

