function redirectToPage(page){
    window.location = page;
}

function redirectToPageTimer(page, ms){
    if(ms == 0){
        ms=2000;
    }
    setTimeout('redirectToPage("' + page + '")', ms);
}

function filterToPage(pageNumberInputName, filterFormName, pageNum){
    inputName = "#" + pageNumberInputName;
    $(inputName).val(pageNum);
    formName = "#" + filterFormName;
    $(formName).submit();
}

function confirmation(message, location) {
    var answer = confirm(message);
    if (answer){
            window.location = location;
    }
}

function textCounter(field,cntfield,maxlimit) {
    if (field.value.length > maxlimit) // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
    // otherwise, update 'characters left' counter
    else
        cntfield.value = maxlimit - field.value.length;
}

function handlePagingClick(id,url)
{
    $(id).load(url);
}

function reloadElement(id,url)
{
    $(id).load(url);
}

// If you can do this server side do so!
function removeMSWordChars(str) {
    var myReplacements = new Array();
    var myCode, intReplacement;
    myReplacements[8216] = 39;
    myReplacements[8217] = 39;
    myReplacements[8220] = 34;
    myReplacements[8221] = 34;
    myReplacements[8212] = 45;
    myReplacements[8211] = 45;
    for(c=0; c<str.length; c++) {
        var myCode = str.charCodeAt(c);
        //alert("c : " + str.charAt(c) + ", myCode : " + myCode);
        if(myReplacements[myCode] != undefined) {
            intReplacement = myReplacements[myCode];
            str = str.substr(0,c) + String.fromCharCode(intReplacement) + str.substr(c+1);
        }
    }
    return str;
}