  
      // Names of the divs that are referenced in the CSS
      var BgOverlayDivId = 'dr_modalOverlay'; 
      var IframeOverlayDivId = 'dr_modalOverlayWrapper';
      var IframeTopLineDivId = 'dr_modalOverlayHeader';
      var IframeTopLineLinkDivId = 'dr_modalOverlayHeaderLink';
      var IframeId = 'dr_modalOverlayIframe';
      var IFrameLoadIcon = 'dr_modalOverlayLoadIcon';
      var ProductFinderNav = 'dr_ProductFinder';
      
      var TagAttributeName = 'modalOverlay';
      var DelaySeconds = 1;
      
      // Externally-referenced CSS
      var IframeOverlayCssUrl = '//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/multimedia/css/pt_PT/product-overlay.css';
      
      /******************************************************************************
      * 
      * This segment of code is only triggered by browsers that can support the 
      * 'getElementById' method. The individual components of overlay are attached
      * to the page via the DOM.
      *
      *****************************************************************************/  
      
      if (document.getElementById) {
        // Initialize variables
        var BodyElement = (document.documentElement) ? document.documentElement : document.body;
      
         // Pre-Load Overlay Images
         var IframeOverlayBG = document.createElement('img');
        var IframeOverlayBG2 = document.createElement('img');
        var IFrameLoadIconBAR = document.createElement('img');
        var IFrameLoadIconBG = document.createElement('img');  
        var IFrameLoadIconBG2 = document.createElement('img');      
      
        IframeOverlayBG.setAttribute('src','//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/overlayBG.png');
        IframeOverlayBG2.setAttribute('src','//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/overlayBG2.png');
        IFrameLoadIconBAR.setAttribute('src','//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/loadingAnimation.gif');  
        IFrameLoadIconBG.setAttribute('src','//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/loadingBG.png');    
        IFrameLoadIconBG2.setAttribute('src','//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/loadingBG.gif');    
      
        // Initialize Overlay Framework      
        document.writeln('<link rel="stylesheet" type="text/css" href="' + IframeOverlayCssUrl + '"/>');
        document.writeln('<div id="' + BgOverlayDivId + '"></div>');
        document.writeln('<div id="' + IFrameLoadIcon + '"><p><strong>A carregar...</strong></p><img src="//drh.img.digitalriver.com/DRHM/Storefront/Site/eaemea/cm/images/pt_PT/EAv1/loadingAnimation.gif" width="208" height="13" /></div>');
        document.writeln('<div id="' + IframeOverlayDivId + '"><div id="' + IframeTopLineDivId + '"><div id="' + IframeTopLineLinkDivId + '"><a href="#" onclick="closeIframeOverlay();return false;">Cancelar</a></div></div></div>');
      }  
      
      /******************************************************************************
      * iFrameOverlay()
      * 
      * The "iFrameOverlay" function creates the iframe element attaching severl 
      * attributes including "id" and "src" and is then appended to the primary 
      * ovelay div 'IframeOverlayDivId'
      *
      *****************************************************************************/  
      
      function iFrameOverlay(clickedLink) {
         
        var IframeElement = document.createElement('iframe');
        IframeElement.setAttribute('frameBorder', '0');
        IframeElement.setAttribute('src', clickedLink);
        IframeElement.setAttribute('id', IframeId);
        
        if (document.getElementById(IframeOverlayDivId).lastChild.tagName == 'IFRAME') document.getElementById(IframeOverlayDivId).replaceChild(IframeElement, document.getElementById(IframeOverlayDivId).lastChild);
        else document.getElementById(IframeOverlayDivId).appendChild(IframeElement);
        showIframeOverlay();
        return false;
      }
      
      /******************************************************************************
      * showIframeOverlay()
      * 
      * The "showIframeOverlay" function primary use is to set the various ovelay 
      * components to visible and displayable. 
      *
      *****************************************************************************/  
      function showIframeOverlay() {
        hideAllSelectLists(true);
        //flashPlayerRemote('pause');
      
        with (document.getElementById(BgOverlayDivId).style) {
          display = 'block';
          visibility = 'visible';
        }
        loadIframeIcon(true);
        with (document.getElementById(IframeOverlayDivId)) {
          style.display = 'block';
          style.visibility = 'visible';
        }
      }
      
      /******************************************************************************
      * closeIframeOverlay()
      * 
      * The "closeIframeOverlay" function closes the ovelay and all relavent 
      * elements, divs and iframe.
      *
      *****************************************************************************/  
      
      function closeIframeOverlay() {
        with (document.getElementById(BgOverlayDivId).style) {
          display = 'none';
          visibility = 'hidden';
        }
        with (document.getElementById(IframeOverlayDivId)) {
          style.display = 'none';
          style.visibility = 'hidden';
        }
        with (document.getElementById(IframeId)) {
          style.display = 'none';
        }
        hideAllSelectLists(false);
        //flashPlayerRemote('play');
      }
      
      /******************************************************************************
      * closeIframe()
      * 
      * The "closeIframe" function closes the iframe window, however it leaves the 
      * ovelay gradient open.  Used in conjunction with "loadIframeIcon" when loading
      * selected values
      *
      *****************************************************************************/  
      
      function closeIframe() {
        with (document.getElementById(IframeOverlayDivId)) {
          style.display = 'none';
          style.visibility = 'hidden';
        }
        with (document.getElementById(IframeId)) {
          style.display = 'none';
        }
      }
      
      /******************************************************************************
      * loadIframeIcon()
      * 
      * The "loadIframeIcon" function appends the loading icon onto the primary
      * overlay div and then triggers the function "showIframe" on a predefined time 
      * delay
      *
      *****************************************************************************/  
      
      function loadIframeIcon(active) {
        if (active) {
          with (document.getElementById(IFrameLoadIcon)) {
            style.display = 'block';
          }  
        } else {
          with (document.getElementById(IFrameLoadIcon)) {
            style.display = 'none';
          }  
        }  
      } 
        
      /******************************************************************************
      * (hideAllSelectLists)
      * 
      * The "hideAllSelectLists" function is an IE bug that hides all select lists 
      * when the overlay background is showing
      *
      *****************************************************************************/  
      
      function hideAllSelectLists(HideSelect) {
        if (navigator.appName == 'Microsoft Internet Explorer') {
         var SelectList = document.getElementsByTagName('select');
         for (var j=0;j<SelectList.length;j++) SelectList[j].style.visibility = (HideSelect) ? 'hidden' : 'visible';
        }
      }