// functions for powering the page navigation of card categories
// @author          Mike Pirnat
// @created         07/29/2003
// @lastmodified    07/29/2003

function FetchL2(strPath, strURL) {
    // jump to another path
    // @param   strPath     path to jump to
    // @param   strURL      (opt) page to jump to other than '/category.pd'
    if (strPath != "") {
        strQuery = "path=" + strPath;
        if (strURL)  {
            strURL += strQuery;
        } else {
            strURL = '/category.pd?' + strQuery;
        }
        //hack where a url is passed in as the first arg
        if(strPath.indexOf(".pd") > 0) {
            strURL = strPath
        }
        window.self.location.href = strURL;
    }
}

function setDisplayPage(i) {
    // jump to another page in this path/bucket of cards
    // @param   i           page number to jump to
    strHref=window.self.location.href;
    if(strHref.indexOf("adisplay") > 0) {
        strPattern =  "adisplay=[";
        strPattern += "0-9]+";
        pattern = new RegExp(strPattern);
        strHref = strHref.replace(pattern,"adisplay="+i);
    } else {
        if(strHref.lastIndexOf("&") == strHref.length-1) {
            strHref += "adisplay=" + i;
        } else {
            strHref += "&adisplay=" + i;
        }
    }
    window.self.location.href = strHref;
}

