/**
 *
 * Script:   appt.js
 * Purpose:  Add Appointment to Outlook Calendar
 * Author:   Brian White
 * Email:   brian@dynoapps.com
 * Date:     April 25, 2000
 * Comments: This is a very basic example of creating
 *           an appointment item in Outlook.  
 *
 * Notes:    To date, little testing has been done
 *           with other versions of Outlook and multiple
 *           profiles.
 *  
 *                             
 * Example:
 * 
 * // Set our values to be inserted into the Appointment 
 * saveAppt("test subject", "this location", "05/26/2000 9:00 AM", "15");
 * 
 * 
 **/

/* Define Outlook constant for Appointment Item */
var olAppointmentItem = 1;


function saveAppt(Subject, Location, Start, ReminderMinutesBeforeStart){
	/* Create the Outlook Object and Appointment Item */
	alert("text");
  	alert(saveAppt);
  	alert(ActiveXObject);
	if (ActiveXObject) {
  	out = new ActiveXObject("Outlook.Application");
  	
  	alert("object X created");
  	
  	if (out) {
  		/* Create an Appointment Item */
				appt = out.CreateItem(olAppointmentItem);
				
				/* Transfer the data */
				appt.Subject = Subject;
				appt.Location = Location;
				appt.Start = Start;
				appt.ReminderMinutesBeforeStart = ReminderMinutesBeforeStart;
				
				/* Display the data */
				appt.Display();
				alert("saving");
				appt.Save();
			/* If you want to save instead of viewing it change to appt.Save();*/
			}
			else {
				alert("Outlook not found");
			}
		} else {
			alert("ActiveX not enabled");
		}
}
