// To use, add:
// <script type="text/JavaScript" src="/return.js"></script>
// before the </head> tag for the page
// Add:
// #IF (#BasketSubTotal_Value > 0)onLoad="javascript:set_return_link_handlers('http://#URL_UserTemplate/72');" onUnLoad="javascript:unloader();"#ENDIF
// to the <body> tag
// Also must define #ReturnCoupon and #ReturnOffer TLE's
// 3-14-06 MEZ Added to:
// User Template 58 (Checkout Choice)
// Basket
// Non-member data form
// Order - Input credit card entries
// Order - Member order information
// Order - Non-member order information
// Order - Select payment method
// Registration - Registration member data form
// Revision BB: 05/10/06

var thisFullHost = location.hostname;
var thisDomain = thisFullHost.substring(0, thisFullHost.lastIndexOf('.'));
var thisHost = '';

//If there are any periods left, save only what is after that period
if (thisDomain.indexOf('.') > -1) {
        thisHost = thisDomain.substring(thisDomain.indexOf('.')+1, thisDomain.length);
}

var popupURL = '';
var outbound = true;

function followingLink() {
        if (this.hostname.indexOf(thisHost) > -1) {
                outbound = false;
        }

        return true;
}

function set_return_link_handlers(URL) {
        popupURL = URL;
        var i;
        for (i=0; i < document.links.length; i++) {
                if (document.links[i].onclick) {
                    // do nothing               
                }
                else {
                       document.links[i].onclick = followingLink;                 
                }
        }
}

function unloader() {
         if (outbound) {
                     // var popwin = window.open(popupURL,'thisName','width=505,height=500');
                     // popwin.moveTo(200,200);
                     // popwin.focus();
         }

}


