function setHeadlinesPerPage(selectElem) {
    ajax("services/setmychannelprops.php", "&hlpp="+selectElem.value, handlePageRefresh);
}
function setChannelsPerPage(selectElem) {
    ajax("services/setmychannelprops.php", "&chpp="+selectElem.value, handlePageRefresh);
}
function setPageNumber(pageNum) {
    ajax("services/setmychannelprops.php", "&page="+pageNum, handlePageRefresh);
}
function setHeadlineCompression(level) {
    hlCompressionSetting = level;
    ajax("services/setmychannelprops.php", "&comp="+level, changeHLCompression);
}
function handlePageRefresh(returnContents) {
    //pageFlip("my");
    window.location.href = window.location.href;
}
function changeHLCompression(contents) {
    var channelNum;
    var hlNum;
    var urlElem;
    var chElem;
    var synopsisElem;
    var imgElem;
    var level = hlCompressionSetting;
    
    for (channelNum=1;channelNum<200;channelNum++) {
        // Is there a channel
        chElem = document.getElementById("channel-content-"+channelNum);
        if (chElem == null) break;
        for (hlNum = 0; hlNum < 200; hlNum++) {
            urlElem = document.getElementById("url-"+channelNum+"-"+hlNum);
            hlTwist = document.getElementById("hltwist-"+channelNum+"-"+hlNum);
            synopsisElem = document.getElementById("content-"+channelNum+"-"+hlNum);
            imgElem = document.getElementById("img-"+channelNum+"-"+hlNum);
            editHLElem = document.getElementById("editheadline-"+channelNum+"-"+hlNum);
            emailHLElem = document.getElementById("emailheadline-"+channelNum+"-"+hlNum);
            if ((urlElem == null) || (synopsisElem == null)) break;
            if (level == 1) {
                // Show all
                // Show the URL
                urlElem.className = "topic-stat";
                // Show the synopsis
                synopsisElem.className = "topic-stat";
                // HL twist is open
                hlTwist.className = "topic-collapse";
                // Show the image, if there is one
                if (imgElem != null) {
                    imgElem.className = "imgChanger";
                }
                if (editHLElem) editHLElem.className = "edit-headline";
                emailHLElem.className = "email-headline";
            } else if (level == 2) {
                // Hide URL and Images
                // Hide the URL
                urlElem.className = "topic-stat-closed";
                // Show the synopsis
                synopsisElem.className = "topic-stat";
                // HL twist is open
                hlTwist.className = "topic-collapse";
                if (imgElem != null) {
                    imgElem.className = "imgChanger-closed";
                }
                if (editHLElem) editHLElem.className = "edit-headline";
                emailHLElem.className = "email-headline";
            } else if (level == 3) {
                // Hide the URL, Images, and synopsis
                urlElem.className = "topic-stat-closed";
                // Hide the synopsis
                synopsisElem.className = "topic-stat-closed";
                // HL twist is closed
                hlTwist.className = "topic-collapse-closed";
                if (imgElem != null) {
                    imgElem.className = "imgChanger-closed";
                }
                if (editHLElem) editHLElem.className = "edit-headline-closed";
                emailHLElem.className = "email-headline-closed";
            } 
        }
    }
}


