function feedmanagerClass() {
    var domain = location.host.toString();

    var feeds = ["daily"];

    this.keys = {};
    this.action = {};

    for(var i=0;i<feeds.length;i++){
        var f = feeds[i];
        this.keys[ f + "_fd" ] = "http://" + domain + "/magazine/blogs/daily/rss.xml";
        //... = populateShop, populateEbay, populateBeauty, populateCheapchic, ...
        this.action[ f + "_fd" ] = window["populate" + f.substring(0, 1).toUpperCase() + f.substring(1)];
    }

    this.numItems = 1;
    this.idList = [];

}

var feedmanager = new feedmanagerClass();



function assignFeeds() {
    var count = 0;
    var bodyClass = document.getElementsByTagName('body')[0].className.split(" ");
    var scriptTarget;
    for (var i=0; i<bodyClass.length; i++) {
        if (bodyClass[i] == "home") {
            this.numItems = 1;
            break;
        }
    }

    // get rss feeds div ids
    for (fId in this.action) {
        var fEl = document.getElementById(fId);
        if (fEl) {
            this.idList[count] = fId;
            scriptTarget = fEl;
            count++;
        }
    }

    // Write out the script tags
    if (scriptTarget != null && scriptTarget != undefined) {
        scriptNode = document.createElement('script');
        scriptNode.setAttribute('type','text/javascript');
        scriptNode.setAttribute('src','/js/loadFeeds.js');
        scriptTarget.appendChild(scriptNode);
    }

}

feedmanagerClass.prototype.assign = assignFeeds;
