function ssw_selectDay(inputdd, inputmm, inputyy ,day, month, year, err)
{
    $(inputdd).value= day;
    $(inputyy).value= year;
    $(inputmm).value= month;

    if($(err)) Element.hide($(err));
    $j('#cw .highlight').each(function() {$j(this).removeClass('selected');})
    $j('#day'+day).addClass('selected');
}

function reset_Autoselect (url, id) {
    $j.getJSON(url, 
        function(data) {
            if(data){
                $j('#'+id).eq(0).value = '';
                $j('#'+id).unbind().autocomplete(data, {matchContains: true, minChars: 0 });
            }
        }
    );
}

function capitalize_field(input)
{if(input.value) input.value=input.value.charAt(0).toUpperCase()+input.value.substr(1)}

function generateRoomList(container, prefix, start_index, end_index, suffix)
{
    container.val('');
    if(start_index >= end_index)
        return;
    
    var str='';
    for(var i=start_index; i<=end_index; i++) {
        str+=prefix+i+suffix+'\n';
    }
    container.val(str);
}

function save_ordering(selector, category_val, url)
{
    if(confirm('Are you sure of this ordering?'))
    {
        var ordering = $j(selector).map(function(){return this.id;}).get().reverse().join(",");
        $j.post(url,
            {order : ordering, category: category_val}
        );
    }
}

function passwordConfirm()
{
    var pw = prompt('Please enter password:');
    var response = jQuery.ajax({
        url: "/Auth/AjaxPasswordConfirm.ashx",
        async: false,
        data : "password="+pw
    }).responseText;
    
    if(Boolean(response)) {
        return true;
    } else {
        alert('Password Incorrect!');
        return false;
    }
}