﻿        // Opens a link in a new window when href is not localhost or lp-bp
        function doPopups() {
            if (!document.getElementsByTagName) return false;
            var links = document.getElementsByTagName('a');
            for (var i=0; i < links.length; i++) {
                if ((/^(http:\/\/)(?!parlwebdev.parl.gc.ca|parlwebdev|parlwebdevtest|parlwebdevtest.parl.gc.ca|www.parl.gc.ca|www2.parl.gc.ca|parldev|parltest|parlwebprodtest|parlwebprodtest.parl.gc.ca|localhost|lp\-bp|lp\-bptest|intraparl|parltest1a|parltest1b|parlinfotest)/i.test(links[i].href)) && !(/LopMenuItem/i.test(links[i].className))) {
                    //alert(links[i].href);
                    
                    // WARNING do not use single quotes, double quotes or greater or smaller than sings this affects the highliter
                    //Do not change the class for menu items
                    //or for RedSearchBar
                    if ( (!/ExternalLink/i.test(links[i].className)) && (!/ctl00_pnlTopNavigationExternal/i.test(links[i].parentNode.parentNode.parentNode.id)) )
                    {
                        
                        if (/RelatedLink/i.test(links[i].className))
                        {
                            //If not related link
                            links[i].className = links[i].className + ' newWinStyleRelatedLink';
                        }
                        else
                        {
                            if (/IndexLink/i.test(links[i].className) || /IndexSubLink/i.test(links[i].className))
                            {
                                //If not related link
                                links[i].className = links[i].className + ' IndexLinkExternal';
                            }
                            else
                            {
                                //RelatedLink
                                links[i].className = links[i].className + ' newWinStyle';
                            }
                        }
                    }
                    if (links[i].title == '') {
                        // Add the message Opens in new window
                        links[i].title = newWindowText;
                    }
                    else {
                        links[i].title = links[i].title + newWindowText;
                    }

			links[i].target = "_blank";			
/*
                    links[i].onclick = function(e) {
                        if(!e)e=window.event;
                        if(e.shiftKey || e.ctrlKey || e.altKey) return;
                        window.open(this.href);
                        return false;
                    }
*/
                }
            }
        }       

