
function closePopup() {
    jQuery.unblockUI();
}

$(function() {
    $("a.popup").click(function() {
        //winpops=window.open($(this).attr('href'),'Tylenol','width=780,height=400,status=0,scrollbars=1,resizable=0');
        //return false;
    });

    //make all external links open in a new window (page 57)
    jQuery("a[href^=http]").attr("target","_blank");

    //make all links to PDFs open a new window (p23 and 57)
    jQuery("a[href$=.pdf]").attr("target","_blank");
    jQuery("a[href$=.PDF]").attr("target","_blank");
    jQuery("a[href$=.doc]").attr("target","_blank");
    jQuery("a[href$=.DOC]").attr("target","_blank");
      
    //make all links to PDFs and DOCs call Google Analytics (also requires 4 lines of code above, which open new window, to function properly)
    jQuery("a[href$=.pdf]").attr("onClick","javascript: pageTracker._trackPageview(jQuery(this).attr('href'));");
    jQuery("a[href$=.PDF]").attr("onClick","javascript: pageTracker._trackPageview(jQuery(this).attr('href'));");
    jQuery("a[href$=.doc]").attr("onClick","javascript: pageTracker._trackPageview(jQuery(this).attr('href'));");
    jQuery("a[href$=.DOC]").attr("onClick","javascript: pageTracker._trackPageview(jQuery(this).attr('href'));");

    //Exit Disclaimer
      jQuery("a[href^=http]").click(function() {
          var href=jQuery(this).attr("href");
          if (href != null && href.indexOf('tylenol.com') == -1 && href.indexOf('tylenolprofessional') == -1 && href.indexOf('atdmt.com') == -1 && href.indexOf('mcneilproductrecall.com') == -1) {
              jQuery.blockUI({ 
              message: "<div class=\"exitPopup\"><p>Thank you for visiting TylenolProfessional.com</p><p>By clicking 'Continue', you will be taken to:<br /><b>" + href + "</b></p><p>This is a Web site to which our Privacy Policy does not apply. You are solely responsible for your interactions with such Web sites.</p><p><a href=\"" + href + "\" target=\"_blank\" onclick=\"closePopup();\">Continue</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"javascript:closePopup();\">Cancel</a></p></div>",
              
              css: {  
                width:          '590px', 
                padding:        '10px', 
                margin:         0,   
                color:          '#333', 
                textAlign:      'left', 
                border:         '1px solid #999', 
                backgroundColor:'#fff', 
                cursor:         'wait' 
              }, 
              
              // styles for the overlay 
              overlayCSS:  {  
                backgroundColor:'#000',  
                opacity:        '0.1'  
              }
                });
              return false;
          }
      });

      jQuery("#license\\.region").removeOption('PR');
      jQuery("#address\\.region").removeOption('PR');
      
      /** TP-98 summers order form **/
      jQuery(".closewindow").click(function() {
          jQuery(".full-details").fadeOut();
          return false;
      });
        
});

/** TP-98 summers order form **/
function toggleDetails(id) {
    jQuery(".full-details:not('#'" + id + ")").hide();
    jQuery('#' + id).toggle();
    return false;
}