
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
                         
                
            

                myGlossaryTerms = new Array("allowable\ charge","annual\ deductible","annual\ out\-of\-pocket","claim\ form","claim","COBRA","coinsurance","copayment","covered\ person","covered\ service","deductible","effective\ date","exclusions","family\ coverage","generic\ substitute","group\ ","individual\ coverage","individual\ lifetime\ maximum","in\-network\ ","maximum\ allowance","out\-of\-network\ ","prescription\ drugs","provider\ ");
myGlossaryBlurbs = new Array("The\ maximum\ amount\ a\ healthplan\ will\ reimburse\ a\ doctor\ or\ hospital\ for\ a\ given\ service\.","The\ amount\ of\ eligible\ expenses\ you\ are\ required\ to\ pay\ annually\ before\ reimbursement\ by\ your\ healthplan\ begins\.","The\ maximum\ amount\,\ per\ year\,\ you\ are\ required\ to\ pay\ out\ of\ your\ own\ pocket\ for\ covered\ health\ care\ services\.","A\ form\ generally\ filled\ out\ by\ a\ provider\ and\ submitted\ to\ your\ healthplan\ for\ consideration\ of\ payment\ of\ benefits\ under\ that\ healthplan\.","An\ itemized\ bill\ for\ services\ that\ have\ been\ provided\ to\ a\ subscriber\,\ a\ subscriber\'s\ spouse\ or\ dependents\.","The\ Consolidated\ Omnibus\ Budget\ Reconciliation\ Act\ of\ 1985\.","A\ percentage\ of\ an\ eligible\ expense\ that\ you\ are\ required\ to\ pay\ for\ a\ service\ covered\ by\ your\ healthplan\.","A\ fixed\ dollar\ amount\ you\ are\ required\ to\ pay\ for\ a\ covered\ service\ at\ the\ time\ you\ receive\ care\.","The\ person\ in\ whose\ name\ a\ health\ care\ policy\ is\ issued\ and\,\ in\ the\ case\ of\ family\ coverage\,\ the\ member\'s\/subscriber\'s\ dependents\.","A\ service\ that\ is\ covered\ according\ to\ the\ terms\ in\ your\ health\ care\ policy\.","A\ fixed\ amount\ of\ the\ eligible\ expenses\ you\ are\ required\ to\ pay\ before\ reimbursement\ by\ your\ healthplan\ begins\.","The\ date\ on\ which\ your\ health\ care\ coverage\ begins\.","Specific\ medical\ conditions\ or\ circumstances\ that\ are\ not\ covered\ under\ a\ health\ plan\.","Health\ care\ coverage\ for\ a\ member\/subscriber\ and\ his\/her\ eligible\ dependents\.","A\ prescription\ drug\ that\ is\ the\ generic\ equivalent\ of\ a\ drug\ listed\ on\ your\ health\ plan\'s\ formulary\.","A\ group\ of\ people\ covered\ under\ the\ same\ health\ care\ policy\ and\ identified\ by\ their\ relation\ to\ the\ same\ employer\.","Health\ care\ coverage\ for\ a\ member\,\ but\ not\ the\ member\'s\ spouse\ and\/or\ dependents\.","The\ maximum\ amount\ of\ benefits\ your\ policy\ will\ pay\ over\ the\ course\ of\ your\ lifetime\.","Covered\ services\ provided\ or\ ordered\ by\ your\ primary\ care\ physician\ \(PCP\)\ or\ another\ network\ provider\ referred\ by\ your\ PCP\.","A\ fixed\ amount\ that\ providers\ agree\ to\ accept\ as\ payment\ in\ full\ for\ a\ particular\ covered\ service\.","ervices\ not\ provided\,\ ordered\ or\ referred\ by\ your\ primary\ care\ physician\ \(PCP\)\.","Drugs\ and\ medications\ that\,\ by\ law\,\ must\ be\ dispensed\ by\ a\ written\ prescription\ from\ a\ licensed\ doctor\.","A\ licensed\ health\ care\ facility\,\ program\,\ agency\,\ doctor\ or\ health\ professional\ that\ delivers\ 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;

