var okURL = new Array();
//okURL[next position in array] = Array(link,scope) ...scope = "all" for any site under url else "" for only url
okURL[okURL.length]=["50below.com","all"];
okURL[okURL.length]=["50belowinc.com","all"];
okURL[okURL.length]=["rwbaird.com","all"];
okURL[okURL.length]=["bairdfinancialadvisor.com","all"];
okURL[okURL.length]=["locatebaird.com","all"];
okURL[okURL.length]=["bairdoffices.com","all"];
okURL[okURL.length]=["bairdonline.com","all"];
okURL[okURL.length]=["standardandpoors.com","all"];
okURL[okURL.length]=["standardpoor.com","all"];
okURL[okURL.length]=["e-billmanagement.com","all"];
okURL[okURL.length]=["sipc.org","all"];
okURL[okURL.length]=["bairdinvestmentdigest.com","all"];

function CheckHref(TheLink) {
	for(var i=0; i < okURL.length; i++) {
		if(okURL[i][1].match(/all/i))
			myReg = new RegExp("^https?://[^\.]*."+okURL[i][0]+"|^https?://"+okURL[i][0]+"|^javascript|^mailto","i");
		else
			myReg = new RegExp("^https?://[^\.]*."+okURL[i][0]+"/?$|^https?://"+okURL[i][0]+"/?$|^javascript|^mailto","i");		
		if(TheLink.match(myReg)) return true;
	}
	return false;
}

$(document).ready(function() {
    $("a").click(function() {
        var url = window.location.href;
        if (url.match(/bairdoffices\.com.*advisors\.htm/i))
            return true;
        var TheLink = $(this).attr("href");
        if (!TheLink.match(/http/))
            TheLink = "";

        if (TheLink != null && TheLink != "" && !CheckHref(TheLink)) {
            if (!confirm("You are now leaving the Robert W. Baird site. We are not endorsing or responsible for the content on other sites. Please read the TERMS AND CONDITIONS in the Help section of our site for more information. Do you wish to proceed?"))
                return false;
        }
    });
});

