function BindLogin(anchor) { document.getElementById('CartLoginpopupIFrame').src = document.getElementById('CartLoginpopupIFrame').src + '?ReturnUrl=' + anchor; document.getElementById('CartLoginBG').style.display = ''; document.getElementById('CartLoginContainer').style.display = ''; document.getElementById('CartLoginpopupIFrame').focus(); } function bindCartAnchors() { var anchors = document.getElementsByTagName('a'); for (var i = 0; i < anchors.length; i++) { var link = anchors[i].href; if (link != null && link.length > 0 && link.toLowerCase().indexOf(".jpg") == -1 && link.toLowerCase().indexOf(".jpeg") == -1 && link.toLowerCase().indexOf(".png") == -1 && link.toLowerCase().indexOf(".gif") == -1 && link.toLowerCase().indexOf(".bmp") == -1 && link.toLowerCase().indexOf(".tiff") == -1 && link.toLowerCase().indexOf(".txt") == -1 && link.toLowerCase().indexOf(".xml") == -1 && link.toLowerCase().indexOf(".js") == -1 && link.toLowerCase().indexOf(".css") == -1 && link.toLowerCase().indexOf(".ashx") == -1 && link.toLowerCase().indexOf("#collapse") == -1) { if (link.toLowerCase().replace("http://", "").replace("https://", "").indexOf(location.hostname.toLowerCase()) > -1 || link.toLowerCase().indexOf("onlinecatalog") > -1) { if (anchors[i].href.toLowerCase().indexOf("ispopup=1") == -1) { anchors[i].href = "javascript:BindLogin('" + link + "');"; } } } } } function listen(evnt, elem, func) { if (elem.addEventListener) // W3C DOM elem.addEventListener(evnt, func, false); else if (elem.attachEvent) { // IE DOM var r = elem.attachEvent("on" + evnt, func); return r; } } listen("load", window, function () { bindCartAnchors(); });