<!--//
/*
'_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
'_/ This Microsoft Agent Script Template was generated by
'_/ MASH 4.5 - The Microsoft Agent Scripting Helper
'_/ Copyright 1998-2000 by BellCraft Technologies (Gordon Scott Bell)
'_/ This copyright notice may not be removed without permission.
'_/ Visit the MASH Web Site at http://www.bellcraft.com/mash
'_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/

// * Character Objects
var Judd;

// * Variables
var UsedChars;
var JuddID;
var JuddACS;
var JuddLoaded;
var LoadReq;
var HideReq;

// * Initialize
UsedChars = "Judd";

// * Judd
JuddID = "Judd";
JuddACS = "Judd.acs";
JuddLoaded = false;


function Window_OnLoad() {
    // Purpose:  Runs automatically when page is loaded

    // * INSERT ANY NON-AGENT RELATED SCRIPTING HERE

    AgentControl.Connected = true;

    JuddLoaded = LoadLocalAgent(JuddID, JuddACS);

    if (JuddLoaded) {
        SetCharObj();
    }
    CheckLoadStatus();
}

function LoadLocalAgent(CharID, CharACS) {
    // Purpose:  Attempts to load the specified character
    // Returns:  true if successful, false if not

    AgentControl.RaiseRequestErrors = false;
    LoadReq = AgentControl.Characters.Load(CharID, CharACS);
    AgentControl.RaiseRequestErrors = true;

    if (LoadReq.Status != 1) {
        return(true);
    }
    return(false);
}

function SetCharObj() {
    // Purpose:  Sets the character reference and TTS Language ID

    Judd = AgentControl.Characters.Character(JuddID);
    Judd.LanguageID = 0x409;
}

function CheckLoadStatus() {
    // Purpose:  Determines if required characters have been loaded.
    //           If not, issue request to load next character
    //           else run the AgentIntro routine

    if (!JuddLoaded) {
        LoadError();
        return(false);
    }

    window.status = "";
    AgentIntro();
    return(true);
}

function LoadError() {
    var strMsg;
    window.status = "";
    strMsg = "Error Loading Character: " + JuddID + "\n";
    strMsg = strMsg + "This Microsoft Agent Script requires the character(s):\n";
    strMsg = strMsg + UsedChars;
    alert(strMsg);
}
function GetDay() {
    // Purpose:  Returns current weekday name
    var aDay = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    var d;
    d = new Date();
    return(aDay[d.getDay()]);
}

function GetDate() {
    // Purpose:  Returns current long date
    var aMon = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
    var d = new Date();
    var sDay = d.getDate().toString();
    var sYear = d.getYear();

    if (sYear < 100)
        sYear += 1900;
    
    if ((sDay == "11") || (sDay == "12") || (sDay == "13"))
        sDay += "th";
    else {
        switch(sDay.charAt(sDay.length - 1)) {
        case "1": sDay += "st"; break;
        case "2": sDay += "nd"; break;
        case "3": sDay += "rd"; break;
        default : sDay += "th"; break;
        }
    }

    return(aMon[d.getMonth()] + " " + sDay + ", " + sYear);
}

function GetTime() {
    // Purpose:  Returns current time
    var d = new Date();
    var h = d.getHours();
    var m = d.getMinutes().toString();
    var c = (h < 12) ? " AM" : " PM";

    h = (h == 0) ? 12 : h;
    h = (h > 12) ? h - 12 : h;
    
    if (m.length == 1)
        m = "0" + m;

    return(h + ":" + m + c);
}

function GetTimeOfDay() {
    // Purpose:  Returns current time of day
    var d = new Date();
    var h = d.getHours();

    if (h < 12)
        return("Morning");
    else if (h < 17)
        return("Afternoon");
    else
        return("Evening");
}

function InitAgentCommands() {
    // Purpose:  Initialize the Commands menu

    Judd.Commands.RemoveAll();
    Judd.Commands.Caption = "My Menu Name";
    Judd.Commands.Add("ACO", "Advanced Character Options", "Advanced Character Options");
}

function AgentIntro() {
    InitAgentCommands();

    // *** BEGIN MASH USER SCRIPT ***

    Judd.Show();
    Judd.MoveTo(620, 293);
    Judd.Play("Announce");
    Judd.Speak("Welcome to John Taylor's Web Site.");
    Judd.Speak("Good " + GetTimeOfDay() + "!  It is " + GetTime() + " on " + GetDay() + ", " + "Two-thousand one.");
    Judd.Speak("If I annoy you, please just right click on me and click hide and I will disappear from your screen.");
    
    Judd.Play("Process");
       
    
    Judd.MoveTo(-46, 13);
    Judd.Play("GlanceDown");
    Judd.Play("GestureDown");
    Judd.Speak("Below me is a menu which will take you to the course you are taking or other places of interest.");
    Judd.MoveTo(497, 290);
    Judd.Play("Greet");
    
    
    
    Judd.Play("Suggest");
    Judd.Play("GlanceRight");
    Judd.Play("GestureRight");
    Judd.Speak("If you click on the logo you will be linked to the H.C.C. web site.");
    Judd.MoveTo(554, 489);
    Judd.Play("GetAttention");
    Judd.Speak("Listen carefully!");
    Judd.Play("GlanceRight");
    Judd.Play("GestureRight");
    Judd.Play("Confused");
    Judd.Think("Are you confused?");
    Judd.MoveTo(312, 540);
    Judd.Play("GestureUp");
    Judd.Play("DoMagic1");
    Judd.Play("DoMagic2");
       
    Judd.MoveTo(92, 590);
    Judd.Play("GestureLeft");
    Judd.Speak("If you click on the Brandon Campus link you will get to Brandon's web site.");
    Judd.Play("Pleased");
    Judd.Play("Pleased2");
    Judd.Speak("At least you will not have to click through four different pages to get to our Brandon server.");
    Judd.MoveTo(65, 230);
    Judd.Speak("Now it time for you to explore my menus.");
    Judd.Play("Congratulate");
    Judd.Play("Congratulate_2");
    Judd.Play("Advertise");
    Judd.Speak("\\Chr=\"Whisper\"\\Jo Doell is now a Tampa Bay Area resident and she makes guest appearances at the Brandon Campus web technology courses to explain how I, Judd, was made.");
    
    Judd.Speak("\\Chr=\"Monotone\"\\\\Map=\"\\Pit=52\\\\Spd=130\\doe \\Pit=55\\ray \\Pit=62\\me \\Pit=65\\fah \\Pit=73\\so \\Pit=82\\lah \\Pit=87\\tea \\Pit=104\\doe\"=\"do re mi fa so la ti do\"\\");
    Judd.Speak("\\Chr=\"Monotone\"\\\\Map=\"\\Pit=104\\\\Spd=130\\doe \\Pit=110\\ray \\Pit=123\\me \\Pit=131\\fah \\Pit=147\\so \\Pit=165\\lah \\Pit=175\\tea \\Pit=208\\doe\"=\"do re mi fa so la ti do\"\\");
    Judd.Speak("I can also sing, but I do not dance.");
    Judd.Play("Write");
    Judd.Speak("I can also write.");
    Judd.Play("Wave");
    Judd.Speak("Now it is time for me to say goodbye.");
    Judd.Hide();
    
    Judd.Show();
    Judd.Speak("Hi! I am back!");
    Judd.Think("Do Not forget to right click to make me disappear.");
    
    Judd.Play("Idle3_3");


    // *** END MASH USER SCRIPT ***
}
//-->
