var sel_Sort;
var sel_Type;
var opt_Date;

$(document).ready(function() {
    sel_Sort = $("#strSortBy")[0];
    sel_Sort[2].innerHTML = "Date";
    
    opt_Date = sel_Sort.removeChild(sel_Sort[2]);
    
    sel_Type = $("#strSearchType")[0]

    $(sel_Type).change(function(){ toggleDate(); });
    
    toggleDate();
/*
*/
});

function toggleDate() {
    if ((sel_Sort.length > 2) && (sel_Type[sel_Type.selectedIndex].value.indexOf("WIP") > 0))  {
        sel_Sort.removeChild(opt_Date)
    } else if ((sel_Sort.length == 2) && (sel_Type[sel_Type.selectedIndex].value.indexOf("PUB") > 0)) {
        sel_Sort.appendChild(opt_Date)
    }
}