﻿function fcnChangeResultsPerPage(ctl)
{
    window.location = "Search.aspx?resultcount=" + ctl.value;
}

function fcnChangePageSorting(ctl)
{
    window.location = "Search.aspx?sortby=" + ctl.value;
}

function fcnSaveSelectedResults(strSearch, ctl, doCallback)
{
    var arSelected = document.getElementsByName('addResult');
    var strAddItems = '';
    strAddItems += 'Search:' + strSearch + '%7CList:'; 
    var blnHasSelected = false;
    for(var intCount = 0; intCount < arSelected.length; intCount++)
    {
        if(arSelected[intCount].checked)
        {
            strAddItems += arSelected[intCount].id + '+';
            blnHasSelected = true;
        }
    }
    //invoke callback...
    if(blnHasSelected)
    {
        doCallback(ctl, strAddItems, fcnInvokeScript, '');
    }
    else
    {
        window.alert('You must select a result to save.');
    }
    strAddItems = null;
    arSelected = null;
}

function fcnInvokeScript(strScript)
{
    var fcnDo = new Function(strScript);
    return fcnDo();
}