function subscriptionsClass() {
    this.path = "https://w1.buysub.com/servlet/OrdersGateway?cds_mag_code=SLF&cds_page_id= 30631&cds_response_key=";
    this.giftPath = "https://w1.buysub.com/servlet/GiftsGateway?cds_mag_code=SLF&cds_page_id=1234&cds_response_key=";

    this.keys = new Object();
 	/*  this.keys["mainRelatedSubscribe"]="";  obsolete? --not in use - pthompso */
    this.keys["headerSubscribe"]="IKDNSP01";
    this.keys["menuSubscribe"]="IKDNSP02";
    /* this.keys["contentSubscribeText"]="IKDNSP07"; */
    /*  this.keys["footerSubscribe"]="IKDNSP04";  obsolete? */
    /* this.keys["relatedSubscribe"]="IKDNSP05";obsolete? */
    /*  this.keys["mainIssueSubscribe"]="IKDNSP06"; obsolete? */
    this.keys["contactSubscribe"]="IKDNSP08";
    this.keys["arrivalPop"]="IKDNSP10";
    this.keys["exitingPop"]="IKDNSP09";
     /* this.keys["forums"]="IKDNSP11"; */
    this.keys["includeSubscribe"]="IKDNSP03"; /* when subscribe unit isn't in xrail */
    this.keys["includeSubscribeXrail"]="IKDNSP12"; /* this key is used for the xrail */

    this.gift = new Object();
    /* this.gift["relatedGift"]="GYDIMTRG"; */
    /* this.gift["footerGiftSubscribe"]="GYDIMTFG"; */
    /* this.gift["embeddedGift"]="GYDIMYEG"; */
    this.gift["outerailGiftSubscribe"]="GYDIMBRR";
    this.gift["contactGiftSubscribe"]="GYDIMBCU";

    this.links = new Object();
    this.links["subscriptionQuestions"]="https://w1.buysub.com/servlet/CSGateway?cds_mag_code=SLF&cds_page_id=1815";
}

var subscriptions=new subscriptionsClass();

function assignLinks() {
    for (var i=0; i<document.links.length; i++) {
        var name="";
        if (typeof document.links[i].name == "string") {
            /* works only in newer browsers !!! */
            name=document.links[i].name;
        } else {
            /* for older browsers !!! */
            name=document.links[i].href;
        }
        if (name == null) { continue; }
        if (typeof name != "string") { continue; }
        if (name.length < 5) { continue; }
        if (name.indexOf('javascript') != -1) { continue; }
        if (typeof name == "string") {
            name=name.substring(name.lastIndexOf('/')+1);
            if (typeof this.links[name] == "string") {
                document.links[i].href=this.links[name];
                document.links[i].target="_blank";
            } else if (typeof this.keys[name] == "string") {
                document.links[i].href=this.path+this.keys[name];
                document.links[i].target="_blank";
            } else if (typeof this.gift[name] == "string") {
                document.links[i].href=this.giftPath+this.gift[name];
                document.links[i].target="_blank";
            }
        } /* end if */
    } /* end for */
} /* end assignLinks */

subscriptionsClass.prototype.assign=assignLinks; 
