﻿polymer = {

    /* Generic Functions */
    _createTransport: function() {
        if (typeof XMLHttpRequest != "undefined") {
            return new XMLHttpRequest();
        }
        else if (typeof ActiveXObject != "undefined") {
            var http = null;
            try {
                http = new ActiveXObject("MSXML2.XmlHttp.6.0");
                return http;
            }
            catch (ex) {
                try {
                    http = new ActiveXObject("MSXML2.XmlHttp.3.0");
                    return http;
                }
                catch (ex2) {
                    throw Error("Cannot create XHR object");
                }
            }
        }
    },

    _getCachedValue: function(cid) {
        var cobj = $('__polymer.cache.' + cid);

        if (cobj == null)
            return null;
        else
            return cobj.value;
    },

    _saveCacheValue: function(v, cid) {
        var cid = '__polymer.cache.' + cid;

        var cin = document.createElement('input');
        cin.id = cid;
        cin.value = v;
        cin.style.position = 'absolute';
        cin.style.top = '-2000px';

        document.body.appendChild(cin);
    },

    _setTab: function(tabGroup, tabId) {
        var els = Dom.getChildren(tabGroup);
        Dom.removeClass(els, 'selected');
        Dom.addClass(tabId, 'selected');
    },

    /* Top Reviewers */
    _topReviewers_OID: 'topReviewers-container',
    _topReviewers_URL: '/top-reviewers/_JSON.aspx',
    _topReviewers_CID: 'topReviewers',
    _topReviewers_Items: 9,

    _topReviewers_Populate: function() {
        var cid = this._topReviewers_CID;
        var cache = this._getCachedValue(cid);

        var json = eval('(' + cache + ')');
        var html = '';
        var count = 1

        if (this._topReviewers_Items <= json[0].pageItems) {
            for (var i = 1; i < (this._topReviewers_Items - 2); i++) {
                html += '<div class="pod-336-reviewer">';

                html += '<div style="float: left; clear:left; padding: 5px; overflow:hidden; border-top:solid 1px #d4dee6; width:20px;"><p class="no-margin">' + count.toString() + '.</p></div>';
                html += '<div style="float: left; padding-top:5px; overflow:hidden; padding-bottom:5px;width:134px; border-top:solid 1px #d4dee6; border-right:solid 1px #d4dee6;">';

                html += '<p class="no-margin">';
                html += json[i].LastName + ', ';
                html += json[i].FirstName + ' ';
                html += json[i].MiddleName + '</p>';

                html += '</div>';

                html += '</div>';
                html += '<div class="pod-336-reviewer">';
                html += '<div style="float: left;  clear:right;padding: 5px; overflow:hidden; border-top:solid 1px #d4dee6; width:20px;"><p class="no-margin">' + (count + 6).toString() + '.</p></div>';
                html += '<div style="float: left; padding-top:5px; padding-bottom:5px;width:134px; overflow:hidden; border-top:solid 1px #d4dee6; border-right:solid 1px #d4dee6;">';

                html += '<p class="no-margin">';
                html += json[count + 6].LastName + ', ';
                html += json[count + 6].FirstName + ' ';
                html += json[count + 6].MiddleName + '</p>';

                html += '</div>';

                html += '</div>';
                count = count + 1
            }
            html += '<div style="clear:left;"></div>';

            $(this._topReviewers_OID).innerHTML = html;
        } else {
            document.location = '/top-reviewers/';
        }
    },

    topReviewers_Populate: function() {
        var cid = this._topReviewers_CID;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._topReviewers_URL;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._topReviewers_Populate();
                    }
                }
            }

            trans.send(null);
        } else {
            this._topReviewers_Populate();
        }
    },

    topReviewers_More: function(dir) {
        var currItems = parseInt(this._topReviewers_Items);
        currItems = currItems + dir;
        if (currItems >= 3) {
            this._topReviewers_Items = currItems;
            this.topReviewers_Populate();
        }
    },

    _topReviewers_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            html += '<div class="pod-680-rule">';
            html += '<table cellspacing="0" cellpadding="0" class="topAuthors">';

            var rows = json.length / 5;
            rows = Math.round(rows);
            for (var i = 1; i <= 11; ) {


                html += '<tr>';
                html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].LastName + ',</span><br />' + json[i].FirstName + ' ' + json[i].MiddleName + '<br />Reviews: ' + json[i].AllReviews + '</div></td>';
                if (!(json[i + 11] == null)) {
                    html += '<td><div><span style="color: #10387b;">' + (i + 11) + '. ' + json[i + 11].LastName + ',</span><br />' + json[i + 11].FirstName + ' ' + json[i + 11].MiddleName + '<br />Reviews: ' + json[i + 11].AllReviews + '</div></td>';
                }
                else {
                    html += '<td></td>';
                }
                if (!(json[i + 22] == null)) {
                    html += '<td><div><span style="color: #10387b;">' + (i + 22) + '. ' + json[i + 22].LastName + ',</span><br />' + json[i + 22].FirstName + ' ' + json[i + 22].MiddleName + '<br />Reviews: ' + json[i + 22].AllReviews + '</div></td>';
                }
                else {
                    html += '<td></td>';
                }
                if (!(json[i + 33] == null)) {
                    html += '<td><div><span style="color: #10387b;">' + (i + 33) + '. ' + json[i + 33].LastName + ',</span><br />' + json[i + 33].FirstName + ' ' + json[i + 33].MiddleName + '<br />Reviews: ' + json[i + 33].AllReviews + '</div></td>';
                }
                else {
                    html += '<td></td>';
                }
                if (!(json[i + 44] == null)) {
                    html += '<td><div><span style="color: #10387b;">' + (i + 44) + '. ' + json[i + 44].LastName + ',</span><br />' + json[i + 44].FirstName + ' ' + json[i + 44].MiddleName + '<br />Reviews: ' + json[i + 44].AllReviews + '</div></td>';
                }
                else {
                    html += '<td></td>';
                }
                html += '</tr>';

                i = i + 1
            }

            html += '</table>';
            html += '</div>';
        }

        $(this._topReviewers_OID).innerHTML = html;
    },

    topReviewers_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._topReviewers_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._topReviewers_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    },


    /* Hot Articles */
    _hotArticles_OID: 'hotArticles-container',
    _hotArticles_URL: '/hot-articles/_JSON.aspx',
    _hotArticles_CID: 'hotArticles',
    _hotArticles_Items: 3,

    _hotArticles_Populate: function() {
        var cid = this._hotArticles_CID;
        var cache = this._getCachedValue(cid);

        var json = eval('(' + cache + ')');
        var html = '';

        if (this._hotArticles_Items <= json[0].pageItems) {
            for (var i = 1; i < this._hotArticles_Items; i++) {
                html += '<div class="pod-336-article">';

                html += '<div style="float: left; padding-right: 5px;"><p class="no-margin">' + json[i].Number + '.</p></div>';
                html += '<div style="float: left; width:270px;">';

                html += '<p class="no-margin">';
                html += '<a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a><br />';
                html += json[i].Author + '<br />';
                html += '<em>' + json[i].Edition + '</em></p>';

                html += '</div>';
                html += '<div style="clear:left;"></div>';

                html += '</div>';
            }

            $(this._hotArticles_OID).innerHTML = html;
        } else {
            document.location = '/hot-articles/';
        }
    },

    hotArticles_Populate: function() {
        var cid = this._hotArticles_CID;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._hotArticles_URL;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._hotArticles_Populate();
                    }
                }
            }

            trans.send(null);
        } else {
            this._hotArticles_Populate();
        }
    },

    hotArticles_More: function(dir) {
        var currItems = parseInt(this._hotArticles_Items);
        currItems = currItems + dir;
        if (currItems >= 3) {
            this._hotArticles_Items = currItems;
            this.hotArticles_Populate();
        }
    },

    _hotArticles_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.hotArticles_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.hotArticles_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule bookmark">';

                html += '<div style="float: left; padding-right: 5px;"><h2>' + json[i].Number + '.</h2></div>';
                html += '<div style="float: left; width:600px;">';

                html += '<h2><a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a></h2>';
                html += '<p class="no-margin">' + json[i].Author + '<br />';
                html += '<em>' + json[i].Edition + '</em></p>';

                html += '<a class="two-collab" href="javascript:elsevier_share.twoCollab(\'' + json[i].Link + '\')"></a>'
                html += '<a class="digg" href="javascript:elsevier_share.digg(\'' + json[i].Link + '\')"></a>'
                html += '<a class="reddit" href="javascript:elsevier_share.reddit(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'
                html += '<a class="facebook" href="javascript:elsevier_share.facebook(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'

                html += '</div>';
                html += '<div style="clear:left;"></div>';
                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._hotArticles_OID).innerHTML = html;
    },

    hotArticles_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._hotArticles_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._hotArticles_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    },


    /* Top 50 Downloaded Articles */
    _topDownloads_OID: 'topDownloads-container',
    _topDownloads_URL: '/top-downloads/_JSON.aspx',
    _topDownloads_YearTo: '0',
    _topDownloads_CID: 'topDownloads',
    _topDownloads_Items: 3,

    _topDownloads_Populate: function(cid) {
        var cache = this._getCachedValue(cid);

        var json = eval('(' + cache + ')');
        var html = '';

        if (this._topDownloads_Items <= json[0].pageItems) {
            for (var i = 1; i < this._topDownloads_Items; i++) {
                html += '<div class="pod-336-article">';

                html += '<div style="float: left; padding-right: 5px;"><p class="no-margin">' + json[i].Number + '.</p></div>';
                html += '<div style="float: left; width:270px;">';

                html += '<p class="no-margin">';
                html += '<a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a><br />';
                html += json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue + ', ' + json[i].CoverDate + ', Pages ' + json[i].Pages + '</em></p>';

                html += '</div>';
                html += '<div style="clear:left;"></div>';

                html += '</div>';
            }

            $(this._topDownloads_OID).innerHTML = html;
        } else {
            document.location = '/top-downloads/';
        }
    },

    topDownloads_Populate: function() {
        var cid = this._topDownloads_CID + '.' + this._topDownloads_YearTo;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._topDownloads_URL + '?YearTo=' + this._topDownloads_YearTo;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._topDownloads_Populate(cid);
                    }
                }
            }

            trans.send(null);
        } else {
            this._topDownloads_Populate(cid);
        }

        return false;
    },

    topDownloads_More: function(dir) {
        var currItems = parseInt(this._topDownloads_Items);
        currItems = currItems + dir;
        if (currItems >= 3) {
            this._topDownloads_Items = currItems;
            this.topDownloads_Populate();
        }

        return false;
    },

    topDownloads_ChangeYear: function(YearTo, tabId) {
        this._topDownloads_YearTo = YearTo;
        this.topDownloads_Populate();

        this._setTab('topDownloads_Tabs', tabId);

        return false;
    },

    _topDownloads_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.topDownloads_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.topDownloads_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule bookmark">';

                html += '<div style="float: left; padding-right: 5px;"><h2>' + json[i].Number + '.</h2></div>';
                html += '<div style="float: left; width:600px;">';

                html += '<h2><a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a></h2>';
                html += '<p class="no-margin">' + json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue + ', ' + json[i].CoverDate + ', Pages ' + json[i].Pages + '</em></p>';

                html += '<a class="two-collab" href="javascript:elsevier_share.twoCollab(\'' + json[i].Link + '\')"></a>'
                html += '<a class="digg" href="javascript:elsevier_share.digg(\'' + json[i].Link + '\')"></a>'
                html += '<a class="reddit" href="javascript:elsevier_share.reddit(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'
                html += '<a class="facebook" href="javascript:elsevier_share.facebook(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'

                html += '</div>';
                html += '<div style="clear:left;"></div>';
                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._topDownloads_OID).innerHTML = html;
    },

    topDownloads_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._topDownloads_URL;
        url = url + '?CurrentPageIndex=' + page;
        url = url + '&YearTo=' + this._topDownloads_YearTo;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._topDownloads_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);

        return false;
    },

    topDownloads_ChangeYearSub: function(YearTo, tabId) {
        this._topDownloads_YearTo = YearTo;
        this.topDownloads_PopulateSub(0);

        this._setTab('topDownloads_Tabs', tabId);

        return false;
    },

    /* Top 50 Cited Articles */
    _topCited_OID: 'topCited-container',
    _topCited_URL: '/top-cited/_JSON.aspx',
    _topCited_YearTo: '0',
    _topCited_CID: 'topCited',
    _topCited_Items: 3,

    _topCited_Populate: function(cid) {
        var cache = this._getCachedValue(cid);

        var json = eval('(' + cache + ')');
        var html = '';

        if (this._topCited_Items <= json[0].pageItems) {
            for (var i = 1; i < this._topCited_Items; i++) {
                html += '<div class="pod-336-article">';

                html += '<div style="float: left; padding-right: 5px;"><p class="no-margin">' + json[i].Number + '.</p></div>';
                html += '<div style="float: left; width:270px;">';

                html += '<p class="no-margin">';
                html += '<a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a><br />';
                html += json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue;

                if (json[i].PubDate != '')
                    html += ', ' + json[i].PubDate;

                html += ',<br /> Pages ' + json[i].StartPage;

                if (json[i].EndPage != '')
                    html += '-' + json[i].EndPage;

                html += '</em>';

                if (json[i].Cited != '00')
                    html += '<br />Cited by: ' + json[i].Cited;

                html += '</p>';
                html += '</div>';
                html += '<div style="clear:left;"></div>';
                html += '</div>';
            }

            $(this._topCited_OID).innerHTML = html;
        } else {
            document.location = '/top-cited/';
        }
    },

    topCited_Populate: function() {
        var cid = this._topCited_CID + '.' + this._topCited_YearTo;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._topCited_URL + '?YearTo=' + this._topCited_YearTo;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._topCited_Populate(cid);
                    }
                }
            }

            trans.send(null);
        } else {
            this._topCited_Populate(cid);
        }

        return false;
    },

    topCited_More: function(dir) {
        var currItems = parseInt(this._topCited_Items);
        currItems = currItems + dir;
        if (currItems >= 3) {
            this._topCited_Items = currItems;
            this.topCited_Populate();
        }

        return false;
    },

    topCited_ChangeYear: function(YearTo, tabId) {
        this._topCited_YearTo = YearTo;
        this.topCited_Populate();

        this._setTab('topCited_Tabs', tabId);

        return false;
    },

    _topCited_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.topCited_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.topCited_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule bookmark">';

                html += '<div style="float: left; padding-right: 5px;"><h2>' + json[i].Number + '.</h2></div>';
                html += '<div style="float: left; width:600px;">';

                html += '<h2><a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a></h2>';
                html += '<p class="no-margin">' + json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue;

                if (json[i].PubDate != '')
                    html += ', ' + json[i].PubDate;

                html += ', Pages ' + json[i].StartPage;

                if (json[i].EndPage != '')
                    html += '-' + json[i].EndPage;

                html += '</em>';

                if (json[i].Cited != '00')
                    html += '<br />Cited by: ' + json[i].Cited;

                html += '</p>';

                html += '<a class="two-collab" href="javascript:elsevier_share.twoCollab(\'' + json[i].Link + '\')"></a>'
                html += '<a class="digg" href="javascript:elsevier_share.digg(\'' + json[i].Link + '\')"></a>'
                html += '<a class="reddit" href="javascript:elsevier_share.reddit(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'
                html += '<a class="facebook" href="javascript:elsevier_share.facebook(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'

                html += '</div>';
                html += '<div style="clear:left;"></div>';
                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._topCited_OID).innerHTML = html;
    },

    topCited_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._topCited_URL;
        url = url + '?CurrentPageIndex=' + page;
        url = url + '&YearTo=' + this._topCited_YearTo;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._topCited_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);

        return false;
    },

    topCited_ChangeYearSub: function(YearTo, tabId) {
        this._topCited_YearTo = YearTo;
        this.topCited_PopulateSub(0);

        this._setTab('topCited_Tabs', tabId);

        return false;
    },

    /* Hot Articles */
    _featArticles_OID: 'featArticles-container',
    _featArticles_URL: '/feature-articles/_JSON.aspx',
    _featArticles_CID: 'featArticles',
    _featArticles_Items: 3,

    _featArticles_Populate: function() {
        var cid = this._featArticles_CID;
        var cache = this._getCachedValue(cid);

        var json = eval('(' + cache + ')');
        var html = '';

        if (this._featArticles_Items <= json[0].pageItems) {
            for (var i = 1; i < this._featArticles_Items; i++) {
                html += '<div class="pod-336-article">';
                html += '<p class="no-margin">';
                html += '<a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a><br />';
                html += json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue + ', ' + json[i].PublishDate + ', Pages ' + json[i].StartPage + '-' + json[i].EndPage + '</em>';

                if (json[i].Cited > 0)
                    html += '<br />Cited by ' + json[i].Cited;

                if (json[i].PDF != '')
                    html += '<br /><a href="' + json[i].PDF + '" target="_blank"><img src="/_common/img/download-pdf.gif" alt="Download PDF" border="0" style="padding-top: 5px;" /></a>';

                html += '</p>';
                html += '</div>';
            }

            $(this._featArticles_OID).innerHTML = html;
        } else {
            document.location = '/feature-articles/';
        }
    },

    featArticles_Populate: function() {

        var cid = this._featArticles_CID;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._featArticles_URL;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._featArticles_Populate();
                    }
                }
            }

            trans.send(null);
        } else {
            this._featArticles_Populate();
        }
    },

    featArticles_More: function(dir) {
        var currItems = parseInt(this._featArticles_Items);
        currItems = currItems + dir;
        if (currItems >= 3) {
            this._featArticles_Items = currItems;
            this.featArticles_Populate();
        }
    },

    _featArticles_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.featArticles_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.featArticles_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule bookmark">';

                if (json[i].PDF != '')
                    html += '<a href="' + json[i].PDF + '" target="_blank" style="float: right;margin-left: 20px; white-space: nowrap;"><img src="/_common/img/download-pdf.gif" alt="Download PDF" border="0" /></a>';
                html += '<h2><a href="' + json[i].Link + '" target="_blank">' + json[i].ArticleTitle + '</a></h2>';
                html += '<p class="no-margin">' + json[i].Author + '<br />';
                html += '<em>Volume ' + json[i].Volume + ', Issue ' + json[i].Issue + ', ' + json[i].PublishDate + ', Pages ' + json[i].StartPage + '-' + json[i].EndPage + '</em>';

                if (json[i].Cited > 0)
                    html += '<br />Cited by ' + json[i].Cited;

                html += '</p>';

                html += '<a class="two-collab" href="javascript:elsevier_share.twoCollab(\'' + json[i].Link + '\')"></a>'
                html += '<a class="digg" href="javascript:elsevier_share.digg(\'' + json[i].Link + '\')"></a>'
                html += '<a class="reddit" href="javascript:elsevier_share.reddit(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'
                html += '<a class="facebook" href="javascript:elsevier_share.facebook(\'' + json[i].Link + '\', \'' + json[i].ArticleTitle + '\')"></a>'

                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._featArticles_OID).innerHTML = html;
    },

    featArticles_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._featArticles_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._featArticles_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    },

    /* Meet the Editors */
    _editors_OID: 'editors-container',
    _editors_URL: '/editors/_JSON.aspx',
    _editors_CID: 'editors',
    _editors_Items: 4,

    _editors_Populate: function() {
        var cid = this._editors_CID;
        var cache = this._getCachedValue(cid);
        var json = eval('(' + cache + ')');

        var html = '';

        if (this._editors_Items <= json[0].pageItems) {
            for (var i = 1; i < this._editors_Items; i++) {

                html += '<div class="pod-336-article">';
                html += '<table cellspacing="0" cellpadding="0" style="width: 100%;"><tr>';
                html += '<td style="padding: 0px 10px 0px 0px; width: 75px;"><img src="/_common/img/editors/' + json[i].Image + '" alt="' + json[i].Name + '" /></td>';
                html += '<td><p class="no-margin"><a href="/editors/#ed' + json[i].ID + '">' + json[i].Name + '</a><br />' + json[i].Position + '<br /><em>' + json[i].Location + '</em></p></td>';
                html += '</tr></table>';
                html += '</div>';
            }

            $(this._editors_OID).innerHTML = html;
        } else {
            document.location = '/editors/';
        }
    },

    editors_Populate: function() {
        var cid = this._editors_CID;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._editors_URL;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        polymer._saveCacheValue(trans.responseText, cid);
                        polymer._editors_Populate();
                    }
                }
            }

            trans.send(null);
        } else {
            this._editors_Populate();
        }
    },

    editors_More: function(dir) {
        var currItems = parseInt(this._editors_Items);
        currItems = currItems + dir;
        if (currItems >= 5) {
            this._editors_Items = currItems;
            this.editors_Populate();
        }
    },

    _editors_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.editors_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.editors_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule">';
                html += '<table cellspacing="0" cellpadding="0" style="width: 100%;"><tr>';
                html += '<td style="padding: 0px 10px 0px 0px; width: 75px; vertical-align: top;"><img src="/_common/img/editors/' + json[i].Image + '" alt="' + json[i].Name + '" width="75" height="75" /></td>';
                html += '<td><h2><a name="ed' + json[i].ID + '" id="ed' + json[i].ID + '">' + json[i].Name + '</a></h2>';
                html += '<p>' + json[i].Position + '<br /><em>' + json[i].Location + '</em></p>';
                html += '<p>' + json[i].Bio + '</p></td>';
                html += '</tr></table>';
                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._editors_OID).innerHTML = html;
    },

    editors_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._editors_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._editors_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    },

    /* Top 50 Authors */
    _topAuthors_OID: 'topAuthors-container',
    _topAuthors_URL: '/top-authors/_JSON.aspx',
    _topAuthors_CID: 'topAuthors',
    _topAuthors_Items: 4,
    _topAuthors_Category: '0',

    _topAuthors_Populate: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            //html += '<div class="pod-336-rule">';
            html += '<table cellspacing="0" cellpadding="0" class="topAuthors">';

            //var items = 4;

            for (var i = 1; i <= this._topAuthors_Items; i++) {
                if (this._topAuthors_Category == '0') {
                    html += '<tr>';
                    html += '<td class="col1"><div>' + i + '. ' + json[i].Prolific + '</div></td>';
                    html += '<td class="col2"><div>' + (i + this._topAuthors_Items) + '. ' + json[i + this._topAuthors_Items].Prolific + '</div></td>';
                    html += '<td class="col3"><div>' + (i + (this._topAuthors_Items * 2)) + '. ' + json[i + (this._topAuthors_Items * 2)].Prolific + '</div></td>';
                    html += '<td class="col4"><div>' + (i + (this._topAuthors_Items * 3)) + '. ' + json[i + (this._topAuthors_Items * 3)].Prolific + '</div></td>';
                    //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific + '</span><br />Articles: ' + json[i + 40].PCount + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '1') {
                    html += '<tr>';
                    html += '<td class="col1"><div>' + i + '. ' + json[i].Prolific2000 + '</div></td>';
                    html += '<td class="col2"><div>' + (i + this._topAuthors_Items) + '. ' + json[i + this._topAuthors_Items].Prolific2000 + '</div></td>';
                    html += '<td class="col3"><div>' + (i + (this._topAuthors_Items * 2)) + '. ' + json[i + (this._topAuthors_Items * 2)].Prolific2000 + '</div></td>';
                    html += '<td class="col4"><div>' + (i + (this._topAuthors_Items * 3)) + '. ' + json[i + (this._topAuthors_Items * 3)].Prolific2000 + '</div></td>';
                    //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific2000 + '</span><br />Articles: ' + json[i + 40].P2000Count + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '2') {
                    html += '<tr>';
                    html += '<td class="col1"><div>' + i + '. ' + json[i].Cited + '</div></td>';
                    html += '<td class="col2"><div>' + (i + this._topAuthors_Items) + '. ' + json[i + this._topAuthors_Items].Cited + '</div></td>';
                    html += '<td class="col3"><div>' + (i + (this._topAuthors_Items * 2)) + '. ' + json[i + (this._topAuthors_Items * 2)].Cited + '</div></td>';
                    html += '<td class="col4"><div>' + (i + (this._topAuthors_Items * 3)) + '. ' + json[i + (this._topAuthors_Items * 3)].Cited + '</div></td>';
                    //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited + '</span><br />Cited by: ' + json[i + 40].CCount + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '3') {
                    html += '<tr>';
                    html += '<td class="col1"><div>' + i + '. ' + json[i].Cited2000 + '</div></td>';
                    html += '<td class="col2"><div>' + (i + this._topAuthors_Items) + '. ' + json[i + this._topAuthors_Items].Cited2000 + '</div></td>';
                    html += '<td class="col3"><div>' + (i + (this._topAuthors_Items * 2)) + '. ' + json[i + (this._topAuthors_Items * 2)].Cited2000 + '</div></td>';
                    html += '<td class="col4"><div>' + (i + (this._topAuthors_Items * 3)) + '. ' + json[i + (this._topAuthors_Items * 3)].Cited2000 + '</div></td>';
                    //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited2000 + '</span><br />Cited by: ' + json[i + 40].C2000Count + '</div></td>';
                    html += '</tr>';
                }
                /*if (this._topAuthors_Category == '0') {
                html += '<tr>';
                html += '<td class="col1"><div><span style="color: #10387b;">' + i + '. ' + json[i].Prolific + '</span><br />Articles: ' + json[i].PCount + '</div></td>';
                html += '<td class="col2"><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Prolific + '</span><br />Articles: ' + json[i + 10].PCount + '</div></td>';
                html += '<td class="col3"><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Prolific + '</span><br />Articles: ' + json[i + 20].PCount + '</div></td>';
                html += '<td class="col4"><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Prolific + '</span><br />Articles: ' + json[i + 30].PCount + '</div></td>';
                //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific + '</span><br />Articles: ' + json[i + 40].PCount + '</div></td>';
                html += '</tr>';
                } else if (this._topAuthors_Category == '1') {
                html += '<tr>';
                html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Prolific2000 + '</span><br />Articles: ' + json[i].P2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Prolific2000 + '</span><br />Articles: ' + json[i + 10].P2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Prolific2000 + '</span><br />Articles: ' + json[i + 20].P2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Prolific2000 + '</span><br />Articles: ' + json[i + 30].P2000Count + '</div></td>';
                //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific2000 + '</span><br />Articles: ' + json[i + 40].P2000Count + '</div></td>';
                html += '</tr>';
                } else if (this._topAuthors_Category == '2') {
                html += '<tr>';
                html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Cited + '</span><br />Cited by: ' + json[i].CCount + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Cited + '</span><br />Cited by: ' + json[i + 10].CCount + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Cited + '</span><br />Cited by: ' + json[i + 20].CCount + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Cited + '</span><br />Cited by: ' + json[i + 30].CCount + '</div></td>';
                //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited + '</span><br />Cited by: ' + json[i + 40].CCount + '</div></td>';
                html += '</tr>';
                } else if (this._topAuthors_Category == '3') {
                html += '<tr>';
                html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Cited2000 + '</span><br />Cited by: ' + json[i].C2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Cited2000 + '</span><br />Cited by: ' + json[i + 10].C2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Cited2000 + '</span><br />Cited by: ' + json[i + 20].C2000Count + '</div></td>';
                html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Cited2000 + '</span><br />Cited by: ' + json[i + 30].C2000Count + '</div></td>';
                //html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited2000 + '</span><br />Cited by: ' + json[i + 40].C2000Count + '</div></td>';
                html += '</tr>';
                }*/
            }

            html += '</table>';
            //html += '</div>';


            /*var cid = this._topAuthors_CID;
            var cache = this._getCachedValue(cid);
            var json = eval('(' + cache + ')');

        var html = '';

        if (this._topAuthors_Items <= json[0].pageItems) {
            html += '<table cellspacing="0" cellpadding="0" class="topAuthors">';
            html += '<tr>';
            html += '<th class="col1"><div>Prolific<br />All Time</div></th>';
            html += '<th class="col2"><div>Prolific<br />2000-2008</div></th>';
            html += '<th class="col3"><div>Most Cited<br />All Time</div></th>';
            html += '<th class="col4"><div>Most Cited<br />2000-2008</div></th>';
            html += '</tr>';

            for (var i = 1; i < this._topAuthors_Items; i++) {
            html += '<tr>';
            html += '<td class="col1"><div>' + i + '. ' + json[i].Prolific + '</div></td>';
            html += '<td class="col2"><div>' + i + '. ' + json[i].Prolific2000 + '</div></td>';
            html += '<td class="col3"><div>' + i + '. ' + json[i].Cited + '</div></td>';
            html += '<td class="col4"><div>' + i + '. ' + json[i].Cited2000 + '</div></td>';
            html += '</tr>';
            }

            html += '</table>';*/

            $(this._topAuthors_OID).innerHTML = html;
        } else {
            document.location = '/top-authors/';
        }
    },

    topAuthors_Populate: function() {
        var cid = this._topAuthors_CID;
        var cache = this._getCachedValue(cid);

        if (cache == null) {
            var trans = this._createTransport();
            var url = this._topAuthors_URL;

            trans.open('get', url, true);
            trans.onreadystatechange = function() {
                if (trans.readyState == 4) {
                    if (trans.status == 200) {
                        //polymer._saveCacheValue(trans.responseText, cid);
                        polymer._topAuthors_Populate(trans.responseText);
                    }
                }
            }

            trans.send(null);
        } else {
            this._topAuthors_Populate();
        }
    },

    topAuthors_ChangeYear: function(YearTo, tabId) {
        this._topAuthors_Category = YearTo;
        this.topAuthors_Populate();

        this._setTab('topAuthors_Tabs', tabId);

        return false;
    },

    topAuthors_More: function(dir) {
        var currItems = parseInt(this._topAuthors_Items);
        currItems = currItems + dir;
        if (currItems >= 4) {
            this._topAuthors_Items = currItems;
            this.topAuthors_Populate();
        }

        return false;
    },

    _topAuthors_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            html += '<div class="pod-680-rule">';
            html += '<table cellspacing="0" cellpadding="0" class="topAuthors">';

            for (var i = 1; i <= 10; i++) {
                if (this._topAuthors_Category == '0') {
                    html += '<tr>';
                    html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Prolific + '</span><br />Articles: ' + json[i].PCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Prolific + '</span><br />Articles: ' + json[i + 10].PCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Prolific + '</span><br />Articles: ' + json[i + 20].PCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Prolific + '</span><br />Articles: ' + json[i + 30].PCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific + '</span><br />Articles: ' + json[i + 40].PCount + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '1') {
                    html += '<tr>';
                    html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Prolific2000 + '</span><br />Articles: ' + json[i].P2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Prolific2000 + '</span><br />Articles: ' + json[i + 10].P2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Prolific2000 + '</span><br />Articles: ' + json[i + 20].P2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Prolific2000 + '</span><br />Articles: ' + json[i + 30].P2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Prolific2000 + '</span><br />Articles: ' + json[i + 40].P2000Count + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '2') {
                    html += '<tr>';
                    html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Cited + '</span><br />Cited by: ' + json[i].CCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Cited + '</span><br />Cited by: ' + json[i + 10].CCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Cited + '</span><br />Cited by: ' + json[i + 20].CCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Cited + '</span><br />Cited by: ' + json[i + 30].CCount + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited + '</span><br />Cited by: ' + json[i + 40].CCount + '</div></td>';
                    html += '</tr>';
                } else if (this._topAuthors_Category == '3') {
                    html += '<tr>';
                    html += '<td><div><span style="color: #10387b;">' + i + '. ' + json[i].Cited2000 + '</span><br />Cited by: ' + json[i].C2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 10) + '. ' + json[i + 10].Cited2000 + '</span><br />Cited by: ' + json[i + 10].C2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 20) + '. ' + json[i + 20].Cited2000 + '</span><br />Cited by: ' + json[i + 20].C2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 30) + '. ' + json[i + 30].Cited2000 + '</span><br />Cited by: ' + json[i + 30].C2000Count + '</div></td>';
                    html += '<td><div><span style="color: #10387b;">' + (i + 40) + '. ' + json[i + 40].Cited2000 + '</span><br />Cited by: ' + json[i + 40].C2000Count + '</div></td>';
                    html += '</tr>';
                }
            }

            html += '</table>';
            html += '</div>';
        }

        $(this._topAuthors_OID).innerHTML = html;
    },

    topAuthors_PopulateSub: function(page) {
        var trans = this._createTransport();
        var url = this._topAuthors_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._topAuthors_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    },

    topAuthors_ChangeYearSub: function(YearTo, tabId) {
        this._topAuthors_Category = YearTo;
        this.topAuthors_PopulateSub(0);

        this._setTab('topAuthors_Tabs', tabId);

        return false;
    },

    /* Journals */
    _journals_OID: 'journals-container',
    _journals_URL: '/polymer-journals/_JSON.aspx',

    _journals_PopulateSub: function(respText) {
        var html = '';
        var json = eval('(' + respText + ')');
        var pagerHtml = '';

        if (json.length > 0) {
            var startVal = parseInt(json[0].pageSize) * parseInt(json[0].currentPageIndex) + 1;

            var endVal = startVal + parseInt(json[0].pageItems) - 1;

            var currPage = parseInt(json[0].currentPageIndex) + 1;

            pagerHtml += '<div class="pod-680-rule">';
            pagerHtml += '<div style="float: right;">';

            if (currPage > 1)
                pagerHtml += '<a href="#" onclick="return polymer.journals_PopulateSub(\'' + parseInt(currPage - 2) + '\')">Previous</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Previous</span>';

            pagerHtml += ' | Page <strong>' + currPage + ' of ' + json[0].pageCount + '</strong> | ';

            if (currPage < json[0].pageCount)
                pagerHtml += '<a href="#" onclick="return polymer.journals_PopulateSub(\'' + currPage + '\')">Next</a>';
            else
                pagerHtml += '<span style="color: #d3dce9;">Next</span>';

            pagerHtml += '</div>';
            pagerHtml += 'Showing <strong>' + startVal + ' - ' + endVal + '</strong> of ' + json[0].totalItems + ' results';
            pagerHtml += '</div>';

            html += pagerHtml;

            for (var i = 1; i < json.length; i++) {
                html += '<div class="pod-680-rule">';
                html += '<table cellspacing="0" cellpadding="0" style="width: 100%;"><tr>';
                html += '<td style="padding: 0px 10px 0px 0px; width: 75px; vertical-align: top;"><a href="http://www.elsevier.com/locate/issn/' + json[i].ISSN + '" target="_blank"><img src="/_common/img/journals/' + json[i].ISSN + '.gif" alt="' + json[i].Journal + '" width="122" height="166" /></a></td>';
                html += '<td style="vertical-align: top;">';

                if (json[i].Graph != '')
                    html += '<span style="float: right;"><a href="/_common/img/graphs/' + json[i].Graph + '" target="_blank" title="Impact Factor for ' + json[i].Journal + '" onclick="return graph_Show(this.href, this.title);">View Impact Factor <img src="/_common/img/icon-graph.gif" alt="" style="vertical-align: middle; padding-left: 5px;" /></a></span>';

                html += '<h2><a href="http://www.elsevier.com/locate/issn/' + json[i].ISSN + '" target="_blank">' + json[i].Journal + '</a></h2>';

                if (parseFloat(json[i].ImpactFactor) > 0.0000)
                    html += '<p><strong>Impact Factor:</strong> ' + json[i].ImpactFactor + '</p>';
                else
                    html += '<br />';

                html += '<p>' + json[i].Description + ' <a href="http://www.elsevier.com/locate/issn/' + json[i].ISSN + '" target="_blank">find out more</a></p></td>';
                html += '</tr></table>';
                html += '</div>';
            }

            html += pagerHtml;
        }

        $(this._journals_OID).innerHTML = html;
    },

    journals_PopulateSub: function(page) {

        var trans = this._createTransport();
        var url = this._journals_URL;
        url = url + '?CurrentPageIndex=' + page;

        trans.open('get', url, true);
        trans.onreadystatechange = function() {
            if (trans.readyState == 4) {
                if (trans.status == 200) {
                    polymer._journals_PopulateSub(trans.responseText);
                }
            }
        }

        trans.send(null);
    }
}