
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
            

                myGlossaryTerms = new Array("calendar\ year\ maximum\ ","claim","claim\ form","coinsurance","copayment","covered\ service","deductible","exclusions","family\ coverage","generic\ drug","generic\ substitute","group\ ","individual\ coverage","individual\ lifetime\ maximum","in\-network\ ","maximum\ allowance","maximum\ annual\ benefit\ ","Medicare","member","out\-of\-network\ ","out\-of\-pocket\ maximum\ ","pre\-existing\ condition","prescription\ drugs","provider\ ");
myGlossaryBlurbs = new Array("A\ form\ you\ may\ have\ to\ fill\ out\ and\ submit\ to\ your\ health\ insurance\ carrier\ for\ payment\ of\ benefits\ under\ that\ health\ care\ plan\.","An\ itemized\ bill\ for\ services\ that\ have\ been\ provided\ to\ a\ subscriber\,\ a\ subscriber\'s\ spouse\ or\ dependents\.","A\ form\ you\ may\ have\ to\ fill\ out\ and\ submit\ to\ your\ health\ insurance\ carrier\ for\ payment\ of\ benefits\ under\ that\ health\ care\ plan\.","A\ percentage\ of\ a\ covered\ charge\ that\ you\ are\ required\ to\ pay\ toward\ a\ service\ covered\ by\ your\ plan\.\ Not\ all\ plans\ require\ coinsurance\.","A\ fixed\ dollar\ amount\ you\ are\ required\ to\ pay\ for\ a\ service\ at\ the\ time\ you\ receive\ care\.\ Not\ all\ plans\ require\ copayments\.","A\ service\ that\ is\ covered\ by\ your\ health\ care\ plan\.\ ","A\ fixed\ amount\ of\ the\ eligible\ expenses\ you\ are\ required\ to\ pay\ before\ reimbursement\ by\ your\ health\ plan\ begins\.","Specific\ medical\ conditions\,\ procedures\ or\ circumstances\ that\ are\ not\ covered\ under\ a\ health\ care\ plan\.","Health\ care\ coverage\ for\ a\ member\ and\ his\ or\ her\ eligible\ dependents\.","A\ prescription\ drug\ that\ is\ the\ generic\ equivalent\ of\ a\ brand\-name\ drug\ listed\ on\ your\ health\ plan\'s\ drug\ list\ \(formulary\)\.\ ","A\ prescription\ drug\ which\ is\ the\ generic\ equivalent\ of\ a\ drug\ listed\ on\ your\ health\ plans\ formulary\.","A\ group\ of\ people\ covered\ under\ the\ same\ health\ care\ plan\ and\ identified\ by\ their\ relation\ to\ the\ same\ employer\.","Health\ care\ coverage\ purchased\ by\ a\ person\ for\ him\/herself\ that\ may\ include\ coverage\ for\ dependent\(s\)\.","The\ maximum\ amount\ of\ benefits\ your\ plan\ will\ pay\ over\ the\ course\ of\ your\ lifetime\.","Covered\ services\ provided\ or\ ordered\ by\ your\ primary\ care\ physician\ \(PCP\)\ or\ another\ provider\ referred\ by\ a\ your\ primary\ care\ physician\.","A\ fixed\ amount\ that\ doctors\ and\ hospitals\ agree\ to\ accept\ as\ payment\ in\ full\ for\ a\ particular\ covered\ service\.","The\ maximum\ dollar\ amount\ your\ health\ care\ plan\ will\ pay\ for\ all\ health\ care\ services\ provided\ to\ you\ during\ one\ year\.","The\ federal\ program\ established\ to\ provide\ health\ care\ coverage\ for\ eligible\ senior\ citizens\.\ ","Any\ individual\ who\ receives\ health\ care\ coverage\ from\ Blue\ Cross\ and\ Blue\ Shield\ of\ New\ Mexico\.\ ","Services\ not\ provided\ or\ ordered\ by\ your\ primary\ care\ physician\ \(PCP\)\ or\ upon\ referral\ of\ your\ primary\ care\ physician\.","The\ maximum\ amount\ you\ have\ to\ pay\ for\ most\ or\ all\ expenses\ covered\ under\ your\ health\ care\ plan\ during\ a\ defined\ benefit\ period\.","A\ health\ condition\ for\ which\ an\ individual\ received\ medical\ care\ during\ the\ time\ prior\ to\ his\/her\ effective\ date\ of\ coverage\.","Drugs\ and\ medications\ that\,\ by\ law\,\ must\ be\ dispensed\ by\ a\ written\ prescription\ from\ a\ licensed\ doctor\.","A\ duly\ licensed\ hospital\,\ program\,\ doctor\ or\ other\ medical\ professional\ or\ facility\ authorized\ to\ deliver\ health\ care\ services\.");




function markText(inputHtml)
{
    var matchedFlag = 0;
    var re;                      /*regex object*/
    var varMatches;                  /*matches array*/
    var outHtml;                     /*output html*/
    var replaceText;
    var replaceDiv="";
    var beenReplaced;
    var usedTerms = [];
    
    re=new RegExp('(\<[^>][^<]*\>)([^<]*)','g'); /*create non-greedy regex match*/
    outHtml=new String('');              /*init html string*/
       
    while ((varMatches = re.exec(inputHtml)) != null)        /*exec sequentially to apply span tags*/
    {
        outHtml+=varMatches[1];    /*html tag part*/
        matchHold = varMatches[1].toUpperCase();
        matchHold2 = varMatches[2];
        
        var matchA = matchHold.indexOf("<A");
        var matchH1 = matchHold.indexOf("<H1>");
        var matchH2 = matchHold.indexOf("<H2>");
        var matchH3 = matchHold.indexOf("<H3>");
        var matchH4 = matchHold.indexOf("<H4>");
        if (matchedFlag == 1){
            outHtml+=matchHold2;
        }else{
            if (matchA == 0 ||matchH1 == 0 || matchH2 == 0|| matchH3 == 0|| matchH4 == 0){
               outHtml+=matchHold2;
            }else{
                var termCount=0;
                for (termCount=0;termCount<myGlossaryTerms.length;termCount++){
                    txtKeyword = myGlossaryTerms[termCount];
                    var usedTermsStr = usedTerms.toString();
                    var matchPattern = usedTermsStr.indexOf(txtKeyword);
                    if(usedTermsStr.indexOf(txtKeyword) == -1){
                        beenReplaced = replaceMe(matchHold2, txtKeyword, termCount);
                        if (beenReplaced != matchHold2){
                            matchedFlag = 1;
                            matchHold2 = beenReplaced;
                            blurb = myGlossaryBlurbs[termCount];
                            replaceDiv += '<div  id="def'+termCount+'" class="definition"><br/>';
                            replaceDiv += '<div class="definition_content">';
                            replaceDiv += '<p><b>'+txtKeyword+'</b><br />'+blurb+'</p></div><div class="definition_bottom">&nbsp;</div></div>';
                            usedTerms[usedTerms.length]= txtKeyword;   
                        }
                    }
                }
                outHtml+=matchHold2;
                matchedFlag = 0;
            }
        }
    }
    outHtml+=replaceDiv;
    return outHtml;
}

function getLayerHtml()
{
    var inHtml = new String('');
    if (document.getElementById)
    {
        x = document.getElementsByTagName('div');
        for(i=0;i<x.length;i++)
        {
            xclass = x[i].className;
            if(xclass == "content" || xclass == "contentbox"){
                inHtml = x[i].innerHTML;
            }
        }
    }
    else
     if (document.all)
    {
        x = document.all[id];
        xclass = x.className;
        inHtml = x.innerHTML;
    }
    return inHtml;
}

function setLayerHtml(text)
{
    if (document.getElementById)
    {
        elemObj = document.getElementsByTagName('div');
        for(i=0;i<elemObj.length;i++)
        {
            xclass = elemObj[i].className;
            if(xclass == "content" || xclass == "contentbox"){
                elemObj[i].innerHTML = text ;
            }
        }
        }else if (document.all)
        {
        elemObj = document.all[id];
        elemObj.innerHTML = text;
        }
  }


function replaceMe(str, txtKeyword, termCount) {
    var pattern = new RegExp('\\b'+txtKeyword+'(?=[ \\W])' ,'i');
    var matches = str.match(pattern);
    if (matches){
        var indexmatch = str.indexOf(txtKeyword);
        var strmatch = "-"+txtKeyword;
        if(str.match(strmatch)){
            return str;
        }else{
            matches = matches[0];
            replaceText = '<a href="../../../../getting_started/health_insurance/glossary.html#'+matches+'" class="glossary" onMouseOver="toggleDiv(\'def'+termCount+'\',1);UpdateCursorPositionDocAll(this);" onMouseOut="toggleDiv(\'def'+termCount+'\',0)">'+matches+' <img src="/images/question.gif" border="0" alt="'+matches+'" /></a>';      
            return str.replace( pattern, replaceText);
        }
    }else{
        return str;
    }
}

function startGlossary(){
    var inHtml = getLayerHtml();       
    var outHtml = markText(inHtml);
//    alert(outHtml);
    setLayerHtml(outHtml);
}

var glossaryOn=true;

