var Drives = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z");

function PageLoad() 
{
    //set the close event handler
    System.Gadget.onSettingsClosing = onClose;
    
    for(var i = 0; i <= Drives.length; i++) {
        try {
            if(System.Shell.drive(Drives[i]).driveType=="3") {
				ddlDrives.options[ddlDrives.options.length] = new Option(Drives[i] + ":\\ " + System.Shell.drive(Drives[i]).volumeLabel, Drives[i], "", false);
            }
        }
        catch(e) {
            continue;
        }
    }
}

function onClose(event)
{
    if(event.closeAction == event.Action.commit) {
    
        System.Gadget.Settings.write("diskToShow", ddlDrives.options[ddlDrives.selectedIndex].value);
        event.cancel = false;
    }
}