
<!-- show block of fields -->
function show(id, disabledBoolean, theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    showObject(theDocument.getElementById(id),disabledBoolean);

    switch (id)
    {
      case "med-results":
        window.searchType = "ZSTVX";
        break;
      case "pharma-results":
        window.searchType = "MAVP";
        break;
    }
}

function showObject(object,disabledBoolean)
{
    if (object != null)
    {
      object.style.visibility="visible";
      object.style.display="block";
      object.disabled=disabledBoolean;
    }
}

<!-- hide block of fields -->
function hide(id, theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    hideObject(theDocument.getElementById(id));
}
function hideObject(object)
{
    if (object != null)
    {
      object.style.visibility="hidden";
      object.style.display="none";
    }
}

function doSearch(formName,firstRecord,searchType,sendSDC)
{
    try
    {
        if ((searchType == null) || (searchType == 'undefined'))
        {
            var x = document.getElementById('searchType');
            if ((x == null) || (x == 'undefined') || (0 == x.value.length))
            {
                searchType = "ZSTVX";
            }
            else
            {
                searchType = x.value;
            }
        }

        var theForm = this.document.getElementById(formName);

        if ((null == firstRecord) || ('undefined' == firstRecord) || (0 == firstRecord))
        {
            theForm.start.value=0;
        }
        else
        {
            firstRecord += eval(theForm.start.value);
            theForm.start.value = firstRecord;
        }
        theForm.searchType.value = searchType;
        //sjl 9/24/09: removed
        //if(sendSDC)
        //   sdcTagSearch(theForm);

        var ele = document.getElementById('search-result');
        hideObject(ele);
        ele = document.getElementById('progress');
        showObject(ele);


        theForm.submit();
    }
//    catch(e){}
    catch(e){alert('error:'+e.description);}
}

function goToPrinterFriendly(formName,resultSize,searchType)
{
    var thisForm = this.document.getElementById(formName);
    var url      = thisForm.action;
    url         += '?searchBy='   + thisForm.searchBy.value;
    url         += '&start='      + thisForm.start.value;
    url         += '&searchType=' + searchType;
    url         += '&resultSize=' + resultSize;
    url         += '&forward=printerFriendly';

    try
    {
        url += '&zipCode=' + thisForm.zipCode.value;
        try
        {
            url += '&distance=' + thisForm.distance.value;
        }
        catch (e)
        {
            url += '&distance=10';
        }
    }
    catch (e) {}

    var w=window.open(url,'PRINT_RESULTS_PAGE','menubar=yes, scrollbars=yes, resizable=yes,width=750, height=650, left=100, top=20');

    try
    {
        w.focus();
    }
    catch(e){}

}

function goToEmailPage(formName,resultSize,searchType)
{
    var thisForm = this.document.getElementById(formName);

    var url      = '/pdc/email/start.do';
    url         += '?searchBy='   + thisForm.searchBy.value;
    url         += '&start='      + thisForm.start.value;
    url         += '&searchType=' + searchType
    url         += '&resultSize=' + resultSize
    url         += '&fnc=results';

    try
    {
        url += '&zipCode=' + thisForm.zipCode.value;
        try
        {
            url += '&distance=' + thisForm.distance.value;
        }
        catch (e)
        {
            url += '&distance=10';
        }
    }
    catch (e) {}

    var w=window.open(url,'EMAIL_RESULTS_PAGE','scrollbars=no, resizable=no,width=530, height=440, left=200, top=25');

    try
    {
        w.focus();
    }
    catch(e){}
}

function GetMap(address)
{
    // replace all spaces with plus signs
    var addr = address.replace(/ /g,'+');
    var url="http://maps.google.com/?q="+addr;

    openExternalWin("zostavax", url);
    tagOffsiteLink("maps.google.com", "Get Map");
}

function setImageActiveStatus(tab,listSize,theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    try
    {
        if ((listSize == null) || (listSize == undefined) || (listSize == 0))
        {
            hideObject(theDocument.getElementById("med-printer-email-links"));
            hideObject(theDocument.getElementById("pharma-printer-email-links"));
            hideObject(theDocument.getElementById("link-print"));  // Print link in right nav
        }
    }
    catch(e){}
//    catch(e){alert('error:'+e.description);}
}

function setZipCode(zip,theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    try
    {
        var control = theDocument.getElementById('zipCode');
        if ((zip == null) || (zip == 'undefined'))
        {
            control.value='';
        }
        else
        {
            control.value=zip;
        }
    }
    catch(e){}
//    catch(e){alert('error:'+e.description);}
}

function setDistance(dist,theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    try
    {
        var control = theDocument.getElementById('distance');
        if ((dist != null) && (dist != 'undefined'))
        {
            var values = control.options;
            for(var i=0; i < values.length;i++)
            {
                if (values[i].value == dist)
                {
                    control.selectedIndex=i;
                    break;
                }
            }
        }
    }
    catch(e){}
//    catch(e){alert('error:'+e.description);}
}

function setStartValue(startValue,theDocument)
{
    if ((theDocument == null) || (theDocument == 'undefined'))
    {
        theDocument = this.document;
    }
    try
    {
        var control = theDocument.getElementById('start');
        if ((startValue == null) || (startValue == 'undefined'))
        {
            control.value='0';
        }
        else
        {
            control.value=startValue;
        }
    }
    catch(e){}
//    catch(e){alert('error:'+e.description);}
}

/**********************************
 SDC Tagging for Searches
 **********************************/
function sdcTagSearch(theForm)
{
   try
   {
      var eventName;

      // tag by provider type
      eventName = "Search-" + (theForm.searchType.value=="MAVP" ? "Pharmacy" : "Practice");
      tagEvent(eventName);

      // tag by geographical region
      eventName = "Search-Geo-" + theForm.zipCode.value.substr(0,3);
      tagEvent(eventName);
   }
   catch(e) {}

   return true;
}

function sdcTagNotFound()
{
   try
   {
      var theForm = document.forms["medSearch"];
      var eventName;

      // tag by provider type
      eventName = "Not-Found-" + (theForm.searchType.value=="MAVP" ? "Pharmacy" : "Practice") + "-" + theForm.zipCode.value.substr(0,3);
      tagEvent(eventName);
   }
   catch(e) {}
   return true;
}


/* wrapper for pre-submit of the Provider Search form */
function onSubmitProviderSearch(theForm)
{
   var test = isGlobalValidUSZip(theForm.zipCode.value);

   if (test == false)
   {
      alert("Provide a ZIP code as 5 digits");
      try {theForm.zipCode.focus();} catch(e){}
   }

   //sjl 9/24/09: removed
   //if (test == true)
   //   sdcTagSearch(theForm);

   return test;
}

function pageLoad(pharmacyTabActive)
{
    window.location.hash="navigation";

    var ele = document.getElementById('progress');
    hideObject(ele);

    var ie6Browser = ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined));

    try
    {   // Adjust first header column

        var headerColumn = document.getElementById('header-col1');
        if (ie6Browser)
            headerColumn.style.paddingLeft = "8px";

        var resultColumn = document.getElementById('results-col1');
        if (ie6Browser)
            headerColumn.width=parseInt(resultColumn.offsetWidth+2);
        else
            headerColumn.width=parseInt(resultColumn.offsetWidth);

        // Adjust third header column
        /*headerColumn2 = document.getElementById('header-col2');
        headerColumn  = document.getElementById('header-col3');
        resultColumn  = document.getElementById('results-col2');
        if (ie6Browser)
            headerColumn.width=parseInt(resultColumn.offsetWidth-headerColumn2.offsetWidth-10);
        else
            headerColumn.width=parseInt(resultColumn.offsetWidth-headerColumn2.offsetWidth-5);
		*/
        // Adjust fourth header column
        if (pharmacyTabActive)
        {
            headerColumn = document.getElementById('header-col4');
            headerColumn.style.display="none";
        }
    }
    catch(e){}
}

function openStatusExplain()
{
    var ele = document.getElementById('status-explain');
    ele.style.display="block";
}

function closeStatusExplain()
{
    var ele = document.getElementById('status-explain');
    ele.style.display="none";
}

function leaveWebsite()
{
    ans=window.confirm('The link you have selected will take you to a Web site outside of,  and not affiliated with,  Merck & Co, Inc. This link is provided for your convenience only.\n\nMerck does not review or control the content of any non-Merck site. Merck does not endorse and is not responsible for the accuracy, content, practices, or standards of any non-Merck site.');
    return ans;
}

function closeDisclaimer()
{
    $.cookie('disclaimer.shown', 'true');
    var ele = document.getElementById('hcp-popup');
    ele.style.display="none";
    ele = document.getElementById('disclaimer-popup');
    ele.style.display="none";
    ele = document.getElementById('overlayDisclaimer');
    ele.style.display="none";
}

