//glossary script
//this variable holds the currently displayed div 
    //so that it can be set to display:none when a new letter is clicked.
    var lastLetterDiv;
    var lastLetterLink;
    function showHideLetter(divID)
    {
        var glossary_div = $get("content_glossary")
        var glossary_default = $get("glossary_default");
        if(glossary_default.style.display!="none")
        {
            $get("content_glossary_terms").style.display="block";
            $get("glossary_default").style.display="none";
        }
        
        //find the link control so it can be hilighted in some fashion
        var linkID = divID.substr(0,divID.lastIndexOf('_'))+'_question';
        
        if(lastLetterDiv == null)
        {
         lastLetterDiv = divID;
         lastLetterLink = linkID;
         document.getElementById(divID).style.display = 'block';
         document.getElementById(linkID).style.color="#f7a901";
         document.getElementById(linkID).style.fontWeight = 'bolder';
        }
        else
        {
         document.getElementById(lastLetterDiv).style.display = 'none';
         document.getElementById(divID).style.display = 'block';
         
         document.getElementById(linkID).style.color="#f7a901";
         document.getElementById(lastLetterLink).style.color="#ffffff";
         document.getElementById(lastLetterLink).style.fontWeight = "normal";
         document.getElementById(linkID).style.fontWeight = 'bolder';

         //document.getElementById(lastLetterClicked).style.color = '#1EA090';
         //document.getElementById(link).style.color = '#E19935';

         lastLetterDiv = divID;
         lastLetterLink = linkID;
         //lastLetterClicked = link;
        }
    }
//end of glossary script

var currentButton;
//handle nav mouseovers
function nav_mouseover(image)
{
    if(image!=currentButton)
    {
        var start=image.src.lastIndexOf('.');
        image.src = image.src.substr(0,start) + '_mouseover.jpg';
    }
        
}
function nav_mouseout(image)
{
    if(image!=currentButton)
    {
        var start= image.src.lastIndexOf('_');
        image.src = image.src.substr(0,start) + '.jpg';
    }
    
}

function changeButton(id)
{
    currentButton = document.getElementById(id);
    var start=currentButton.src.lastIndexOf('.');
    currentButton.src = currentButton.src.substr(0,start) + '_mouseover.jpg';
}
//handle sub nav mouseovers
function sub_nav_mouseover(image, current)
{
    image = $get(image);
    var start=image.src.lastIndexOf('.');
    image.src = image.src.substr(0,start) + '_' + current + '.gif';
}

function sub_nav_mouseout(image)
{
    image = $get(image);
    var start=image.src.lastIndexOf('_');
    image.src = image.src.substr(0,start) + '.gif';
}

//handle the products navigation 
var currentlyActiveProductCategory;
var preserveNavigation;

function navigatetoproduct(link)
{
    //set a cookie with category and line.
    var expirationDate = new Date();
    expirationDate.setDate(expirationDate.getDate() + 1);
    document.cookie = "category"+ "="+ escape(currentlyActiveProductCategory)+ 
    ";expires="+ expirationDate.toGMTString();
    document.cookie = "productLine"+ "="+ escape(link.parentNode.parentNode.id)+ 
    ";expires="+ expirationDate.toGMTString();
    document.cookie = "linkID"+ "="+ escape(link.id)+ 
    ";expires="+ expirationDate.toGMTString();
 
}

function displayNavigation()
{
    var category = getCookie('category');
    showCategory(category);
    hilightLink(getCookie('linkID'));
    showProductLine(getCookie('productLine'));

}

function hilightLink(id)
{
    var link = $get(id);
    link.style.color='#c0aeeb';
    link.style.fontWeight='bold';
}

function productmouseover(id)
{
    id.className="product_hover";
}
function productmouseout(id)
{
    id.className = "product_nonhover";
}
function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        { 
            c_start=c_start + c_name.length+1; 
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
                return unescape(document.cookie.substring(c_start,c_end));
        } 
    }
    return "";
}

function showCategory(id)
{
    if(currentlyActiveProductCategory == id)
    {
        var divToHide = $get(id);
        var arrowImage = $get(id+"_arrow");
        arrowImage.src = arrowImage.src.substr(0,arrowImage.src.lastIndexOf('/')) + '/arrow_purple_large.jpg';
        divToHide.style.display='none';
        
        currentlyActiveProductCategory = undefined;
    }
    else
    {
        if(currentlyActiveProductCategory != undefined)
        {
            var divToHide = $get(currentlyActiveProductCategory);
            divToHide.style.display='none';
            var arrowImage = $get(currentlyActiveProductCategory+"_arrow");
            arrowImage.src = arrowImage.src.substr(0,arrowImage.src.lastIndexOf('/')) + '/arrow_purple_large.jpg';
        }
        var divToShow=$get(id);
        divToShow.style.display='block';
        
        var arrowImage = $get(id+"_arrow");
                
        arrowImage.src = arrowImage.src.substr(0,arrowImage.src.lastIndexOf('/')) + '/arrow_purple_down.jpg';
        currentlyActiveProductCategory = id;
    }
}

function showProductLine(id)
{
    var divToShow = $get(id);
    if(divToShow.style.display=='block')
    {
        divToShow.style.display='none';
    }
    else
    {
        divToShow.style.display='block';
    }
}
//end of products navigation js


var currentlyActiveTool;
function showtool(id)
{
    if(currentlyActiveTool == id)
    {
        var divToHide = $get(id);
        divToHide.style.display = 'none';
        currentlyActiveTool = undefined;
    }
    else
    {
        if(currentlyActiveTool != undefined)
        {
            var divToHide = $get(currentlyActiveTool);
            divToHide.style.display = 'none';
        }
        var divToShow = $get(id);
        divToShow.style.display = 'block';
        currentlyActiveTool = id;
    }
}

//function to show and hide the divs
function showHideDiv(thediv)
{
    if (document.getElementById(thediv).style.display=='')
    {
        document.getElementById(thediv).style.display = 'none';
    }
    if (document.getElementById(thediv).style.display=='none')
    {
        document.getElementById(thediv).style.display = 'block';
    }
    else
    {
        document.getElementById(thediv).style.display = 'none';
    }
}

// WARN ON LEAVE CODE
function warn_on_leave(site) 
  {
     var msg = "\nLinks which take you out of Abbott Laboratories worldwide \n"+
     "web site are not under the control of Abbott Laboratories, \n"+
     "and Abbott Laboratories is not responsible for the contents \n"+
     "of any such site or any further links from such site. Abbott \n"+
     "Laboratories is providing these links to you only as a \n"+
     "convenience, and the inclusion of any link does not imply \n"+
     "endorsement of the linked site by Abbott Laboratories.\n\n"+
     "Do you wish to leave this site?";
     if (confirm(msg)) 
     {
        window.open(site);
     } else
     {
        return;
     }
  }
 
//Javascript for Registration
function ShowHideFreeSampleAttributes()
{
    var rbl = document.getElementsByName("ctl00$ContentPlaceholderMain$registration$rblEasFreeSample");
    var div = document.getElementById("EasFreeSample");
    
    if (rbl[0].checked)
    {
        div.style.display="block";
    }
    else
    {
        div.style.display="none";
    }
}