
#import "control.h"

@implementation control

//
// Global variables
//

	int Seconds;      // Used to assign the current seconds from the system clock
	int DisplayTime;  // The amount of time the panel will be displayed



- ChoiceOfDelay:sender
{

     	NSTimer *aTimer;

        // Declares TheCurrentDate variable as a NSCalendarDate
	NSCalendarDate *TheCurrentDate = [NSCalendarDate date];

        // Assigns current system time (seconds) using standard OpenStep API calls
        Seconds = [TheCurrentDate secondOfMinute];
        
	// Calculates the display time
    	DisplayTime = [choixSeconde intValue];


	// Verifies if the DisplayTime will conflict with the minute turn-over    
    	if (DisplayTime >= 60)
        DisplayTime = DisplayTime - 60;


	// Displays the Info Panel
        [InfoPanel center];
        [InfoPanel makeKeyAndOrderFront:self];


        // Registers a new timer with the NSRunLoop object
        // DisplayTime is the amount of time the panel will be displayed
        // autoPanel is the method executed when the timer "rings"
        // userInfo:nil is NOT used at this time
    	aTimer = [NSTimer scheduledTimerWithTimeInterval:(DisplayTime) target:self  selector:@selector(autoPanel:)  userInfo:nil  repeats:NO];

    
        return self;

}


- autoPanel:(id)timer
{
	// Closes the InfoPanel
        [InfoPanel orderOut:self];


    return self;
}



- (void)IntroAndHelp:(id)sender
{
    if (![NSBundle loadNibNamed:@"HelpIntro" owner:self])  {
        NSLog(@"Failed to load HelpIntro.nib");
        NSBeep();
        return;
        }

}


- (void)MoreInfo:(id)sender
{
    if (![NSBundle loadNibNamed:@"MoreInfo" owner:self])  {
        NSLog(@"Failed to load MoreInfo.nib");
        NSBeep();
        return;
        }

}



@end
