function IssuuDocumentController()
{
    this.init = init;
    
    function init()
    {
        if (typeof documentList.bindings != "undefined")
        {
            var objLinks = document.getElementsByTagName("a");
                
            if (objLinks.length > 0)
            {
                var strLayout = "";
                
                if (this.layout == undefined)
                {
                    strLayout = "basicblue";
                }
                else
                {
                    strLayout = this.layout;
                }    
                
                for (var i=0; i < objLinks.length; i++)
                {
                    findIssuuLink(objLinks[i], this.profile, strLayout); 
                }
            }
        }
    }

    function findIssuuLink(objLink, strIssuuProfileName, strLayoutFolder)
    {
        var boolResult = false;
        
        if (documentList.bindings.length > 0)
        {
            var strHref = objLink.href.toLowerCase();
            
            for (var i=0; i < documentList.bindings.length; i++)
            {
                if (strHref.indexOf(documentList.bindings[i].orgDocName) >= 0)
                {
                    objLink.href = "http://issuu.com/" + strIssuuProfileName + "/docs/" + documentList.bindings[i].name + "?mode=embed&documentId=" + documentList.bindings[i].id + "&layout=http://www.newschool.edu/issuu/" + strLayoutFolder + "/layout.xml";
                    objLink.rel="shadowbox";
                    boolResult = true;
                    break;
                }
            }
        }
        
        return boolResult;
    }
}

