$(document).ready(function() {
    if ($("#left ul li a").hasClass("active"))
        $("#left ul li ul").css("display", "block");
})

function searchFocus(box, text) {
    if (box.value == text) {
        box.value = '';
    }
}

function searchBlur(box, text) {
    if (box.value == '') {
        box.value = text;
    }
}

function popup(url, width, height, winId, scroll) {
    if (winId == null) {
        time = new Date();
        winId = time.getTime().toString();
    }
    if (!winId.substr(0, 3) == 'rn_')
        winId = 'rn_' + winId;
    var wtop = (screen.height - height) / 2 - 30;
    var wleft = (screen.width - width) / 2;
    var ref = window.open(url, winId, 'width=' + width + ',height=' + height + ',top=' + wtop + ',left=' + wleft +
              ',resizable=yes,scrollbars=' + (scroll ? 'yes' : 'no') + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,copyhistory=no');
    ref.focus();
}

function preUpload(id)
{
    var form = document.forms['aspnetForm'];
    var action = document.getElementById(id + '_Action');
    var target = form.target;

    // Set values
    action.value = 'upload';    
    form.target = id + '_Target';
    
    // Submit form
    form.submit();

    // Restore values
    action.value = '';
    form.target = target;
}

function postUpload(id, filename)
{
    var hidden = document.getElementById(id + '_SlickBack');
    var slickback = hidden.value.replace("__FILE__", filename);

    eval(slickback);
}