    var aryOnImageArrays, aryOffImageArrays;
    var strLinkColor = "#0033AB";
    
    if(!strHomePage)
    {
        var strHomePage = "homepage.asp";
    }
    
    /* 
    indicateSectionAndPage([oLink])
    
    If a link object is not passed:
    Sets the indication of the current section in the top
    navigational bar and the current page in the left column 
    navigational section
    If a link object is passed:
    
    */
	
	
	
    function indicateSectionAndPage(oLink,oEvent)
    {   
        // Global variables check
        if(strLinkColor == null || strLinkColor == "")
        {
            strLinkColor = "#0033AB";
        }
        // declare and initialize variables
        var aryLinks,strHREF = "";
        var strPage = getDocumentName(document.location.href);
        
        // Determine the pertinent links
        // Determine the page link 
        aryLinks = document.getElementsByName("leftnavlink");
        for(var i=0;i < aryLinks.length; i++)
        {
            //strHREF += "A link to page '" + getDocumentName(aryLinks[i].href) + "'\n";
            if(getDocumentName(aryLinks[i].href) == getDocumentName())
            {
                // Set the link text style
                aryLinks[i].style.color = strLinkColor;
            }
            else
            {
                // Set the link text style
                aryLinks[i].style.color = "";
            }
        }
        // Determine the section link 
        aryLinks = document.getElementsByName("topnavlink");
        if(!oLink)
        {
            aryOnImageArrays = new Array(aryLinks.length);
            aryOffImageArrays = new Array(aryLinks.length);
        }
        for(var j=0;j < aryLinks.length; j++)
        {
            // Handle page initialization
            if(!oLink)
            {
                // Set the image elements per section link (2D array)
                if(aryLinks[j].getElementsByTagName("img"))
                {
                    aryOnImageArrays[j] = new Array(aryLinks[j].getElementsByTagName("img").length);
                    aryOffImageArrays[j] = new Array(aryLinks[j].getElementsByTagName("img").length);
                    
                    for(var k=0; k < aryOnImageArrays[j].length; k++)
                    {
                        if(aryLinks[j].getElementsByTagName("img")[k].src.indexOf("_off.") != -1)
                        {
                            aryOnImageArrays[j][k] = new Image();
                            aryOffImageArrays[j][k] = new Image();
                            aryOnImageArrays[j][k].src = aryLinks[j].getElementsByTagName("img")[k].src.replace("_off.","_on.")
                            aryOffImageArrays[j][k].src = aryLinks[j].getElementsByTagName("img")[k].src; 
                        } 
                    }
                }
                // Set the links' event handlers
                eval("function link_" + j + "_over(oEvent){ if (!oEvent) { var oEvent = window.event; } indicateSectionAndPage(document.getElementsByName('topnavlink')[" + j + "], oEvent); if(navigator.userAgent.indexOf('Mac') != -1 && navigator.userAgent.indexOf('MSIE') != -1){ window.resizeBy(1,1); setTimeout('window.resizeBy(-1,-1)',100); } document.getElementsByName('topnavlink')[" + j + "].onmouseover; }");
                eval("function link_" + j + "_out(oEvent){ if (!oEvent) { var oEvent = window.event; } indicateSectionAndPage(document.getElementsByName('topnavlink')[" + j + "], oEvent);  if(navigator.userAgent.indexOf('Mac') != -1 && navigator.userAgent.indexOf('MSIE') != -1){ window.resizeBy(1,1); setTimeout('window.resizeBy(-1,-1)',100); } document.getElementsByName('topnavlink')[" + j + "].onmouseout; }");
                eval("aryLinks[j].onmouseover = link_" + j + "_over");
                eval("aryLinks[j].onmouseout = link_" + j + "_out");
                
            }
            // Handle section link "mouseOver" and "mouseOut" 
            if(oLink && typeof oLink == "object" && oLink.href && aryLinks[j].getElementsByTagName("img")) 
            {
                for(var k=0; k < aryLinks[j].getElementsByTagName("img").length; k++)
                {
                    if(oLink == aryLinks[j] && oEvent.type == "mouseover")
                    {
                        aryLinks[j].getElementsByTagName("img")[k].src = aryOnImageArrays[j][k].src;
                    }
                    else
                    {
                        aryLinks[j].getElementsByTagName("img")[k].src = aryOffImageArrays[j][k].src;
                    }
                }   
            }
            // Set the section link "current section" indication
            if(getSection(aryLinks[j].href) == getSection(getDocumentName()) && getSection(aryLinks[j].href) != "")
            {
                for(k=0; k < aryLinks[j].getElementsByTagName("img").length; k++)
                {
                    aryLinks[j].getElementsByTagName("img")[k].src =  aryOnImageArrays[j][k].src;
                }
            }
        }
    }
    
    /*
    getDocumentName([sURI])
    
    Returns the document name if passed a URI, or the name of the current
    document if not passed or if the passed argument is an empty string
    */
	
	
	
	
	
    function getDocumentName(sURI)
    {
        if(sURI == null || sURI == "")sURI = self.document.location.href;
            sURI = String(sURI);
        if(sURI.indexOf("/") != -1)
            sURI = sURI.substring(sURI.lastIndexOf("/")+1,sURI.length);
            
        if (sURI.indexOf("?") != -1)
            sURI = sURI.substring(0,sURI.indexOf("?"));
            
        return sURI;
    }
    
    /*
    getSection(strDocumentLocation)
    
    Returns the organizational section of the Web site a document is in
    */
	
	
	
	
    function getSection(strDocumentLocation)
    {
      var arrSections = ["homepage","whyrest", "howrest", "whatssaid", "extrasmen", "howskinages", "registerupdate", "hcarepros","rewards"];
      var strOutput = "";
      var strFile = String(strDocumentLocation);
      var strPage = getSectionPage(strDocumentLocation);
      strDocumentLocation = String(strDocumentLocation);
      
      // get the base file name (file name minus the extension)
      if(strFile.indexOf("/") != -1)
      {
        strFile = strFile.substring(strFile.lastIndexOf("/")+1, strFile.length);
        strFile = strFile.substring(0, strFile.lastIndexOf("."));
      }
      
      // get the section name from the base file name
      if(strDocumentLocation.lastIndexOf("/") == (strDocumentLocation.length - 1))
        strOutput = arrSections[0]; // it's the homepage
      else if(strFile.indexOf("_") != -1)
        strOutput = strFile.substring(0, strFile.indexOf("_")); // get the section indicator part
      else
        for (var i=0; i<arrSections.length; i++) // determine if it's a section's main page
        {
          if (strPage == arrSections[i])
          {
              strOutput = strPage;
              break;
          }
        }

      return strOutput;
    }
    
	
	
	
	
	
    function getSectionPage(strDocumentLocation)
    {
      var strOutput = "";
      var strFile = String(strDocumentLocation);

      if(strFile.indexOf("/") != -1)
        strFile = strFile.substring(strFile.lastIndexOf("/")+1, strFile.length);
        
      if (strFile.indexOf("_") != -1)
        strOutput = strFile.substring((strFile.indexOf("_")+1), strFile.indexOf(".asp"));
      else
        strOutput = strFile.substring((strFile.lastIndexOf("/")+1), strFile.indexOf(".asp"));

      return strOutput;
    }






    var videoWin;
    function videoPopup(nVideo,strSize) 
    {
        // sanity check
        if(!nVideo)return;
        if(!strSize)strSize = "width=360, height=300";
        
        // declare and initialize variables
        var strError = "";
        var nSize = 1;
        
        // allow for Window Media Player controls' height 
        // in the height of a new window if appropriate
        if(!isNaN(nVideo))
        {
            // even numbers are .wmv files
            if(nVideo % 2 == 0)   
            {
                var nWinHeight = strSize.substring(strSize.lastIndexOf("=")+1,strSize.length)
                nWinHeight = nWinHeight.replace(/\s+$/,""); // RTrim
                nWinHeight = nWinHeight.replace(/^\s+/,""); // LTrim
                if(!isNaN(nWinHeight))
                {
                    nWinHeight = Number(nWinHeight) + 46;
                    strSize = "width=360, height=" + nWinHeight;
                    nSize = 2;
                }
            }
        }
        
        // resize an existing window's height if appropriate
        try 
        {
            if(videoWin.location.search.indexOf("sz=1") !=-1 && nSize == 2)videoWin.resizeBy(0,46);
            if(videoWin.location.search.indexOf("sz=2") !=-1 && nSize == 1)videoWin.resizeBy(0,-46);
        }
        // (catches the error that would be thrown if the window doesn't yet exist)
        catch (strError) { }
        
        window.focus();
        window.status = "";
        videoWin = window.open("video_popup.asp?sz=" + nSize + "&videoplayer=" + nVideo,"videoWin",strSize);
        videoWin.focus();
    }
    
    var pageWin;
	
	
	
	
    function pagePopup(strPage,oOpener,strSize,strScrollbars,strResize) 
    {
        if(!oOpener)oOpener = window;
        if(!strSize)strSize = "width=550, height=380";
        if(!strScrollbars)strScrollbars = "yes"
        if(!strResize)strResize = "yes";
        window.focus();
        if(typeof pageWin == "object")
        {
            if(!pageWin.closed)pageWin.close();
        }
        pageWin = window.open(strPage,"pageWin",strSize + ",scrollbars=" + strScrollbars + ",resizable=" + strResize);
        pageWin.opener = oOpener;
        pageWin.focus();
        return pageWin;
    }
    
    var oExitPopWin,oOutsideWin,oOutsideWinDelay;
	
	
	
	
    function confirmOutsideLink(oLink)
    {
        if(!oLink || oLink.tagName.toLowerCase() != "a")return false;
        eval("oOutsideWinDelay = window.setTimeout('launchOutsideLink(\"" + oLink.href + "\")',3000)");
        oExitPopWin = pagePopup('confirm_outside_link.asp',window,'width=400, height=280','no');
        return false;
    }
	
		
	
	
    function launchOutsideLink(sURL)
    {
        oOutsideWin = window.open(sURL,"_blank");
        oOutsideWin.focus();
        window.clearTimeout(oOutsideWinDelay);
    }
    
	
	
	
	
	
    function siblingPopup(strPage,oOpener,strSize,strScrollbars) 
    {
        if(!oOpener)oOpener = window.opener;
        if(!oOpener)oOpener = window;
        if(!strSize)strSize = "width=550, height=380";
        if(!strScrollbars)strScrollbars = "yes"
        window.focus();
        var tempWin = window.open(strPage,"tempWin",strSize + ",scrollbars=" + strScrollbars);
        tempWin.opener = oOpener;
        tempWin.focus();
        if(typeof pageWin == "object")
        {
            if(!pageWin.closed)pageWin.close();
        }
        pageWin = tempWin;
        pageWin.name = "pageWin";
        return pageWin;
    }
    
	
	
	
	
	
    function submitLogonForm()
    {
        var oForm = document.forms["logonform"];
            if(!oForm)oForm = document.forms["logonformIntro"];
        var resty_usr = oForm.resty_usr,resty_pwd;
        var strError = "";
        
        // handle Safari bug (replaced elements remain in collection)
        if(typeof oForm.resty_pwd[oForm.resty_pwd.length - 1] == "object")
            resty_pwd = oForm.resty_pwd[oForm.resty_pwd.length - 1]; 
        else
            resty_pwd = oForm.resty_pwd;
            
        // validate
        if((resty_usr.initialized && resty_pwd.initialized)
            && (resty_usr && resty_usr.value != "") 
            && (resty_pwd && resty_pwd.value != ""))
        {
            oForm.action = "resty_logon.asp";
            oForm.submit();
        }
        else if(document.getElementById("logonerror"))
            document.getElementById("logonerror").innerHTML = "";
    
    }
    
	
	
	
	
	
	
    function initializeInput(oInput)
    {
        if(!oInput.initialized)
        {
            oInput.value = "";
            if(oInput.id.indexOf("password") != -1 || oInput.id.indexOf("pwd") != -1)
            {
                try
                {
                    // The short way
                    oInput.type = "password";
                    if(navigator.userAgent.indexOf("Safari") != -1) 
                        throw "Safari doesn't obsure the value when input type attribute is changed to password, so create a new element instead.";
                }
                catch(strError)
                {
                    // The long way (IE doesn't like the short way)
                    if(document.createElement)
                    {
                        // Try creating a new input
                        try
                        {
                            var oNewInput = document.createElement("INPUT");
                            oNewInput.type = "password"; 
                            if(oInput.className)oNewInput.className = oInput.className;
                            if(oInput.style.width)oNewInput.style.width = oInput.style.width;
                            if(oInput.style.height)oNewInput.style.height = oInput.style.height;
                            if(oInput.size)oNewInput.size = oInput.size;
                            if(oInput.maxLength)oNewInput.maxLength = oInput.maxLength;
                            oNewInput.name = oInput.name;
                            oNewInput.id = oInput.id;
                            oNewInput.value = "";
                            if(oNewInput)
                            {
                                try
                                {
                                    oInput.form.replaceChild(oNewInput,oInput);
                                }
                                catch(strError)
                                {
                                    oInput.replaceNode(oNewInput);
                                }
                                oInput = oNewInput; 
                                oInput.focus();
                                oInput.select();
                            }
                        }
                        catch(strError)
                        {
                            //alert(strError.description);
                        }
                    }     
                } 
                // Cosmetic
                passwordBold(oInput);
            }
            //oInput.style.color = "#333333"; //alert(oInput.style.color);
            oInput.initialized = true; //alert("oInput initialized");
        }
    }
  
  
  
  
  
  
  
    function passwordBold(oInput)
    {
        if(!oInput)return;
        if(navigator.userAgent.indexOf("MSIE") == -1 
            && navigator.userAgent.indexOf("Opera") == -1 
            && navigator.userAgent.indexOf("Safari") == -1)
            oInput.style.fontSize = "150%"; 
    }
    
    function noOutline(oElement)
    {
        if(!oElement || typeof(oElement) != "object")return;
        if(oElement.hideFocus)oElement.hideFocus(true);
        window.focus();
    }
    
	
	
	
	
	
	
	
    function checkboxAsRadioButton(oBox)
    {
        if(!oBox)return;
        /*
        All checkboxes to be treated as a set must have IDs of 
        the format "groupname_n" where n is a unique number within
        the set; ergo: "myset_1", "myset_2", etc.
        */
        if(oBox.checked == true && oBox.id.indexOf("_") != -1)
        {
            var strGroup = oBox.id.substring(0,oBox.id.lastIndexOf("_")+1);
            var aryInputs = document.getElementsByTagName("INPUT");
            var aryBoxes = new Array(),oTempBox;
            // Get all the checkboxes
            for(var i = 0; i < aryInputs.length; i++)
            {
                if(aryInputs[i].type.toLowerCase() == "checkbox")
                    aryBoxes[aryBoxes.length] = aryInputs[i];
            }
            // Uncheck those that are in the same set as oBox
            for(var j = 0; j < aryBoxes.length; j++)
            {
                for(var k = 0; k < aryBoxes.length; k++)
                {
                    if(aryBoxes[j].id == strGroup + k)
                    {
                        if(aryBoxes[j] != oBox)aryBoxes[j].checked = false;
                    }
                }
            }
            if(oBox.hideFocus)oBox.hideFocus(true);
            window.focus();    
        }
    }
    
	
	
	
	
	
	
    function inlineGlossary(oContainer,sLookup)
    {
        var sTitle = "";
        if(!sLookup)sLookup = inlineGlossary_getTextNodeData(oContainer);
        switch (sLookup.toLowerCase())
        {
            case "restylane": 
            case "restylane&reg;":
            case "restylane" + String.fromCharCode(174): 
            { 
                sTitle = "A dermal filler that restores volume to the skin, giving a smoother, more youthful appearance."; 
                break; 
            }
            case "aesthetics": 
            { 
                sTitle = "The science and study of beauty."; 
                break; 
            }
            case "alpha hydroxy acids": 
            { 
                sTitle = "Acids derived from fruit and milk sugars and used in certain creams and lotions. Alpha Hydroxy Acids are believed to reduce spots, wrinkles, and other signs of aging, sun-damaged skin."; 
                break; 
            }
            case "anti-inflammatory":
            case "anti-inflammatory medication": 
            { 
                sTitle = "Reducing inflammation by acting on the body's normal responses without directly affecting the cause."; 
                break; 
            }
            case "biocompatible": 
            { 
                sTitle = "The ability of a substance to interact with the body without harmful effects."; 
                break; 
            }
            case "biodegradable": 
            { 
                sTitle = "The ability to dissolve by natural means."; 
                break; 
            }
            case "Botox".toLowerCase():
			case "Botox".toLowerCase() + "&reg;": 
            case "Botox".toLowerCase() + String.fromCharCode(174): 
            { 
                sTitle = "A purified protein produced by the clostridium botulinum bacteria, which reduces the activity of muscles that can cause frown lines."; 
                break; 
            }
            case "collagen": 
            { 
                sTitle = "The major fibers of protein found in connective tissue, cartilage and bone."; 
                break; 
            }
            case "commissures": 
            { 
                sTitle = "Corners or angles of the lips or eye."; 
                break; 
            }
            case "cryotherapy": 
            { 
                sTitle = "The use of cold for treatment of a condition."; 
                break; 
            }
            case "dermabrasion": 
            { 
                sTitle = "A procedure performed with an abrasive wheel or brushes, to wear away the upper layers of skin and improve irregularities in the skin surface, such as acne scars or chicken pox marks."; 
                break; 
            }
            case "dermal": 
            { 
                sTitle = "Relating to the skin or dermis."; 
                break; 
            }
            case "dermal filler": 
            { 
                sTitle = "A substance injected into the skin to restore volume to the skin and smooth out facial wrinkles."; 
                break; 
            }
            case "dermis": 
            { 
                sTitle = "The \"middle portion\" of the skin, containing nerves, blood vessels, oil glands, and hair follicles."; 
                break; 
            }
            case "elastin": 
            { 
                sTitle = "A protein in the middle layer of the skin that helps maintain resilience and elasticity."; 
                break; 
            }
            case "epidermis": 
            { 
                sTitle = "The outermost layer of the skin."; 
                break; 
            }
            case "Fitzpatrick".toLowerCase():
            case "Fitzpatrick Skin Types".toLowerCase(): 
            { 
                sTitle = "A scale that divides skin into six different types."
                sTitle += "\nType I: White skin that never tans and always burns easily."
                sTitle += "\nType II: White skin that tans slightly and always burns easily."
                sTitle += "\nType III: Light brown skin that tans gradually and can burn moderately."
                sTitle += "\nType IV: Moderately brown skin that tans well and burns slightly."
                sTitle += "\nType V: Dark brown skin that tans profusely and burns rarely."
                sTitle += "\nType VI: Black skin with deep pigmentation that never burns."; 
                break; 
            }
            case "Folds".toLowerCase(): 
            { 
                sTitle = "Ridges or edges that appear to form when a layer bends back upon itself."; 
                break; 
            }
            case "Glabellar Creases":
            { 
                sTitle = "Creases in the forehead between the brows. Also called \"frown lines.\"".toLowerCase(); 
                break; 
            }
            case "Hyaluronic Acid".toLowerCase(): 
			case "Hyaluronic Acid-Based".toLowerCase():
            { 
                sTitle = "A substance found in the connective tissue of the body that cushions and lubricates. Hyaluronic acid also creates volume in the face, giving it a healthy, youthful appearance."; 
                break; 
            }
            case "Hydrophilic".toLowerCase(): 
            { 
                sTitle = "Attracting or associating with water."; 
                break; 
            }
            case "Isovolemic Degradation".toLowerCase(): 
            { 
                sTitle = "The process by which a substance dissolves as each molecule progressively binds with more water."; 
                break; 
            }
            case "Laser".toLowerCase(): 
            { 
                sTitle = "A device that concentrates high amounts of energy into a beam of radiation."; 
                break; 
            }
            case "Laugh Lines".toLowerCase(): 
            { 
                sTitle = "A loss of volume in fatty tissue between the mouth and cheeks that creates lines or ridges."; 
                break; 
            }
            case "Marionette Lines".toLowerCase(): 
            { 
                sTitle = "Lines going down from either side of the mouth. Also known as \"oral commissures.\""; 
                break; 
            }
            case "Micro-dermabrasion".toLowerCase():
            case "Micro dermabrasion".toLowerCase():
            case "Microdermabrasion".toLowerCase(): 
            { 
                sTitle = "The use of aluminum oxide crystals, which are blown against the skin and removed, to eliminate the outer layer of the skin and stimulate growth factors."; 
                break; 
            }
            case "NASHA".toLowerCase(): 
            case "NASHA".toLowerCase() + "&trade;":
            case "NASHA".toLowerCase() + "&#8482;":
            case "NASHA".toLowerCase() + String.fromCharCode(8482):
            { 
                sTitle = "(Non-Animal Stabilized Hyaluronic Acid): Hyaluronic acid that does not come from animal parts."; 
                break; 
            }
            case "Nasolabial".toLowerCase(): 
            { 
                sTitle = "Relating to both the upper lip and nose."; 
                break; 
            }
            case "Nasolabial Folds".toLowerCase(): 
            { 
                sTitle = "Ridges or edges that appear from the root of the nose to the angle of the mouth."; 
                break; 
            }
            case "Non-steroidal".toLowerCase(): 
            case "Non steroidal".toLowerCase(): 
            case "Nonsteroidal".toLowerCase(): 
            { 
                sTitle = "Not containing steroids, the family of chemical substances found in many hormones, body constituents, and drugs."; 
                break; 
            }
            case "Oral Commissures".toLowerCase(): 
            { 
                sTitle = "Lines going down from either side of the mouth. Also known as \"Marionette Lines.\""; 
                break; 
            }
            case "Oral Rhytids".toLowerCase(): 
            { 
                sTitle = "The vertical wrinkles above or below the lip, sometimes called smoker's lines."; 
                break; 
            }
            case "Perlane".toLowerCase(): 
            { 
                sTitle = "A safe and natural cosmetic dermal filler that replaces lost volume and restores youthful contours to the skin to smooth away moderate to severe facial wrinkles and folds."; 
                break; 
            }
            case "Photoaging".toLowerCase(): 
            { 
                sTitle = "Damage from sun exposure over time, especially skin wrinkles."; 
                break; 
            }
            case "Pre-testing".toLowerCase():
			case "pretesting".toLowerCase(): 
            { 
                sTitle = "Testing done before a procedure to determine if any allergic reactions might occur."; 
                break; 
            }
            case "Retinoids".toLowerCase(): 
            { 
                sTitle = "Any of a group of natural or human-made substances similar to Vitamin A."; 
                break; 
            }
            case "Rhytid".toLowerCase(): 
            { 
                sTitle = "A skin wrinkle."; 
                break; 
            }
            case "Skin".toLowerCase(): 
            { 
                sTitle = "The protective covering of the body."; 
                break; 
            }
            case "Solar Lentigo".toLowerCase(): 
            { 
                sTitle = "A spot on the skin resembling a freckle, except that its border is more regular, and it contains more melanin pigment. Also known as \"age spots\" or \"liver spots.\""; 
                break; 
            }
            case "St. John's Wort".toLowerCase(): 
            { 
                sTitle = "A long-living, wild-growing plant with yellow flowers. The plant's extracts have been used f or centuries to try to treat mental disorders and nerve pain."; 
                break; 
            }
            case "Sun Protection Factor".toLowerCase(): 
            case "SPF".toLowerCase(): 
            { 
                sTitle = "How many times longer a person wearing sunscreen can stay in the sun before beginning to burn than they would without any sunscreen at all."; 
                break; 
            }
            case "Ultraviolet Rays".toLowerCase():
			case "Ultraviolet".toLowerCase():  
            case "UV rays".toLowerCase():
			case "UV".toLowerCase():  
            { 
                sTitle = "An invisible form of radiation found in sunlight that can change and damage skin cells."; 
                break; 
            }
            case "Vermillion Border".toLowerCase(): 
            { 
                sTitle = "The area where the red or pink lip border meets the skin."; 
                break; 
            }
            case "Wrinkles".toLowerCase():
            case "Wrinkle".toLowerCase():  
            { 
                sTitle = "A ridge on the skin caused by age, fatigue, or other reasons."; 
                break; 
            }
            case "".toLowerCase(): 
            { 
                sTitle = ""; 
                break; 
            }
        }
        oContainer.title = sTitle;
        oContainer.style.cursor='pointer';
        oContainer.style.cursor='hand';
    }
   
   
   
   
   
   
    function inlineGlossary_getTextNodeData(oNode)
    {
        var sText = "";
        var oChild;
        if(oNode.hasChildNodes())
            oChild = oNode.firstChild
            while(oChild)
            {
                if(oChild.nodeName == "#text")
                {
                    sText = oChild.data;
                    break;
                }
                oChild = oChild.nextSibling;
            }
        if(oNode.firstChild.hasChildNodes()) 
              sText = inlineGlossary_getTextNodeData(oNode.firstChild);
        return sText;
    }
    
	
	
	
	
	
    function reminder()
    {
        var oPopup
        // if the user's not logged on and not following a link on the page
        // we need to remind them to register
        if(blnInhibitReminderPopup == false && resty_id == "" && window.name != "pageWin")
        {
            // close any existing popups we've called
            if(pageWin && !pageWin.closed)pageWin.close();
            // popup the reminder
            oPopup = pagePopup("regpopup.asp",window,"width=400, height=250","no");
            oPopup.blur();
        }
    }
    
    var blnInhibitReminderPopup = false;
    var timer;
	
	
	
	
	
	
    function inhibitReminder()
    {
        blnInhibitReminderPopup = true;
        timer = window.setTimeout("blnInhibitReminderPopup = false",1000);
    }
    
	
	
	
	
	
	
    function imageNotice(oEvent)
    {
        // Get the event
        if (!oEvent) var oEvent = window.event;
        
        // Mozilla based browsers invoke the right-click "Save" dialog on mouseup rather than mosedown    
        if(navigator.userAgent.indexOf("Gecko") != -1 && oEvent.type != "mouseup")
        {
            // Get the event's associated element
            var oElement;
            if (oEvent.target) 
                oElement = oEvent.target;
            else if (oEvent.srcElement) 
                oElement = oEvent.srcElement;
            if (oElement.nodeType == 3)oElement = oElement.parentNode; // Safari bug work-around
            
            oElement.onmouseup = imageNotice; 
            
            if (oEvent.stopPropagation) oEvent.stopPropagation(); // W3C version of MS "oEvent.cancelBubble = true"
            return false;
        }
        
        //Handle right clicks only
        if(oEvent.button == 2)
        {
            alert("This image is protected by Copyright, and may not be copied without permission.");
            return false;
        }
    }   
    
    
    /*
        popIn(sURL[,sSize[,sPopName]])
        
        Open a Pop-up window substitue for pop-up blocking clients
        
        Example Code to call this function: 
        var popUpWin = window.open("mypage.htm","popUpWin","width=400,height=200");
        if(!popUpWin)popIn("mypage.htm","width=400,height=400");
    */  
	
	
	
	
	
	
    function popIn(sURL,sSize,sPopName)
    {
        // Sanity check
        if(!sURL)return;
        if(typeof sURL != "string")sURL = String(sURL);
        if(!sSize)sSize = "";
        if(!sPopName)sPopName = "popInWin"
        
        var sWidth = (/width\s*=\s*([^\s,]+)/i).test(sSize) ? RegExp.$1 + "px" : "300px" ;
        var sHeight = (/height\s*=\s*([^\s,]+)/i).test(sSize) ? RegExp.$1 + "px" : "200px" ;
        
        // Get the  blank slate
        if(document.createElement)
        {
            var oTip = document.createElement("DIV");
            oTip.id = sPopName + "Div";
            if(!oTip.style.maxWidth)oTip.style.width = sWidth; // IE doesn't support max-width, so set width
            oTip.style.maxWidth = sWidth;
            oTip.style.backgroundColor = "InfoBackground";
        	oTip.style.color = "InfoText";
        	oTip.style.font = "message-box";
        	oTip.style.position = "absolute";
        	//oTip.style.padding = "1em 0.75em 1em 1.25em";
        	oTip.style.padding = "0px";
        	oTip.style.border = "1px outset ActiveBorder";
            oTip.style.display = "none";
            oTip.style.position = "absolute";
            document.body.appendChild(oTip);
         
            // Get the Text to display    
            var oFrame = document.createElement("IFRAME");
        	oFrame.style.border = "0px solid Black";
            oFrame.id = sPopName;
            oFrame.name = sPopName;
            oFrame.src = sURL;
            oFrame.width = sWidth;
            oFrame.height = sHeight;
            oTip.appendChild(oFrame);
            
            // Finally, display the tooltip
            if(oTip)
            {
                
                for(var i = 0; i < oTip.childNodes.length; i++)
                {
                    if(oTip.childNodes[i].nodeType == 3)oTip.childNodes[i].nodeValue = "";
                }
                oTip.appendChild(oFrame);
                oTip.style.display = "block";
                
                // IE does odd things at times, so take heed
                var bIE = (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1);
                // Mac continues to "think different"
                var bMac = (navigator.userAgent.indexOf("Macintosh") != -1 
                    || navigator.userAgent.indexOf("Mac_PowerPC") != -1
                    || navigator.userAgent.indexOf(" Mac ") != -1);
                
                // The DIV's height will grow due to a bug in IE Mac, so limit it
                if(bMac && bIE && oTip.clientHeight >= oTip.clientWidth)
                    oTip.style.height = (oTip.clientWidth * 0.25) + "px";
                
                // Place the tooltip
                oTip.style.left = "10px";
                oTip.style.top = "20px";
            }
            
    
        } 
    }
    
    
    /* 
    runServerScript(sURL)
    
    This function can run server-side scripts (ASP, PHP, ColdFusion, etc.)
    by loading a server page in a dynamically created 1 pixel by 1 pixel IFRAME.
    Handy for performing server operations called by window.onunload or other events
    after the calling document has already loaded.
    
    sURL: the URL of the document containing the server-side code to be run
    
    */
	
	
	
	
    function runServerScript(sURL)
    {
        // Sanity check
        if(!sURL || String(sURL) == "")return;
        var sWinName = "ServerScriptWin";
        var bDone = false;
        
        // IE on the Mac continues to be problematic
        var bIEMac = navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Mac") != -1 && navigator.userAgent.indexOf("Opera") == -1;
        
        // Load the URL if the window exsists
        if(document.getElementById(sWinName))
        {
            var oFrame = document.getElementById(sWinName);
            if(bIEMac)oFrame.onload = function () { if(bDone) { deleteCookie("lastregformfield");deleteCookie("nextregformfield"); } } // IE Mac cleanup of any tracking cookies
            oFrame.width = "1";
            oFrame.height = "1";
            oFrame.src = sURL;
            bDone = true;
        }
        else
        if(document.createElement)
        {
            // Try creating a new IFRAME
            try
            {
                var oNewIFrame = document.createElement("IFRAME");
                oNewIFrame.src = sURL;
                oNewIFrame.name = sWinName;
                oNewIFrame.id = sWinName;
                oNewIFrame.width = "1";
                oNewIFrame.height = "1";
                oNewIFrame.scrolling = "no";
                oNewIFrame.style.border = "0px solid black";
                if(bIEMac)oNewIFrame.onload = function () { if(bDone) { deleteCookie("lastregformfield");deleteCookie("nextregformfield"); } } // IE Mac cleanup of any tracking cookies
                if(oNewIFrame)
                {
                    document.body.appendChild(oNewIFrame);
                    bDone = true; 
                    //alert("iframe appended.");
                }
                //else alert("creating a new iframe didn't work"); // debug line
            }
            catch(strError)
            {
                //alert("creating and appending a new iframe didn't work"); // debug line
            } 
        }
        
        // Clean up any tracking cookies (IE on the Mac needs to clean up later, when the iframe doc loads)
        if(bDone && !bIEMac)
        {
            deleteCookie("lastregformfield");
            deleteCookie("nextregformfield");
        }
    }
    
    /*
    initializeRegistrationPage()
    
    This function sets up database logging of registration form
    abandonment after a user has begun to fill it in. It depends upon
    the functions runServerScript and trackRegFormFill
    */
	
	
	
	
	
	
    function initializeRegistrationPage()
    {
        var sQuitNotice = "Not right now? Please register soon!";
        var sCompletionNotice = "Thank you for your time!";
        var oForm = document.getElementById("regform");
        
        // set the event handlers to log the form's degree
        // of completion to the database when the page is left
        window.onbeforeunload = function (oEvent)
            { 
                if (!oEvent) var oEvent = window.event;
                if(bFormStarted)
                { 
                    // stall to allow runServerScript to load form status info into database
                    //alert(bFormFinished? sCompletionNotice : sQuitNotice); // obsolete?
                    runServerScript("registerupdate_logactivity.asp?doc=" + sDocumentName);
                    // prevent unload handler from firing if this one does
                    bFormStarted = false; 
                }
                //else if(bFormFinished)alert("form submitted");
            }
        window.onunload = function (oEvent)
            { 
                if (!oEvent) var oEvent = window.event;
                if(bFormStarted)
                { 
                    // stall to allow runServerScript to load form status info into database
                    //alert(bFormFinished? sCompletionNotice : sQuitNotice); // obsolete?
                    runServerScript("registerupdate_logactivity.asp?doc=" + sDocumentName);
                }
            }
        /*
        Safari kludge: 
        runServerScript won't work onunload, so add it to each link's onclick and the window's onblur 
        handlers so that it runs when a user tries to navigate away. (Doesn't work if someone types in
        the address or search bar to navigate away.)
        */
        if(navigator.userAgent.indexOf("Safari") != -1)
        {
            var aAnchors = document.getElementsByTagName("A");
            for(var a = 0; a < aAnchors.length; a++)
            {
                aAnchors[a].addEventListener('click',function () { runServerScript("registerupdate_logactivity.asp?doc=" + sDocumentName) },false);
            }
            body.addEventListener('blur',function () { runServerScript("registerupdate_logactivity.asp?doc=" + sDocumentName) },false);
            // prevent unload handler from firing if this one does
            bFormStarted = false; 
        }
        /*
        Opera kludge: 
        runServerScript won't work if the back or forward browser buttons are used (doesn't fire the unload event)
        */
        if(navigator.userAgent.indexOf("Opera") != -1)
        {
            // No work-around as yet
        }
        // Start fresh
        deleteCookie("lastregformfield");
        deleteCookie("nextregformfield");
    }
    
    // delete a cookie (if path and/or domain were set to other than default
    // when the cookie was written, matching arguments must be passed here.)
	
	
	
	
	
	
    function deleteCookie(sName, path, domain)
    {
        if(document.cookie.length > 0 && document.cookie.indexOf(sName) != -1)
        {
            var oldDate = new Date();
                oldDate.setYear(oldDate.getFullYear() - 20);
            document.cookie = sName
                + (path == null ? "" : ";path=" + path)
                + (domain == null ? "" : ";domain=" + domain)
                + "=;expires=" + oldDate.toGMTString();
            eval("var re = /" + sName + "\=[^;]*(;|$)/gi;");
            document.cookie = document.cookie.replace(re,"");
        }
    }
    
    // Close Pop-up windows and "pop-in" layers
	
	
	
	
	
	
    function closeThisNotice(sWinName)
    {
        if(!sWinName)sWinName = "popInWin";
        if(typeof sWinName != "string")sWinName = String(sWinName);
        
        if(window.name == sWinName)
            parent.document.getElementById('popInWinDiv').style.display='none'; 
        else if(window.opener)
            window.close();
    }
    
    function exitWarning(oLink)
    {
        if(oLink.target != "" && oLink.target != window.name)
            window.open(oLink.href,oLink.target);
        window.open('exit.html', 'pageWin', 'width=460, height=270, scrollbars=no');
        return oLink.target != "" && oLink.target != window.name ? false : true;
    }
    
	
	
	
	
	
	
    function init()
    {
        if(!(navigator.userAgent.indexOf("Mac") != -1 && navigator.userAgent.indexOf("MSIE") != -1))
            indicateSectionAndPage(); // Bugged in IE on the Mac, so skip it there for now
        if(window.name != "pageWin" && window.name != "videoWin")window.name = "restyMainWin";
        if(blnConfirmMD)pagePopup('confirm_md.asp',window,'width=400, height=450','no');
		if(blnNotRegistered_FindDoc)pagePopup('findadoctor_register_pu.asp',window,'width=400, height=450','no');
		if(blnNotRegistered_RestyRewards)pagePopup('rewards_register_pu.asp',window,'width=400, height=450','no');
        //if(blnRegistrationPage)initializeRegistrationPage();
        // Force page reflow on IE under AppleOS
        if(navigator.userAgent.indexOf("Mac") != -1 && navigator.userAgent.indexOf("MSIE") != -1)
        {
            window.resizeBy(1,1);
            setTimeout("window.resizeBy(-1,-1)",100);
        }
        if(blnLeftLogon)
        {
            if(document.getElementById("resty_usr"))document.getElementById("resty_usr").initialized = true;
            if(document.getElementById("resty_pwd"))
            {
                document.getElementById("resty_pwd").initialized = true;
                passwordBold(document.getElementById("resty_pwd"));
            }
        } 
    
    }
    //window.onload = init;
    //window.onunload = reminder;
    //document.onclick = inhibitReminder;