<!--
// We have 2 sets of program, but we register one set only, depending on our category.
// So we have to get the category and page/item first.

function getRangeValue(val, lower, upper) {
    var i = parseInt(val);
    if (isNaN(i) || i<lower) i = lower;
    else if (i>upper) i = upper;
    return i;
}

var myLoc = window.location.href;
var idx = myLoc.lastIndexOf("/");
myLoc = myLoc.substring(++idx);

var s = myLoc;
if (s=="wipo_cat.htm") {            // 1st level main file?
    isMain = true;
} else {
    isMain = false;
    idx = s.indexOf("symposium_cat_");
    if (idx>=0) {                   // a cat file, must be symposium_cat_x_y.htm
        isCat = true;
        valArr = s.substring("symposium_cat_".length).split("_");
    } else {                        // a content file, must be tv_video_x_y.htm
        isCat = false;
        valArr = s.substring("symposium_video_".length).split("_");
    }
    cat = parseInt(valArr[0]);
    if (isNaN(cat) || cat<0) cat = 0;
}

if (isMain) {       // register the symposiums, not programs
    // I register symposiums directly here as their number is small
    var prog = new Array();     // program title
    var date = new Array();     // date of program
    var image = new Array();    // image
    // define the programs
    prog[0] = "APEC IPR Public Education and Awareness Platform - Workshop on Effective Strategies for IPR Public Education";
    date[0] = "8-10 November 2006 Hong Kong, China";
    image[0] = "apec01.jpg";
    prog[1] = "2004 WIPO Regional Symposium on Copyright in Educational Institutions and Libraries in the Digital Era";
    date[1] = "15-16 March, 2004 Hong Kong, China";
    image[1] = "wipo01.jpg";
    // I just hard-code here.  If there are more than one page later, we may calculate it
    start = 0;
    end = 2;
} else {                            // symposium_cat or symposium_video
    // now register the programs
    var prog = new Array();         // prog id
    var title1 = new Array();       // full title part1
    var title2 = new Array();       // full title part2
    var stitle = new Array();       // short title
    var isPPT = new Array();        // is this is a ppt file
    var isEngOnly = new Array();    // is English only

    function registerProg(p, t1, t2, s, PPT, EngOnly) {
        var curIdx = prog.length;
        prog[curIdx] = p;
        title1[curIdx] = t1;
        title2[curIdx] = t2;
        stitle[curIdx] = s;
        isPPT[curIdx] = PPT;
        isEngOnly[curIdx] = EngOnly;
    }
    //
    // actually register the programs, add new program of each category at end of list
    //
    switch (cat) {
    case 1:         // 2004 WIPO Regional Symposium on Copyright
        registerProg("wipo01", "Opening Remarks", "by Mr. Stephen Selby ", "Opening Remarks by Mr. Stephen ... ", false, true );
        registerProg("wipo02", "Opening Remarks", "by Mr. Candra N. Darusman ", "Opening Remarks by Mr. Candra... ", false, true );
        registerProg("wipo03", "Theme I:", "Overview of Copyright Issues by Ms. Geidy Lung ", "Theme I:Overview of Copyright... ", false, true );
        registerProg("wipo03", "Theme I:", "Overview of Copyright Issues by Ms. Geidy Lung ", "Theme I:Overview of ...(PPT) ", true, true );
        registerProg("wipo04", "Theme II:", "Copyright for Educational Institutions and Libraries in Developing Countries ", "Theme II:Copyright for... ", false, true );
        registerProg("wipo05", "Theme III:", "Application of the &quot;Three-Step Test&quot; by Professor Sam Ricketson ", "Theme III:Application of the... ", false, true );
        registerProg("wipo05", "Theme III:", "Application of the &quot;Three-Step Test&quot; by Professor Sam Ricketson ", "Theme III:Application ...(PPT) ", true, true );
        registerProg("wipo06", "Theme IV:", "The Role of Libraries as Information Providers in the Digital Era by Dr.Colin Storey and Ms. Shirley Leung ", "Theme IV:The Role of Libraries... ", false, true );
        registerProg("wipo06", "Theme IV:", "The Role of Libraries as Information Providers in the Digital Era by Dr.Colin Storey and Ms. Shirley Leung ", "Theme IV:The Role of ...(PPT) ", true, true );
        registerProg("wipo07", "Theme V:", "Copyright Protection Systems and Digital Rights Management:<br> Exemptions for Educational Institutions and Libraries?<br> (Panel Discussion) ", "Theme V:Copyright Protection... ", false, true );
        registerProg("wipo08", "Theme VI:", "Present Situation in China and Hong Kong SAR with regard to Copyright Issues for Educational Institutions and Libraries<br> By Mr. Shen Rengan ", "Theme VI:Present Situation in... ", false, true );
        registerProg("wipo09", "Theme VI:", "Present Situation in China and Hong Kong SAR with regard to Copyright Issues for Educational Institutions and Libraries<br> By Mr. Stephen Selby ", "Theme VI:Present Situation in... ", false, true );
        registerProg("wipo09", "Theme VI:", "Present Situation in China and Hong Kong SAR with regard to Copyright Issues for Educational Institutions and Libraries<br> By Mr. Stephen Selby ", "Theme VI:Present Situation...(PPT) ", true, true );
        registerProg("wipo10", "Theme VII:", "Different Models of Limitations and Exceptions: Free Uses, Legal Licenses, Compulsory Licenses and Extended Collective Licenses by Professor Bernt Hugenholtz ", "Theme VII:Different Models of... ", false, true );
        registerProg("wipo10", "Theme VII:", "Different Models of Limitations and Exceptions: Free Uses, Legal Licenses, Compulsory Licenses and Extended Collective Licenses by Professor Bernt Hugenholtz ", "Theme VII:Different Models...(PPT) ", true, true );
        registerProg("wipo11", "Theme VIII:", "Internet and Digital Licenses for Educational Institutions and Libraries by Mr. Fred Armentrout ", "Theme VIII:Internet by Digital... ", false, true );
        registerProg("wipo12", "Theme VIII:", "Internet and Digital Licenses for Educational Institutions and Libraries by Ms. Ute Decker ", "Theme VIII:Internet by Digital... ", false, true );
        registerProg("wipo12", "Theme VIII:", "Internet and Digital Licenses for Educational Institutions and Libraries by Ms. Ute Decker ", "Theme VIII:Internet by...(PPT) ", true, true );
        registerProg("wipo13", "Theme VIII:", "Internet and Digital Licenses for Educational Institutions and Libraries by Dr. Collin Storey ", "Theme VIII:Internet by Digital... ", false, true );
        registerProg("wipo14", "Theme VIII:", "Experience of the United States by Marybeth Peters ", "Theme VIII:Experience of the... ", false, true );
        registerProg("wipo15", "Theme VIII:", "Experience of Japan by Mr. Samuel S. Masuyama ", "Theme VIII:Experience of Japan... ", false, true );
        registerProg("wipo16", "Theme IX:", "The State of Copyright and Related Rights vis a vis</i> EducationalInstitutions and Libraries:<br> A way Forward to Strike a Balance<br> (Panel Discussion) ", "Theme IX:The State of Copyright...", false, true );
        registerProg("wipo17", "Closing Remarks", "by Mr. Stephen Selby ", "Closing Remarks by Mr. Stephen... ", false, true );
        registerProg("wipo18", "Closing Remarks", "by Mr. Candra N. Darusman", "Closing Remarks by Mr. Candra... ", false, true );
        break;
    default:        // others default to 0, APEC IPR Public Education and Awareness Platform
        registerProg("apec01", "Opening Remarks", "Remarks by Ms CHOI Ying Pik, Yvonne", "Opening Remarks by...", false, true);
        registerProg("apec02", "Opening Remarks", "Remarks by Mr. Sivakant TIWARI", "Opening Remarks by ...", false, true);
        registerProg("apec03", "Theme 1", "The Based Economy and in Developing Creative Industries Challenges and Opportunities by Mr. Jeffrey HARDEE ", "Theme 1 The Critical...", false, true);
        registerProg("apec04", "Theme 1", "The Based Economy and in Developing Creative Industries Challenges and Opportunities by Mr. Stephen SELBY ", "Theme 1 The Critical...", false, true);
        registerProg("apec05", "Theme 1", "The Based Economy and in Developing Creative Industries Challenges and Opportunities (Questions and Answers Session) ", "Theme 1 The Critical...", false, true);
        registerProg("apec06", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Part 1: Developing Strategies for IP Public Awareness Campaigns by Mr. Peter WILLIMOTT", "Theme 2 Planning ...", false, true);
        registerProg("apec07", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Part 1: Developing Strategies for IP Public Awareness Campaigns by Ms. LEONG May Seey", "Theme 2 Planning ... ", false, true);
        registerProg("apec08", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Part 1: Developing Strategies for IP Public Awareness Campaigns (Questions and Answers Session)", "Theme 2 Planning ...", false, true);
        registerProg("apec09", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Part 2: Effective Use of Communication Tools for Public Awareness Programs by Mr. Royce YUEN", "Theme 2 Planning ...", false, true);
        registerProg("apec10", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Part 2: Effective Use of Communication Tools for Public Awareness Programs (Questions and Answers Session)", "Theme 2 Planning ...", false, true);
        registerProg("apec11", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (i) Focus: Small and Medium Enterprises by Mr. Stuart McLENNAN ", "Theme 2 Planning ... ", false, true);
        registerProg("apec12", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (i) Focus: Small and Medium Enterprises (Panel Discussion)", "Theme 2 Planning ....", false, true);
        registerProg("apec13", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (ii) Focus: Youth by Ms. Jenny WONG", "Theme 2 Planning ...", false, true);
        registerProg("apec14", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (ii) Focus: Youth (Panel Discussion)", "Theme 2 Planning ...", false, true);
        registerProg("apec15", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (iii) Focus: General Public by Ms. Jennifer CHEN", "Theme 2 Planning ... ", false, true);
        registerProg("apec16", "Theme 2", "Planning and Implementation of Effective IP Public Education/Awareness Campaigns Private Partnership in Public Education Sharing of Case Studies on Different Target Audiences (iii) Focus: General Public (Panel Discussion)", "Theme 2 Planning ...", false, true);
        registerProg("apec17", "Theme 3", "Measuring the Effectiveness of Public Education Programs by Mr. Marc NICHOLSON", "Theme 3 Measuring the ... ", false, true);
        registerProg("apec18", "Theme 3", "Measuring the Effectiveness of Public Education Programs (Panel Discussion)", "Theme 3 Measuring the ...", false, true);
        registerProg("apec19", "Theme 4", "Way Regional Cooperation on Setting Up Common IP Values and Best Practices as well as Sharing of Resources Demonstration of Online Communication Platform by Ms. Kate NORRIS", "Theme 4 Way Forward...", false, true);
        registerProg("apec20", "Theme 4", "Way Regional Cooperation on Setting Up Common IP Values and Best Practices as well as Sharing of Resources (ii) Project Way Forward by Ms. Jennifer CHEN", "Theme 4 Way Forward -", false, true);
        registerProg("apec21", "Theme 4", "Way Regional Cooperation on Setting Up Common IP Values and Best Practices as well as Sharing of Resources (iii) Panel Discussion", "Theme 4 Way Forward -...", false, true);
        registerProg("apec22", "Closing Speech", "Speech by Mr. Stephen SELBY", "Closing Speech...", false, true);
        registerProg("apec23", "Closing Speech", "Speech by Mr. Ian GOSS", "Closing Speech...", false, true);
        registerProg("apec24", "Closing Speech", "by Ms. LIEW Woon Yin", "Closing Speech...", false, true);
    }   // end switch
    // end register

    // calculate which one to display according to my page number
    var pageView = 3;
    if (isCat) {        // get page number
        var lastPage = Math.ceil(prog.length/pageView);
        var p = getRangeValue(valArr[1], 1, lastPage);
        var max = p * pageView;
        // var start = prog.length - max + pageView -1 ;
        var start = max - pageView;
        if (p<lastPage) {                               // simple case
            var end = max;
            var lastPage = (max==prog.length);
        } else {                                        // last page
            var end = prog.length;
            var lastPage = true;
        }
    } else id = getRangeValue(valArr[1], 0, prog.length-1);
}
//-->