var Nav4 = ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4));
var dialogWin = new Object();
      
function openDGDialog(url, width, height, returnFunc, args) {
    if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
        // Initialize properties of the modal dialog object.
        dialogWin.returnFunc = returnFunc
        dialogWin.returnedValue = ''
        dialogWin.args = args
        dialogWin.url = url
        dialogWin.width = width
        dialogWin.height = height
        // Keep name unique so Navigator doesn't overwrite an existing dialog.
        dialogWin.name = (new Date()).getSeconds().toString()
        // Assemble window attributes and try to center the dialog.
        if (Nav4) {
            // Center on the main window.
            dialogWin.left = window.screenX + 
            ((window.outerWidth - dialogWin.width) / 2)
            dialogWin.top = window.screenY + 
            ((window.outerHeight - dialogWin.height) / 2)
            var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=no,width=' +  dialogWin.width + ',height=' + dialogWin.height
        } else {
            // The best we can do is center in screen.
            dialogWin.left = (screen.width - dialogWin.width) / 2
            dialogWin.top = (screen.height - dialogWin.height) / 2 - 100
            var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=no,width=' + dialogWin.width + ',height=' + dialogWin.height
        }
        // Generate the dialog and make sure it has focus.
        dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr)
        dialogWin.win.focus()
    } else {
        dialogWin.win.focus()
    }
}
function NewWin(file) {
    newwin=window.open(file,'','width=760,height=550status=no,resizable=yes,scrollbars=yes');
}
function MOrder(first,current,second,direction,genre,string,disc) {
    if (current == first) {
      if (direction == 'Asc') direction = 'Desc';
      else direction = 'Asc';
    }
    searcharea.orderby_first.value = first;
    searcharea.orderby_second.value = second;
    searcharea.direction.value = direction;
    searcharea.SearchGenre.value = genre;
    searcharea.SearchString.value = string;
    searcharea.SearchDisk.value = disc;
    searcharea.order_search.value = 1;
    document.searcharea.submit();
}
var bgcolor = '';
function changeBG(order,id) {
    //bgcolor = 'rgb(155, 132, 123)';
    if (order == 'in') {
        bgcolor = document.getElementById(id).style.background;
        bgcolor = bgcolor.substring(0,18);
        document.getElementById(id).style.background='#a7ada6';
    } else if (order == 'out') {
        document.getElementById(id).style.background=bgcolor;
    }
}

function ESearch(id) {
	searcharea.extended.value=id;
	searcharea.submit();
}
