﻿// Name of input controls all across the page.  We use these 'global'
// variables to simplify the naming of our Html elements
var LNK_MAP_SEARCH = "LnkBtnMapSearch";
var LNK_TEXT_SEARCH = "LnkBtnTextSearch";
var IMG_MAP_SEARCH = "ImgMapSearch";
var IMG_TEXT_SEARCH = "ImgTextSearch";
var CHK_AGREEMENT = "ChkBoxAgreement";

//------------------------------------------------
//                   enableLinks
// Function fired when the checkbox is checked.  It
// enables/disables the links to the search pages.
//------------------------------------------------
function enableLinks()
{
    // Get the checkbox used to know if the user agreed
    // to the terms of use agreement
    var checkBox = document.getElementById(CHK_AGREEMENT);

    // Get the anchors and images to activate/deactivate
    var imgFull = document.getElementById(IMG_MAP_SEARCH);
    var imgSearch = document.getElementById(IMG_TEXT_SEARCH);
    var anchorMap = document.getElementById(LNK_MAP_SEARCH);
    var anchorSearch = document.getElementById(LNK_TEXT_SEARCH);

    if (checkBox.checked)
    {
        // The check box is checked
        imgFull.src = "images/img_samaFull.png";
        imgFull.style.borderColor = "#9A5011";
        imgSearch.src = "images/img_samaSearch.png";
        imgSearch.style.borderColor = "#9A5011";

        anchorMap.style.color = "#9A5011";
        anchorMap.style.textDecoration = "underline";
        anchorSearch.style.color = "#9A5011";
        anchorSearch.style.textDecoration = "underline";

    }
    else
    {
        // The checkbox is unchecked
        imgFull.src = "images/img_samaFull_off.png";
        imgFull.style.borderColor = "#999";
        imgSearch.src = "images/img_samaSearch_off.png";
        imgSearch.style.borderColor = "#999";

        anchorMap.style.color = "#999999";
        anchorMap.style.textDecoration = "none";
        anchorSearch.style.color = "#999999";
        anchorSearch.style.textDecoration = "none";
    }
}
