﻿// JScript File

var host = window.location.host;

if(window.location.href.indexOf('https') >= 0)
{
    host = 'https://' + host;
}
else 
{
    host = 'http://' + host;
}
    
var selectedOnColor = "#FFFFFF";
var selectedOffColor = "#BDBCBC";
var selectedBenefit = 0;

// Remembers the previous selected benefit item
var previousSelectedBenefitItem = null;

function benefitsSwap(hrefLink, imageLocation, image, textObject, text)
{
    try
    {        
        if(hrefLink != null)
        {
            // Deselect the previous Benefits item
            if(previousSelectedBenefitItem != null)
                deselectPreviousItem();
                
            previousSelectedBenefitItem = hrefLink;
            hrefLink.style.color = selectedOnColor;
           
            // Sets the benefits image
            if(imageLocation != null)            
                document.getElementById(imageLocation).src = host + image;            
                
            if(textObject != null)
            {
                if (navigator.appName == 'Netscape')
                {                    
                    document.getElementById(textObject).textContent = text;
                }
                else
                    document.getElementById(textObject).innerText = text;
            }
        }
        //event.returnValue=false;                
        return false;
    }
    catch(err)
    {
      txt="There was an error on this page.\n\n"
      txt+="Error description: " + err.description + "\n\n"
      txt+="Click OK to continue.\n\n"
      alert(txt)
    }
}

function deselectPreviousItem()
{
    previousSelectedBenefitItem.style.color = "";
    previousSelectedBenefitItem.className = "listItem";
}