// Lazy VB workaround
var True = 1;
var False = 0;

// Configuration parameters

var gbFormContainsFile = false;
var giDefaultCellpadding = 5;
var giDefaultCellspacing = 0;
var gsDefaultVerticalAlignment = "top";
var gsDefaultHorizontalAlignment = "left";
var giDefaultTextAreaRows = 5;
var giDefaultTextAreaColumns = 80;
var gsDefaultOnChangeEvent = "SetFormModified(true);";
var gsForumDisclaimer = "Registered users of Our Day who choose to read and/or participate in the forum " + 
                        "do so at their own risk.  Our Day accepts no responsibility for the messages " + 
                        "contained therein and opinions expressed are those of the posters and are not " + 
                        "necessarily endorsed by Our Day.<BR><BR>" + 
                        "Users may not use the forum to buy, sell, advertise or promote.  Our Day " + 
                        "reserves the right to moderate the forum and to remove posts it considers are " +  
                        "offensive or inappropriate.";


// Page Types
var FRONT_PAGE = 0;
var MEMBER_PAGE = 1;
var TOUR_PAGE = 2;

// Menu Types
var MENU_NONE = -1;
var MENU_MAIN = 0;
var MENU_DIRECTORY = 1;
var MENU_CALENDAR = 2;
var MENU_GUESTS = 3;
var MENU_BUDGET_PLANNER = 4;
var MENU_GIFT_REGISTRY = 5;
var MENU_AFTER_THE_WEDDING = 6;
var MENU_USEFUL_STUFF = 7;
var MENU_FORUM = 8;
var MENU_ADMIN = 9;

// Sub Menu Types
var SUBMENU_BREAK = -1;
var SUBMENU_NONE = -2;

var SUBMENU_HOME = 0;
var SUBMENU_CONTACT_US = 1;
var SUBMENU_ABOUT_US = 2;
var SUBMENU_DISCLAIMER = 3;
var SUBMENU_REGISTER_YOUR_BUSINESS = 4;
var SUBMENU_PRIVACY = 5;
var SUBMENU_TELL_A_FRIEND = 6;
var SUBMENU_SIGNOUT = 7;
var SUBMENU_INTRO_LOGIN = 8;
var SUBMENU_TAKE_A_TOUR = 9;
var SUBMENU_MY_DETAILS = 10;
var SUBMENU_SPECIALS = 11;
var SUBMENU_MAKE_BUS_PAYMENT = 12;
var SUBMENU_LOST_PASSWORD = 13;
var SUBMENU_REGISTER = 14;

var SUBMENU_DIRECTORY = 100;
var SUBMENU_SHORTLIST = 101;
var SUBMENU_ADD_A_SUPPLIER = 102; 

var SUBMENU_CALENDAR_MONTH = 0;
var SUBMENU_CALENDAR_DAY = 1;
var SUBMENU_CALENDAR_ADD = 2;

var SUBMENU_INVITATION_LIST = 0;
var SUBMENU_INVITATION_ADD = 1;
var SUBMENU_INVITES_SENT = 2;
var SUBMENU_RSVPS_RECEIVED = 3;
var SUBMENU_PRESENTS_RECEIVED = 4;
var SUBMENU_THANKYOUS_SENT = 5;
var SUBMENU_INVITES_NOT_SENT = 6;
var SUBMENU_RSVPS_NOT_RECEIVED = 7;
var SUBMENU_PRESENTS_NOT_RECEIVED = 8;
var SUBMENU_THANKYOUS_NOT_SENT = 9;

var SUBMENU_BUDGET_CHECKLIST = 0;
var SUBMENU_BUDGET_CALC = 1;
var SUBMENU_WHOS_PAYING = 2

var SUBMENU_REGISTRY = 0;
var SUBMENU_VIEW_ITEMS = 1;
var SUBMENU_ADD_ITEM = 2;
var SUBMENU_VIEW_STORES = 3;
var SUBMENU_ADD_STORE = 4;
var SUBMENU_VIEW_PURCHASES = 5;
var SUBMENU_RECORD_PURCHASE = 6;

var SUBMENU_ADD_PHOTOS = 0;
var SUBMENU_VIEW_PHOTOS = 1;
var SUBMENU_SEND_THANKYOU = 2;
var SUBMENU_OTHER_WEDDING_PHOTOS = 3;

var SUBMENU_CUSTOMS = 0;
var SUBMENU_SPEECHES = 1;
var SUBMENU_WEDDING_TIPS = 2;
var SUBMENU_MORE_WEDDING_TIPS = 3;
var SUBMENU_CHOOSING_ACCESSORIES = 4
var SUBMENU_READINGS_POETIC = 5;
var SUBMENU_READINGS_RELIGIOUS = 6;
var SUBMENU_READINGS_LITERATURE = 7;

var SUBMENU_FORUM = 100;
var SUBMENU_CHAT = 101;

var SUBMENU_SITE_STATISTICS = 0;
var SUBMENU_SEND_NEWSLETTER = 1;
var SUBMENU_MAKE_PAYMENT = 2;
var SUBMENU_MAIL_MERGE = 3;
 
var gaMenu = new Array();
var gaSubMenu = new Array();
var iMenuCounter = 0;
var iSubMenuCounter = 0;


// Global declaration Variables
var gsPageHTML = "";
var giParagraphsOpen = 0;
var giTablesOpen = 0;
var giColspan = 0;
var giRowspan = 0;
var gsColWidth = "none";
var gsRowHeight = "none";
var gsTableWidth = "none";
var gsTableHeight = "none";
var gbIncludeClosingTag = true;
var giCellpadding = giDefaultCellpadding;
var giCellspacing = giDefaultCellspacing;
var gsVerticalAlignment = gsDefaultVerticalAlignment;
var gsHorizontalAlignment = gsDefaultHorizontalAlignment;
var gsSubmitAction = "";
var gbNobreak = false;
var gsOnChangeEvent = gsDefaultOnChangeEvent;
var gsOnMouseOverEvent = "";
var gsOnMouseOutEvent = "";
var gbDetailsModified = false;
var gaLayerList = new Array();
var gsNonIEFormType = 'body';
var gsMoreInfoImageURL = "../images/Site/MoreInformation.gif";
var gsEmailImageURL = "../images/Site/Email.gif";
var gsWebsiteImageURL = "../images/Site/WorldWideWeb.gif";

var Today = new Date()

var AMPMArray = new Array("", "am", "pm");
var StateValueAllArray = new Array("All", "ACT", "NSW", "NT", "QLD", "SA", "TAS", "VIC", "WA");
var StateDescriptionAllArray = new Array("{All}", "Australian Capital Territory", "New South Wales", "Northern Territory", "Queensland", "South Australia", "Tasmania", "Victoria", "Western Australia");
var StateValueArray = new Array("", "ACT", "NSW", "NT", "QLD", "SA", "TAS", "VIC", "WA");
var StateDescriptionArray = new Array("", "Australian Capital Territory", "New South Wales", "Northern Territory", "Queensland", "South Australia", "Tasmania", "Victoria", "Western Australia");
var DayArray = new Array("", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
var MonthArray = new Array("", "Jan", "Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
var YearArray = new Array("", 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010)

function TakeATour()
{
    // No longer a popup
    document.location = "../asp/Tour.asp";
}

function isAlien(a) 
{
   return isObject(a) && typeof a.constructor != 'function';
}

function isArray(a) 
{
    return isObject(a) && a.constructor == Array;
}

function isBoolean(a) 
{
    return typeof a == 'boolean';
}

function isEmpty(o) 
{
    var i, v;
    if (isObject(o)) 
    {
        for (i in o) 
        {
            v = o[i];
            if (isUndefined(v) && isFunction(v)) 
                return false;
        }
    }
    return true;
}

function isFunction(a) 
{
    return typeof a == 'function';
}

function isNull(a) 
{
    return typeof a == 'object' && !a;
}

function isNumber(a) 
{
    return typeof a == 'number' && isFinite(a);
}

function isObject(a) 
{
    return (a && typeof a == 'object') || isFunction(a);
}

function isString(a) 
{
    return typeof a == 'string';
}

function isUndefined(a) 
{
    return typeof a == 'undefined';
} 

function Trim(TrimString) 
{
    while ((TrimString.substring(0,1) == ' ') ||
           (TrimString.substring(0,1) == '\n') || 
           (TrimString.substring(0,1) == '\r'))
        TrimString = TrimString.substring(1, TrimString.length);

    while ((TrimString.substring(TrimString.length-1, TrimString.length) == ' ') ||
           (TrimString.substring(TrimString.length-1, TrimString.length) == '\n') || 
           (TrimString.substring(TrimString.length-1, TrimString.length) == '\r'))
        TrimString = TrimString.substring(0, TrimString.length-1);

    return TrimString;
}

function DisplayPage(ShowHTML)
{
    var i;

    for (i=0; i < giParagraphsOpen; i++)
        DocumentWriteLine("</p>");
    giParagraphsOpen = 0;

    for (i=0; i < giTablesOpen; i++)
        DocumentWriteLine("</td></tr></table>");
    giTablesOpen = 0;

    if (ShowHTML)
        alert(gsPageHTML);

//    document.write(gsPageHTML);
    gfrmForm = document.frmMain
}

function DocumentWrite (sNewHTML)
{
    gsPageHTML += sNewHTML;
    document.write(sNewHTML);
}

function DocumentWriteLine (sNewHTML)
{
    gsPageHTML += sNewHTML;
    gsPageHTML += "\n";
    document.writeln(sNewHTML);
}

function StringReplace(StringReplaceString, StringReplaceOld, StringReplaceNew)
{
    var NewString = new String(StringReplaceString);

    while (NewString.search(StringReplaceOld) != -1)
        NewString = NewString.replace(StringReplaceOld, StringReplaceNew);

    return NewString;
}

function Breaks (BreakRepeatCount)
{
    var i = 0;

    for (i = 0; i < BreakRepeatCount; i++)
        DocumentWrite("<BR>");
    DocumentWriteLine("");
}

function File (ButtonId, ButtonClass, TextBoxSize)
{
    if (!ButtonClass)
        ButtonClass = "File";
    DocumentWriteLine("<input type=\"file\"");
    DocumentWriteLine("       name=\"" + ButtonId + "\"");
    DocumentWriteLine("       class=\"" + ButtonClass + "\"");
    if (TextBoxSize)
        DocumentWriteLine("       size=\"" + TextBoxSize + "\"");
    DocumentWriteLine(">");
}

function ListItem(ListItemText, ListItemClass, ListItemLink)
{
    DocumentWrite("<li");
    if (ListItemClass)
        DocumentWrite(" class=\"" + ListItemClass + "\"");
    DocumentWrite(">");
    if (ListItemLink)
        Link(ListItemText, ListItemLink, ListItemClass);
    else
        DocumentWrite(ListItemText)
    DocumentWriteLine("</li>");
}

function ListItemStart(pbNumbered, ListClass)
{
    if (pbNumbered)
        DocumentWrite("<ol");
    else
        DocumentWrite("<ul");
    if (ListClass)
        DocumentWrite(" class=\"" + ListClass + "\"");
    DocumentWriteLine(">");
}

function ListItemEnd(pbNumbered)
{
    if (pbNumbered)
        DocumentWriteLine("</ol>");
    else
        DocumentWriteLine("</ul>");
}

function Button (ButtonLabel, ButtonClass, ButtonAction, ButtonId)
{
    if (!ButtonAction)
        ButtonAction = "javascript:Submit()";

    if (!ButtonClass)
        ButtonClass = "Button";

    DocumentWriteLine("<input type=\"button\"");
    DocumentWriteLine("       value=\"" + ButtonLabel + "\"");
    DocumentWriteLine("       class=\"" + ButtonClass + "\"");

    if (ButtonId)
        DocumentWriteLine("       id=\"" + ButtonId + "\"");
    if (gsOnMouseOverEvent != "")
        DocumentWriteLine("       onMouseOver=\"" + gsOnMouseOverEvent + "\"");
    if (gsOnMouseOutEvent != "")
        DocumentWriteLine("       onMouseOut=\"" + gsOnMouseOutEvent + "\"");
    gsOnMouseOverEvent = "";
    gsOnMouseOutEvent = "";

    DocumentWriteLine("       onClick=\"" + ButtonAction + "\">");
}

function Heading (HeadingText, HeadingNumber, HeadingSection)
{
    DocumentWrite("<p class=\"Heading" + HeadingNumber + "\">");
    if (HeadingSection)
        DocumentWrite("<A name='" + HeadingSection + "'>");
    DocumentWrite(HeadingText);
    if (HeadingSection)
        DocumentWrite("</A>");
    DocumentWriteLine("</p>");
}


function Image (ImageSrc, ImageClass, ImageLink, ImageWidth, ImageHeight, ImageAltText, ImageOpenInNewWindow)
{
    if (ImageLink)
    {
        DocumentWriteLine("<a");
        if (ImageOpenInNewWindow)
            DocumentWriteLine(" target='new' ");
        DocumentWriteLine(" href=\"" + ImageLink + "\">");
    }

    DocumentWrite("<img src=\"" + ImageSrc + "\"");
    if (ImageClass)
    {
        DocumentWriteLine("");
        DocumentWrite("     class=\"" + ImageClass + "\"");
    }
    if (ImageWidth)
    {
        DocumentWriteLine("");
        DocumentWrite("     width=\"" + ImageWidth + "\"");
    }
    if (ImageHeight)
    {
        DocumentWriteLine("");
        DocumentWrite("     height=\"" + ImageHeight + "\"");
    }
    if (ImageAltText)
    {
        DocumentWriteLine("");
        DocumentWrite("     alt='" + ImageAltText + "'");
    }
    DocumentWriteLine("></img>");

    if (ImageLink)
        DocumentWriteLine("</a>");
}

function Link (LinkLabel, LinkHRef, LinkClass, LinkNonbreaking)
{
    if (LinkNonbreaking)
        LinkLabel = StringReplace(LinkLabel, " ", "&nbsp;");

    DocumentWrite("<a href=\"" + LinkHRef + "\"");
    if (LinkClass)
    {
        DocumentWriteLine("");
        DocumentWrite("   class=\"" + LinkClass + "\"");
    }
    DocumentWrite(">");
    DocumentWrite(LinkLabel);
    DocumentWriteLine("</a>");
}

function Paragraph (ParagraphText, ParagraphClass, ParagraphNonBreaking)
{
    if (ParagraphNonBreaking)
        ParagraphText = StringReplace(ParagraphText, " ", "&nbsp;");
    DocumentWrite("<p");
    if (ParagraphClass)
        DocumentWrite(" class=\"" + ParagraphClass + "\"");
    DocumentWriteLine(">");
    DocumentWriteLine(ParagraphText);
    DocumentWriteLine("</p>");
}

function ParagraphStart (PargraphStartClass)
{
    DocumentWrite("<p");
    if (PargraphStartClass)
        DocumentWrite(" class=\"" + PargraphStartClass + "\"");
    DocumentWriteLine(">");
    giParagraphsOpen += 1;
}

function ParagraphEnd ()
{
    giParagraphsOpen -= 1;
    DocumentWriteLine("</p>");
}

function Password (PasswordName, PasswordClass, PasswordMaxLength, PasswordSize, PasswordValue)
{
    DocumentWriteLine("<Input type=\"password\"");
    if (PasswordClass)
        DocumentWriteLine("       class=\"" + PasswordClass + "\"");
    if (PasswordMaxLength)
        DocumentWriteLine("       maxlength=\"" + PasswordMaxLength + "\"");
    if (PasswordSize)
        DocumentWriteLine("       size=\"" + PasswordSize + "\"");
    if (PasswordValue)
        DocumentWriteLine("       value=\"" + PasswordValue + "\"");
    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onChange=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine("       name=\"" + PasswordName + "\">");
}

function Space(SpaceRepeatCount, ReturnValueOnly)
{
    var i = 0;
	var sSpaces = "";
    for (i = 0; i < SpaceRepeatCount; i++)
        sSpaces += "&nbsp;";
	if (!ReturnValueOnly)
		DocumentWriteLine(sSpaces);
	return sSpaces;
}

function Text (TextText, TextNonBreaking)
{
    if (TextNonBreaking)
        TextText = StringReplace(TextText, " ", "&nbsp;");
    DocumentWriteLine(TextText);
}

function TextBox (TextBoxName, TextBoxClass, TextBoxValue, TextBoxMaxLength, TextBoxSize, TextBoxReadOnly)
{
    DocumentWriteLine("<Input type=\"text\"");
    if (TextBoxReadOnly)
        DocumentWriteLine("      readonly");
    if (TextBoxClass)
        DocumentWriteLine("       class=\"" + TextBoxClass + "\"");
    if (TextBoxValue)
        DocumentWriteLine("       value=\"" + TextBoxValue + "\"");
    if (TextBoxMaxLength)
        DocumentWriteLine("       maxlength=\"" + TextBoxMaxLength + "\"");
    if (TextBoxSize)
        DocumentWriteLine("       size=\"" + TextBoxSize + "\"");
    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onChange=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine("       name=\"" + TextBoxName + "\">");
}

function NewTable (TableClass, RowClass, ColumnClass)
{
    DocumentWrite("<TABLE");
    if (TableClass)
        DocumentWrite(" class=\"" + TableClass + "\"");
    if (gsTableWidth != "none")
        DocumentWrite(" width=\"" + gsTableWidth + "\"");
    DocumentWrite(" cellpadding=\"" + giCellpadding + "\"");
    DocumentWrite(" cellspacing=\"" + giCellspacing + "\"");
    if (gsTableHeight != "none")
        DocumentWrite(" height=\"" + gsTableHeight + "\"");
    DocumentWrite(">");
    
    gbIncludeClosingTag = false;
    NewRow(RowClass, ColumnClass);

    giCellpadding = giDefaultCellpadding;
    giCellspacing = giDefaultCellspacing;
    giTablesOpen += 1;
}

function EndTable ()
{
    DocumentWriteLine("</td></tr></TABLE>");
    giTablesOpen -= 1;
}

function NewRow (RowRowClass, RowColumnClass)
{
    if (gbIncludeClosingTag)
        DocumentWriteLine("</td></tr>");
    DocumentWrite("<tr");
    if (RowRowClass)
        DocumentWrite(" class=\"" + RowRowClass + "\"");
    if (gsVerticalAlignment != "none")
        DocumentWrite(" valign=\"" + gsVerticalAlignment + "\"");
    if (gsRowHeight != "none")
        DocumentWrite(" height=\"" + gsRowHeight + "\"");
    DocumentWrite(">");
    
    gbIncludeClosingTag = false;
    NewColumn (RowColumnClass);
}

function NewColumn (ColumnColumnClass)
{
    if (gbIncludeClosingTag)
        DocumentWriteLine("</td>");
    DocumentWrite("<td");
    if (ColumnColumnClass)
        DocumentWrite(" class=\"" + ColumnColumnClass + "\"");
    if (gsHorizontalAlignment != "none")
        DocumentWrite(" align=\"" + gsHorizontalAlignment + "\"");
    if (giRowspan > 1)
        DocumentWrite(" rowspan=\"" + giRowspan + "\"");
    if (giColspan > 1)
        DocumentWrite(" colspan=\"" + giColspan + "\"");

    if (gsColWidth != "none")
        DocumentWrite(" width=\"" + gsColWidth + "\"");
    DocumentWriteLine(">");

    if (gbNobreak)
        DocumentWrite("<NOBR>");

    gbIncludeClosingTag = true;
    giRowspan = 0;
    giColspan = 0;
    gsColWidth = "none";
}

function BackLink()
{
    Link("I'd like to go back to where I was ...", "javascript:history.back()", null, true);
}

function SetColspan(Colspan)
{
    if (! (Colspan > 1))
        Colspan = 0;
    giColspan = Colspan
}

function SetRowspan(Rowspan)
{
    if (! (Rowspan > 1))
        Rowspan = 0;
    giRowspan = Rowspan;
}

function SetColWidth(Colwidth)
{
    if (! Colwidth)
        Colwidth = "none";
    gsColWidth = Colwidth
}

function SetRowHeight(RowHeight)
{
    if (! RowHeight)
        RowHeight = "none";
    gsRowHeight = RowHeight;
}

function SetTableWidth(TableWidth)
{
    if (! TableWidth)
        TableWidth = "none";
    gsTableWidth = TableWidth;
}

function SetCellpadding(Cellpadding)
{
    if (Cellpadding == 0)
        Cellpadding = 0;
    else if (! Cellpadding)
        Cellpadding = giDefaultCellpadding;
    giCellpadding = Cellpadding;
}

function SetCellspacing(Cellspacing)
{
    if (Cellspacing == 0 )
        Cellspacing = 0;
    else if (! Cellspacing)
        Cellspacing = giDefaultCellspacing;
    giCellspacing = Cellspacing;
}

function SetTableHeight(TableHeight)
{
    if (! TableHeight)
        TableHeight = "none";
    gsTableHeight = TableHeight;
}

function SetVerticalAlignment(VerticalAlignment)
{
    if (! VerticalAlignment)
        VerticalAlignment = gsDefaultVerticalAlignment;
    gsVerticalAlignment = VerticalAlignment;
}

function SetHorizontalAlignment(HorizontalAlignment)
{
    if (! HorizontalAlignment)
        HorizontalAlignment = gsDefaultHorizontalAlignment;
    gsHorizontalAlignment = HorizontalAlignment;
}

function StandardHeading(SHPageType, SHMenuCategory, SHMenuSubCategory, SHWeddingName, SHWeddingDate, SHAdditionalMenuArray, SHPersonTypeId)
{
    if (SHPageType == FRONT_PAGE ||
        SHPageType == TOUR_PAGE ||
        !SHPersonTypeId ||
        SHPersonTypeId < 0)
    {
        SHWeddingName = "Our Day - plan it your way";
        SHPersonTypeId = -1;
        SHPageType = FRONT_PAGE;
    }

    SetCellspacing(0);
    SetCellpadding(0);
    SetTableWidth("100%");
    SetTableHeight("95%");
    SetColWidth("100%");
    NewTable();
            DocumentWrite("<FORM name=\"frmLogin\"" +
                          "      action=\"../asp/Main.asp\"" +
                          "      method=\"POST\">");
            SetCellspacing(0);
            SetCellpadding(0);
            SetTableWidth("100%");
            SetTableHeight(150);
            SetVerticalAlignment("middle");
            SetHorizontalAlignment("center");
            SetColWidth("100%");
            NewTable("banner");
                    Section("top");
                    if (SHPersonTypeId < 0)
                        Breaks(1);
                    Image("../images/Site/Logo_MediumLargeWithTagLine.gif", "", "../asp/home.asp", 200, 50, "Our Day - plan it your way");

                    if (SHPersonTypeId == 1 ||
                        SHPersonTypeId == 2 ||
                        SHPersonTypeId == 3)
                    {
                        Text("<H2>" + SHWeddingName + " - " + SHWeddingDate + "</H2>");
                        var sWeddingDate = SHWeddingDate.replace(/\-/g, " ");
                        var iRemainingDays = Math.round(((new Date(sWeddingDate) - new Date()) / 86400000) + 0.5)
                        SpanStart("", "font-family: Monotype Corsiva, Arial;" +
                                      "font-size:  12pt;");
                        if (iRemainingDays > 0)
                            Text("(only " + iRemainingDays + " days to go !)", true);
                        else if (iRemainingDays == 0)
                            Text("(The Big Day today !)", true);
                        else
                            Text("(Congratulations !)", true);
                        SpanEnd();
                    }
                    else
                    {
                        Text("<H2>" + SHWeddingName + "</H2>");
                        if (SHPersonTypeId < 0)
                        {
                            SetVerticalAlignment("middle");
                            SetTableHeight("1%");
                            SetColWidth("50%");
                            NewTable();
                                    Space(1);
                                SetNobreak(true);
                                NewColumn();
                                    SpanStart("smalltext");
                                    Text("login or email");
                                    SpanEnd("smalltext");
                                NewColumn();
                                    TextBox("LoginId", "small", "", 80, 10); 
                                NewColumn();
                                    SpanStart("smalltext");
                                    Text("password");
                                    SpanEnd("smalltext");
                                NewColumn();
                                    Password("Password", "small", 10, 10); 
                                NewColumn();
                                    SpanStart("smalltext");
                                    Text("Keep me signed in");
                                    SpanEnd("smalltext");
                                NewColumn();
                                    CheckBox("KeepMeLoggedIn", "", true);
                                NewColumn();
                                    Button("go", "small", "document.frmLogin.submit();"); 
                                SetColWidth("50%");
                                NewColumn();
                                    Space(1);
                                SetNobreak(false);
                            EndTable();
                        }
                        else
                            Text("Welcome to Our Day !");
                    }

            EndTable();

            PopulateMenuItems(SHPersonTypeId)
            WriteMainMenu(SHMenuCategory);
                    
        NewRow();
            DocumentWrite("</FORM>");

            SetCellspacing(0);
            SetCellpadding(0);
            SetColWidth("90");
            SetVerticalAlignment("top");
            SetTableHeight("100%");
            SetTableWidth("100%");
            SetRowHeight("1");
            SetRowspan(2);
            NewTable("MainBody");

                    WriteMenu(SHMenuCategory, SHMenuSubCategory, SHAdditionalMenuArray);

                SetColWidth(14);
                SetRowspan(2);
                NewColumn();
                    Spacer(1, 2);
                SetRowspan();
                NewColumn();
                    Spacer(200, 1);
                SetVerticalAlignment("top");
                SetRowHeight("*");
                NewRow();
                    SetTableHeight();
                    SetTableWidth("*");
                    SetCellspacing();
                    SetCellpadding();

    DocumentWrite("<FORM name=\"frmMain\"" +
                  "      action=\"" + gsSubmitAction + "\"");
    if (gbFormContainsFile)
        DocumentWrite("  enctype=\"multipart/form-data\"");
    DocumentWriteLine("  method=\"POST\">");
}

function StandardFooter(SFPageType, SFIncludeBackLink)
{
    var ii = 0;
    if (SFIncludeBackLink)
    {
        Breaks(1);
        BackLink();
        Breaks(2);
    }

    EndTable();
    EndTable();

    if (SFPageType == MEMBER_PAGE)
        var bSignedIn = true;
    else
        var bSignedIn = false;

    SetCellpadding(0);
    SetCellspacing();
    SetTableWidth();
    Text("<center>");
    NewTable("Centered");
                ii ++;
                Link("intro/login", "../asp/Home.asp", "smalltext");
                Space(3);
            NewColumn();
                ii ++;
                Link("photos", "../asp/WeddingPhotos.asp", "smalltext", true);
                Space(3);
            NewColumn();
                ii ++;
                Link("directory listing", "../asp/Directory.asp", "smalltext", true);
                Space(3);
            NewColumn();
                ii ++;
                Link("forum", "../asp/Forum.asp", "smalltext", true);
                Space(3);
            if (!bSignedIn)
            {
                NewColumn();
                    ii ++;
                    Link("register", "../html/Register.html", "smalltext");
                    Space(3);
            }
            NewColumn();
                ii ++;
                Link("privacy statement", "../asp/Privacy.asp", "smalltext", true);
                Space(3);
            NewColumn();
                ii ++;
                Link("disclaimer", "../asp/Disclaimer.asp", "smalltext");
                Space(3);
            NewColumn();
                ii ++;
                Link("about us", "../asp/About.asp", "smalltext", true);
                Space(3);
            NewColumn();
                ii ++;
                Link("contact us", "../asp/ContactDetails.asp", "smalltext", true);
                Space(3);
            if (bSignedIn)
            {
                NewColumn();
                    ii ++;
                    Link("sign out", "../asp/SignOut.asp", "smalltext", true);
            }
        SetColspan(ii);
        SetHorizontalAlignment("center");
        NewRow("", "smalltext");
                Text("Our Day Pty Ltd - ACN: 107 670 280", true);
    EndTable();

    DocumentWriteLine("</FORM>");
}

function ListBox(ListBoxName, ListBoxClass, ListBoxValueArray, ListBoxTextArray, ListBoxSelectedValue)
{
    var ListBoxSize = 3;
    if (ListBoxValueArray.length >= ListBoxSize)
        ListBoxSize = ListBoxValueArray.length + 1 ;
    if (ListBoxSize > 13)
        ListBoxSize = 13;

    DocumentWrite("<SELECT name=\"" + ListBoxName + "\"" );
    // DocumentWrite("        size=\"" + ListBoxSize + "\""); AJC TO BE FIXED
    if (ListBoxClass)
        DocumentWrite("     class=\"" + ListBoxClass + "\"");
    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onChange=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine(">");

    if (! ListBoxTextArray)
        ListBoxTextArray = ListBoxValueArray;

    var i;

    for (i=0; i<ListBoxTextArray.length; i++)
    {
        DocumentWrite("    <OPTION VALUE=\"" + ListBoxValueArray[i] + "\"");
        if (ListBoxSelectedValue == ListBoxValueArray[i] ||
            ListBoxSelectedValue == ListBoxTextArray[i])
            DocumentWrite(" SELECTED");
        DocumentWrite(">");
        DocumentWrite(ListBoxTextArray[i]);
        DocumentWriteLine("</OPTION>");
    }

    DocumentWriteLine("</SELECT>");
}

function RadioButton(RadioButtonGroup, RadioButtonValue, RadioButtonClass, RadioButtonSelected)
{
    DocumentWrite("<input type=\"radio\"");
    DocumentWrite("       name=\"" + RadioButtonGroup + "\"");
    DocumentWrite("       value=\"" + RadioButtonValue + "\"");
    if (!RadioButtonClass)
        RadioButtonClass = "radio";
    DocumentWrite("       class=\"" + RadioButtonClass + "\"");
    if (RadioButtonSelected)
        DocumentWrite("       checked");
    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onChange=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine(">");
}

function CheckBox(CheckBoxName, CheckBoxClass, CheckBoxSelected)
{
    DocumentWrite("<input type=\"checkbox\"");
    DocumentWrite("       name=\"" + CheckBoxName + "\"");
    if (!CheckBoxClass)
        CheckBoxClass = "checkbox"
    DocumentWrite("       class=\"" + CheckBoxClass + "\"");
    if (CheckBoxSelected)
        DocumentWrite("       CHECKED");
    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onClick=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine(">");
}

function StartFont(FontClass)
{
    DocumentWrite("<FONT class=\"" + FontClass + "\">");
}

function EndFont()
{
    DocumentWrite("</FONT>");
}

function ProgrammingError(ErrorText)
{
    alert("Programming error: " + ErrorText);
    return false;
}

function Submit()
{
    if (gsSubmitAction == "")
        return ProgrammingError("No submit action specified");

    if (!Validate)
    {
        gfrmForm.submit()    
        return true;
    }
    else if (!Validate())
    {
        return false;
    }
    gfrmForm.submit()

    return true;
}

function SetSubmitAction(SubmitAction, FormContainsFile)
{
    gsSubmitAction = SubmitAction;
    if (FormContainsFile)
        gbFormContainsFile = true;
}

function TextAreaLengthCheck(TextAreaObject, LengthCheckMaxLength)
{
    if (TextAreaObject.value.length > LengthCheckMaxLength)
        TextAreaObject.value = TextAreaObject.value.substring(0, LengthCheckMaxLength);
}

function TextArea(TextAreaName, TextAreaClass, TextAreaValue, TextAreaRows, TextAreaColumns, TextAreaMaxLength)
{
    if (!TextAreaRows)
        TextAreaRows = giDefaultTextAreaRows;
    if (!TextAreaColumns)
        TextAreaColumns = giDefaultTextAreaColumns;

    DocumentWriteLine("<TEXTAREA name=\"" + TextAreaName + "\"");
    DocumentWriteLine("          rows=\"" + TextAreaRows + "\"");
    DocumentWriteLine("          cols=\"" + TextAreaColumns + "\"");
    if (TextAreaClass)
        DocumentWriteLine("          class=\"" + TextAreaClass + "\"");
    if (TextAreaMaxLength)
    {
        DocumentWrite("          onClick=\"StoreCursorLocation(this);TextAreaLengthCheck(this, " + TextAreaMaxLength + ")\"");
        DocumentWrite("          onKeyDown=\"TextAreaLengthCheck(this, " + TextAreaMaxLength + ")\"");
    }
    else
        DocumentWrite("          onClick=\"StoreCursorLocation(this)\"");

    DocumentWrite("          onSelect=\"StoreCursorLocation(this)\"");
    DocumentWrite("          onKeyUp=\"StoreCursorLocation(this)\"");
    DocumentWrite("          onDblClick=\"StoreCursorLocation(this)\"");

    if (gsOnChangeEvent != "")
    {
        DocumentWriteLine("       onChange=\"" + gsOnChangeEvent + "\"");
        gsOnChangeEvent = gsDefaultOnChangeEvent;
    }
    DocumentWriteLine(">");
    DocumentWrite(TextAreaValue);
    DocumentWriteLine("</TEXTAREA>");
}

function DaysInMonth(DIMMonth, DIMYear)
{
    DIMMonth = DIMMonth.toString();

    var FebDays;
    if (DIMYear % 400 == 0)
        FebDays = 29;
    else if (DIMYear % 100 == 0)
        FebDays = 28;
    else if (DIMYear % 4 == 0)
        FebDays = 29;
    else
        FebDays = 28;

    if (DIMMonth == 1 || 
        DIMMonth.toUpperCase().substr(0, 3) == "JAN")
        return 31;
    if (DIMMonth == 2 || 
             DIMMonth.toUpperCase().substr(0, 3) == "FEB")
        return FebDays;
    else if (DIMMonth == 3 || 
             DIMMonth.toUpperCase().substr(0, 3) == "MAR")
        return 31;
    else if (DIMMonth == 4 || 
             DIMMonth.toUpperCase().substr(0, 3) == "APR")
        return 30;
    else if (DIMMonth == 5 || 
             DIMMonth.toUpperCase().substr(0, 3) == "MAY")
        return 31;
    else if (DIMMonth == 6 || 
             DIMMonth.toUpperCase().substr(0, 3) == "JUN")
        return 30;
    else if (DIMMonth == 7 || 
             DIMMonth.toUpperCase().substr(0, 3) == "JUL")
        return 31;
    else if (DIMMonth == 8 || 
             DIMMonth.toUpperCase().substr(0, 3) == "AUG")
        return 31;
    else if (DIMMonth == 9 || 
             DIMMonth.toUpperCase().substr(0, 3) == "SEP")
        return 30;
    else if (DIMMonth == 10 || 
             DIMMonth.toUpperCase().substr(0, 3) == "OCT")
        return 31;
    else if (DIMMonth == 11 || 
             DIMMonth.toUpperCase().substr(0, 3) == "NOV")
        return 30;
    else if (DIMMonth == 12 || 
             DIMMonth.toUpperCase().substr(0, 3) == "DEC")
        return 31;
    else
        return ProgrammingError("Invalid month (" + DIMMonth.toUpperCase().substr(0, 3) + ") passed to 'DaysInMonth' javascript function.");        
}

function ConvertMonthFormat (InputMonth, OutputType)
{
    // Output Types - 0=Number, 1=ShortMonth, 2=LongMonth
    var MonthNumber;
    var MonthName;

    var MonthInputString = new String(InputMonth);
    MonthInputString = MonthInputString.toUpperCase().substring(0, 3);

    if (MonthInputString == "1" ||
        MonthInputString == "JAN")
    {
        MonthNumber = 1
        MonthName = "January"
    }
    else if (MonthInputString == "2" ||
             MonthInputString == "FEB")
    {
        MonthNumber = 2
        MonthName = "February"
    }
    else if (MonthInputString == "3" ||
             MonthInputString == "MAR")
    {
        MonthNumber = 3
        MonthName = "March"
    }
    else if (MonthInputString == "4" ||
             MonthInputString == "APR")
    {
        MonthNumber = 4
        MonthName = "April"
    }
    else if (MonthInputString == "5" ||
             MonthInputString == "MAY")
    {
        MonthNumber = 5
        MonthName = "May"
    }
    else if (MonthInputString == "6" ||
             MonthInputString == "JUN")
    {
        MonthNumber = 6
        MonthName = "June"
    }
    else if (MonthInputString == "7" ||
             MonthInputString == "JUL")
    {
        MonthNumber = 7
        MonthName = "July"
    }
    else if (MonthInputString == "8" ||
             MonthInputString == "AUG")
    {
        MonthNumber = 8
        MonthName = "August"
    }
    else if (MonthInputString == "9" ||
             MonthInputString == "SEP")
    {
        MonthNumber = 9
        MonthName = "September"
    }
    else if (MonthInputString == "10" ||
             MonthInputString == "OCT")
    {
        MonthNumber = 10
        MonthName = "October"
    }
    else if (MonthInputString == "11" ||
             MonthInputString == "NOV")
    {
        MonthNumber = 11
        MonthName = "November"
    }
    else if (MonthInputString == "12" ||
             MonthInputString == "DEC")
    {
        MonthNumber = 12
        MonthName = "December"
    }
    else
    {
        MonthNumber = -1
        MonthName = "?"
    }

    if (OutputType == 0)
        return MonthNumber
    else if (OutputType == 1)
        return MonthName.substring(0, 3);
    else if (OutputType == 2)
        return MonthName
    else
        return "Invalid Output Type passed to ConvertMonthFormat function"

}


function SetNobreak(NobreakOn)
{
    if (!NobreakOn)
    {
        gbNobreak = false;
        DocumentWrite("</NOBR>");
    }
    else
        gbNobreak = true;

}

function FormValue(FormValueName, FormValueValue)
{
    DocumentWriteLine("<input type=\"HIDDEN\"");
    DocumentWriteLine("       name=\"" + FormValueName + "\"");
    DocumentWriteLine("       value=\"" + FormValueValue + "\">");
}


function ValidateEmail(EmailAddress)
{
    var EmailOk  = true
    var AtSym    = EmailAddress.indexOf('@')
    var Period   = EmailAddress.lastIndexOf('.')
    var Space    = EmailAddress.indexOf(' ')
    var Length   = EmailAddress.length - 1

    if ((AtSym < 1) ||         // '@' cannot be in first position
        (Period <= AtSym+1) || // Must be atleast one valid char btwn '@' and '.'
        (Period == Length ) || // Must be atleast one valid char after '.'
        (Space  != -1))        // No empty spaces permitted
      EmailOk = false

    return EmailOk
}

function SetFormValue(SetFormValueName, SetFormValueValue)
{
    eval("gfrmForm." + SetFormValueName + ".value=\"" + SetFormValueValue + "\"")
}

function BreadcrumbTrail(BreadcrumbNameArray, BreadcrumbLinkArray)
{
    var i;
    
    ParagraphStart("smalltext");
    Link("Home", "../asp/Main.asp");
    
    for (i=0; i < BreadcrumbNameArray.length; i++)
    {
        Text("->");
        if (BreadcrumbLinkArray[i])
            Link(BreadcrumbNameArray[i], BreadcrumbLinkArray[i], "smalltext");
        else
            Text(BreadcrumbNameArray[i]);
    }
    ParagraphEnd();
}

function GetDay(GetDayDate)
{
    var iDate = GetDayDate.getDay();
    switch (iDate)
    {
        case 0:
            return "Sunday";
            break;
        case 1:
            return "Monday";
            break;
        case 2:
            return "Tuesday";
            break;
        case 3:
            return "Wednesday";
            break;
        case 4:
            return "Thursday";
            break;
        case 5:
            return "Friday";
            break;
        case 6:
            return "Saturday";
            break;
    }
    return -1;
}

function AddSuffix(Number)
{
    if (Number % 10 == 1 &&
        Number % 100 != 11)
        return 'st';
    else if (Number % 10 == 2 &&
             Number % 100 != 12)
        return 'nd';
    else if (Number % 10 == 3 &&
             Number % 100 != 13)
        return 'rd';
    return 'th';
}

function ValidateNumeric(TheObject, MaxValue, MinValue, Action, WarningText)
{
    // Action, 1 show warning, set focus, return false
    //         2 don't show warning, change value, return true
    if (!Action)
        Action = 2;
    if (!MaxValue)
        MaxValue = 999999999;
    if (!MinValue)
        MinValue = 0;
    if (!WarningText)
        WarningText = "The number specified was either not valid, or outside the acceptable range."

    var sNewValue;

    sNewValue = parseInt(TheObject.value);
    if (isNaN(sNewValue))
        sNewValue = MinValue;
    if (sNewValue < MinValue)
        sNewValue = MinValue;
    if (sNewValue > MaxValue)
        sNewValue = MaxValue;

    if (sNewValue == TheObject.value)
    {
        TheObject.value = sNewValue;
        return true;
    }

    if (Action == 1)
    {
        alert(WarningText);
        TheObject.focus();
        return false;
    }
    else if (Action == 2)
    {
        TheObject.value = sNewValue;
        return true;
    }

    return ProgrammingError("Invalid Action passed to ValidateNumeric javascript function.");
}


function SetOnChangeEvent(OnChangeAction, OverrideDefault)
{
    if (!OnChangeAction)
    {
        if (!OverrideDefault)
            gsOnChangeEvent = gsDefaultOnChangeEvent;
        else
            gsOnChangeEvent = "";
    }
    else
    {
        if (!OverrideDefault)
            gsOnChangeEvent = gsDefaultOnChangeEvent + OnChangeAction;
        else
            gsOnChangeEvent = OnChangeAction;
    }
}

function SetOnMouseOverEvent(OnMouseOverAction)
{
    if (!OnMouseOverAction)
        gsOnMouseOverEvent = "";
    else
        gsOnMouseOverEvent = OnMouseOverAction;
}

function SetOnMouseOutEvent(OnMouseOutAction)
{
    if (!OnMouseOutAction)
        gsOnMouseOutEvent = "";
    else
        gsOnMouseOutEvent = OnMouseOutAction;
}

function SetFormModified(SetItTrueOrFalse)
{
    if (!SetItTrueOrFalse)
        gbDetailsModified = false;
    else
        gbDetailsModified = true;
}

function IsFormModified()
{
    return gbDetailsModified;
}

function HorizontalRule()
{
    DocumentWriteLine("<HR size='1'>");
}

function Spacer(SpacerWidth, SpacerHeight)
{
    Image("../images/Site/Spacer.gif", "", "", SpacerWidth, SpacerHeight);
}

function Line(LineWidth, LineHeight)
{
    Image("../images/Site/Line.gif", "", "", LineWidth, LineHeight);
}

function WriteMenu(WMMenuCategory, WMMenuSubCategory, WMAdditionalMenuArray)
{
    var kkk,
        lll = 0;

    SetCellpadding(5);
    SetCellspacing(0);
    SetTableHeight("100%");
    SetTableWidth("140");
    NewTable("LeftMenu");

    for (kkk = 0; kkk < gaSubMenu.length; kkk++)
    {
        if (gaSubMenu[kkk][0] == WMMenuCategory)
        {
            SetHorizontalAlignment("left");
            if (lll == 0)
            {
                SetRowHeight(18);
                SetColWidth(11);
                SetCellpadding(0);
                SetTableWidth("100%");
                SetVerticalAlignment("top");
                SetTableHeight();
                NewTable();
            }
            else
            {
                if (gaSubMenu[kkk][1] != SUBMENU_BREAK)
                    SetRowHeight(18);
                else
                    SetRowHeight();
                NewRow();
            }

            if (gaSubMenu[kkk][1] != SUBMENU_BREAK)
            {
                var sAppendage = "";
                if (gaSubMenu[kkk][1] == WMMenuSubCategory)
                    sAppendage = "Selected";
                Image("../images/Site/MenuPointer" + sAppendage + ".gif", "", gaSubMenu[kkk][3], 4, 9, gaSubMenu[kkk][2]);
                SetHorizontalAlignment("left");
                NewColumn();
                    Link(gaSubMenu[kkk][2], gaSubMenu[kkk][3], "Submenu" + sAppendage );
            }
            else
            {
                HorizontalRule();
                NewColumn();
                HorizontalRule();
            }
            SetRowHeight();
            SetVerticalAlignment("top");
            lll++;
        }            
    }

    if (WMAdditionalMenuArray)
    {
        for (kkk = 0; kkk < WMAdditionalMenuArray.length; kkk++)
        {
            if (WMAdditionalMenuArray[kkk][0] != SUBMENU_BREAK)
                SetRowHeight(18);
            else
                SetRowHeight();
            SetHorizontalAlignment("left");
            NewRow();
                var sAMLinkClass = "SubMenu";
                if (WMAdditionalMenuArray[kkk][0] == WMMenuSubCategory)
                    sAMLinkClass = "SubMenuSelected";
                Image("../images/Site/MenuPointer.gif", "", WMAdditionalMenuArray[kkk][2], 4, 9, WMAdditionalMenuArray[kkk][1]);
            SetHorizontalAlignment("left");
            NewColumn();
                Link(WMAdditionalMenuArray[kkk][1], WMAdditionalMenuArray[kkk][2], sAMLinkClass);
                lll++;
        }
    }


    if (lll != 0)
        EndTable();
    else
        Space(1);

    if (WMMenuCategory == MENU_MAIN ||
        WMMenuCategory == MENU_DIRECTORY)
    {
        SetRowHeight("125");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_CALENDAR)
    {
        SetRowHeight("600");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_GUESTS)
    {
        SetRowHeight("240");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_BUDGET_PLANNER)
    {
        SetRowHeight("240");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_AFTER_THE_WEDDING)
    {
        SetRowHeight("125");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_USEFUL_STUFF)
    {
        SetRowHeight("240");
        SetVerticalAlignment("top");
    }
    else if (WMMenuCategory == MENU_FORUM)
    {
        SetRowHeight("600");
        SetVerticalAlignment("top");
    }
    SetRowHeight("100%");
    NewRow();
        Spacer(1, 1);

    EndTable();

    SetCellpadding();
    SetCellspacing();
}

function WriteMainMenu(WMMMenuCategory)
{
    var iii,
        jjj;

    SetHorizontalAlignment("left");
    SetVerticalAlignment("middle");
    SetTableWidth("100%");
    SetTableHeight(23);
    SetRowHeight("100%");
    SetCellpadding(0);
    SetCellspacing(0);
    NewTable("", "", "Menu");
                Space(3);
        for (iii = 0; iii < gaMenu.length; iii++)
        {
            var sClass = "Menu";
            if (gaMenu[iii][0] == WMMMenuCategory)
                sClass += "Selected";

            NewColumn(sClass);
                Link("&nbsp;&nbsp;" + gaMenu[iii][1] + "&nbsp;&nbsp;&nbsp;", gaMenu[iii][2], sClass, true);
        }
            SetColWidth("100%");
            NewColumn("Menu");
                Space(1);
    EndTable();
}

function Section(SectionName)
{
    DocumentWriteLine("<A name='" + SectionName + "'>&nbsp;</a>");
}

function ReturnToTop(TopLinkName)
{
    if (!TopLinkName)
        TopLinkName = "#top";
    Link("(Return to top)", TopLinkName, "smalltext");
}

function FormatCurrency(FCAmount, FCDisplayCents, FCIncludeDollarSign, FCAllowNegatives)
{
    var RoundingFactor = 100;
    var DollarSign = "$";
    var Negative = "";

    FCAmount = FCAmount.toString();
    if (FCAllowNegatives &&
        FCAmount.toString().substr(0, 1) == "-")
    {
        Negative = "-";
        FCAmount = FCAmount.substr(1, 20);
    }

    if (FCAmount.substr(0, 1) == "$")
        FCAmount = FCAmount.substr(1, 20);

    if (!FCDisplayCents)
        RoundingFactor = 1;

    if (!FCIncludeDollarSign)
        DollarSign = "";

    FCAmount = parseFloat(FCAmount);

    if (isNaN(FCAmount))
        FCAmount = 0;

    FCAmount = (Math.round(FCAmount * RoundingFactor )).toString();
    if (FCDisplayCents)
    {
        if (FCAmount < 100)
            FCAmount = "0" + FCAmount;
        if (FCAmount < 10)
            FCAmount = "0" + FCAmount;
        FCAmount = FCAmount.substring(0, FCAmount.length - 2) + "." +
                   FCAmount.substring(FCAmount.length - 2, 10);
    }

    return Negative + DollarSign + FCAmount;
}

function ReplaceForumSpecialCharacters(ForumMessage, CurrentClass)
{
    // Quote
    var NoBorderClass = CurrentClass.replace("bottomright", "quotename");
    ForumMessage = ForumMessage.replace(/\[qn\]/gi, "<table><tr><td class='" + NoBorderClass + "'>");
    ForumMessage = ForumMessage.replace(/\[\/qn\]/gi, "</td></tr></table>");
    ForumMessage = ForumMessage.replace(/\[q\]/gi, "<table cellpadding=8><tr><td class='" + CurrentClass + "'>");
    ForumMessage = ForumMessage.replace(/\[\/q\]/gi, "</td></tr></table>");
    // Emoticons
    var eee;
    ForumMessage = ForumMessage.replace(/:drunken:/gi, "<img src='/images/Emoticons/Drunk.gif'></img>");
    ForumMessage = ForumMessage.replace(/:D/gi, "<img src='/images/Emoticons/BigSmile.gif'></img>");
    ForumMessage = ForumMessage.replace(/:\)/gi, "<img src='/images/Emoticons/Smile.gif'></img>");
    ForumMessage = ForumMessage.replace(/:\(/gi, "<img src='/images/Emoticons/Sad.gif'></img>");
    ForumMessage = ForumMessage.replace(/:oops:/gi, "<img src='/images/Emoticons/Embarassed.gif'></img>");
    ForumMessage = ForumMessage.replace(/:o/gi, "<img src='/images/Emoticons/Surprised.gif'></img>");
    ForumMessage = ForumMessage.replace(/:shock:/gi, "<img src='/images/Emoticons/Startled.gif'></img>");
    ForumMessage = ForumMessage.replace(/:\?:/gi, "<img src='/images/Emoticons/Question.gif'></img>");
    ForumMessage = ForumMessage.replace(/:\?/gi, "<img src='/images/Emoticons/Confused.gif'></img>");
    ForumMessage = ForumMessage.replace(/8\)/gi, "<img src='/images/Emoticons/Cool.gif'></img>");
    ForumMessage = ForumMessage.replace(/:lol:/gi, "<img src='/images/Emoticons/Laughing.gif'></img>");
    ForumMessage = ForumMessage.replace(/:x/gi, "<img src='/images/Emoticons/Mad.gif'></img>");
    ForumMessage = ForumMessage.replace(/:P/gi, "<img src='/images/Emoticons/Raspberry.gif'></img>");
    ForumMessage = ForumMessage.replace(/:cry:/gi, "<img src='/images/Emoticons/Cry.gif'></img>");
    ForumMessage = ForumMessage.replace(/:evil:/gi, "<img src='/images/Emoticons/Evil.gif'></img>");
    ForumMessage = ForumMessage.replace(/:twisted:/gi, "<img src='/images/Emoticons/Twisted.gif'></img>");
    ForumMessage = ForumMessage.replace(/:roll:/gi, "<img src='/images/Emoticons/Rolleyes.gif'></img>");
    ForumMessage = ForumMessage.replace(/;\)/gi, "<img src='/images/Emoticons/Wink.gif'></img>");
    ForumMessage = ForumMessage.replace(/:!:/gi, "<img src='/images/Emoticons/Exclamation.gif'></img>");
    ForumMessage = ForumMessage.replace(/:idea:/gi, "<img src='/images/Emoticons/Idea.gif'></img>");
    ForumMessage = ForumMessage.replace(/:cheers:/gi, "<img src='/images/Emoticons/Cheers.gif'></img>");
    ForumMessage = ForumMessage.replace(/:scratch:/gi, "<img src='/images/Emoticons/ScratchHead.gif'></img>");
    ForumMessage = ForumMessage.replace(/:study:/gi, "<img src='/images/Emoticons/Study.gif'></img>");
    ForumMessage = ForumMessage.replace(/:thumbsdown:/gi, "<img src='/images/Emoticons/ThumbDown.gif'></img>");
    ForumMessage = ForumMessage.replace(/:thumbsup:/gi, "<img src='/images/Emoticons/ThumbUp.gif'></img>");
    
    // Text Formatting
    ForumMessage = ForumMessage.replace(/\[b\]/gi, "<b>");
    ForumMessage = ForumMessage.replace(/\[u\]/gi, "<u>");
    ForumMessage = ForumMessage.replace(/\[i\]/gi, "<i>");
    ForumMessage = ForumMessage.replace(/\[list\]/gi, "<ul>");
    ForumMessage = ForumMessage.replace(/\[list\=\]/gi, "<ol>");
    ForumMessage = ForumMessage.replace(/\[\*\]/gi, "<li>");
    ForumMessage = ForumMessage.replace(/\[url\]([^\[]*)/gi, "<a target=_new href='$1'>$1");
    ForumMessage = ForumMessage.replace(/\[img\]([^\[]*)/gi, "<img src='$1'>");
    ForumMessage = ForumMessage.replace(/\[fontsize=([^\]]*)\]/gi, "<fontsize=$1>");
    ForumMessage = ForumMessage.replace(/\[color=([^\]]*)\]/gi, "<color=$1>");

    ForumMessage = ForumMessage.replace(/\[\/b\]/gi, "</b>");
    ForumMessage = ForumMessage.replace(/\[\/u\]/gi, "</u>");
    ForumMessage = ForumMessage.replace(/\[\/i\]/gi, "</i>");
    ForumMessage = ForumMessage.replace(/\[\/list\]/gi, "</ul>");
    ForumMessage = ForumMessage.replace(/\[\/list\=\]/gi, "</ol>");
    ForumMessage = ForumMessage.replace(/\[\/url\]/gi, "</a>");
    ForumMessage = ForumMessage.replace(/\[\/img\]/gi, "</img>");
    ForumMessage = ForumMessage.replace(/\[\/fontsize\]/gi, "</fontsize>");
    ForumMessage = ForumMessage.replace(/\[\/color\]/gi, "</color>");

    return ForumMessage;
}

function StoreCursorLocation(TheTextArea)
{
    if (TheTextArea.createTextRange) 
        TheTextArea.caretPos = document.selection.createRange().duplicate();

    gsNonIEFormType = TheTextArea.name;
}

function InsertAtCursorLocation(TheTextArea, TextToInsert)
{
    if (TheTextArea && 
        TheTextArea.createTextRange && 
        TheTextArea.caretPos)
    {
        var CursorLocation = TheTextArea.caretPos;
        CursorLocation.text = CursorLocation.text.charAt(CursorLocation.text.length - 1) == ' ' ? 
                              TextToInsert + ' ' : TextToInsert;
    }
    else if (!document.all && 
             document.getElementById)
        MozillaReplace(document.getElementById('input' + gsNonIEFormType), TextToInsert);                
    else if (TheTextArea)
        TheTextArea.value  += TextToInsert;
    else 
        document.getElementById('input' + gsNonIEFormType).value += TextToInsert;        
}

function InsertAroundTextSelection(TheTextArea, PreText, PostText)
{
    if (TheTextArea && 
        TheTextArea.createTextRange && 
        TheTextArea.caretPos)
    {
        var CursorLocation = TheTextArea.caretPos;
        CursorLocation.text = PreText + CursorLocation.text + PostText;
    }
    else if (!document.all && 
             document.getElementById)
        MozillaWrap(document.getElementById('input' + gsNonIEFormType), PreText, PostText);        
    else
        document.getElementById('input' + gsNonIEFormType).value += PreText + PostText;
}

function MozillaWrap(TheTextArea, LeftPos, RightPos)
{
    var SelLength = TheTextArea.textLength;
    var SelStart = TheTextArea.selectionStart;
    var SelEnd = TheTextArea.selectionEnd;
    if (SelEnd == 1 || SelEnd == 2)
        SelEnd = SelLength;
    var s1 = (TheTextArea.value).substring(0, SelStart);
    var s2 = (TheTextArea.value).substring(SelStart, SelEnd)
    var s3 = (TheTextArea.value).substring(SelEnd, SelLength);
    TheTextArea.value = s1 + LeftPos + s2 + RightPos + s3;
}

function MozillaReplace(TheTextArea, NewText)
{
    var SelLength = TheTextArea.textLength;
    var SelStart = TheTextArea.selectionStart;
    var SelEnd = TheTextArea.selectionEnd;
    if (SelEnd == 1 || SelEnd == 2)
        SelEnd = SelLength;
    var s1 = (TheTextArea.value).substring(0, SelStart);
    var s2 = (TheTextArea.value).substring(SelEnd, SelLength);
    TheTextArea.value = s1 + NewText + s2;
}

function MozillaSelectedText(TheTextArea)
{
    var SelLength = TheTextArea.textLength;
    var SelStart = TheTextArea.selectionStart;
    var SelEnd = TheTextArea.selectionEnd;
    if (SelEnd == 1 || SelEnd == 2)
        SelEnd = SelLength;
    return (TheTextArea.value).substring(SelStart, SelEnd);
}

function GetSelectionText(TheTextArea)
{
    if (!document.all && 
        document.getElementById)
        return MozillaSelectedText(TheTextArea);
    else
        return TheTextArea.caretPos.text;
}

function IsSelectionEmpty(TheTextArea)
{
    if (TheTextArea && 
        TheTextArea.createTextRange && 
        TheTextArea.caretPos)
        return (TheTextArea.caretPos.text == '');
    else if (!document.all && 
             document.getElementById)
        return (MozillaSelectedText(TheTextArea) == '');
    else
        return true;
}

function NewWindowFromLink(LinkURL)
{
    window.open(LinkURL, 
                "", 
                "statusbar=yes, scrollbars=yes, " +
                "resizable=yes, " +
                "copyhistory=no, " +
                "width=500, " +
                "height=400");
}

function NewPopupWindowFromLink(LinkURL)
{
    window.open(LinkURL, 
                "", 
                "statusbar=no, " +
                "scrollbars=no, " +
                "resizable=no, " +
                "copyhistory=no, " +
                "width=500, " +
                "height=400");
}

function StartItalic()
{
    DocumentWrite("<I>");
}

function EndItalic()
{
    DocumentWrite("</I>");
}

function Span(psText, psClass)
{
    DocumentWrite("<span class=\"" + psClass + "\">");
    DocumentWrite(psText);
    DocumentWriteLine("</span>");
}


function SpanStart(psClass, psStyle)
{
    DocumentWrite("<span")
    DocumentWrite(!psClass?"":" class=\"" + psClass + "\"");
    DocumentWrite(!psStyle?"":" style=\"" + psStyle + "\"");
    DocumentWriteLine(">");
}

function SpanEnd()
{
    DocumentWriteLine("</span>");
}


// DOM functions
function SetVisibility(ElementId, Visible)
{
    document.getElementById(ElementId).style.visibility=(Visible?"inherit":"hidden");
}

function GetVisibility(ElementId)
{
    return document.getElementById(ElementId).style.visibility!="hidden";
}

// My new library functions
function Layer(psSectionId, psSectionClass, psSectionAlignment)
{
    // Constructor
    this.SectionId        = psSectionId;
    this.SectionClass     = (psSectionClass ? psSectionClass : "");
    this.SectionAlignment = (psSectionAlignment ? psSectionAlignment : "");
    
    // member variables
    this.Visibility = "inherit";
    this.Height     = -1;
    this.Width      = -1
    this.Top        = -1
    this.Left       = -1;
    this.Right      = -1;
    this.Bottom     = -1;
    this.Position   = "";

    // method 'headers'
    this.SetVisibility = SetVisibility;
    this.SetPosition   = SetPosition;
    this.SetDimensions = SetDimensions;
    this.BeginLayer    = BeginLayer;
    this.EndLayer      = EndLayer;

    // method 'bodies'
    function SetVisibility (Visible)
    {
        this.Visibility = (Visible?"inherit":"hidden");
    }

    function SetPosition (Relative, Top, Left, Right, Bottom)
    {
        this.Top      = (Top >= 0 ? Top : -1);
        this.Left     = (Left >= 0 ? Left : -1);
        this.Right    = (Right >= 0 ? Right : -1);
        this.Bottom   = (Bottom >= 0 ? Bottom : -1);
        this.Position = (Relative ? "relative" : "absolute");
    }

    function SetDimensions (Width, Height)
    {
        this.Width    = (Width  ? Width  : -1);
        this.Height   = (Height ? Height : -1);
    }

    function BeginLayer ()
    {
        DocumentWriteLine("<DIV id=\"" + this.SectionId + "\"");
            (this.SectionAlignment != "" ? DocumentWriteLine(" align=\""  + this.SectionAlignment + "\""):"");
            (this.SectionClass     != "" ? DocumentWriteLine(" class=\""  + this.SectionClass + "\""):"");

        DocumentWriteLine("     style=\"visibility: " + this.Visibility + ";");
            (this.Width    != -1 ? DocumentWriteLine("width: "  + this.Width + ";"):"");
            (this.Height   != -1 ? DocumentWriteLine("height: " + this.Height + ";"):"");
            (this.Top      != -1 ? DocumentWriteLine("top: "    + this.Top + ";"):"");
            (this.Left     != -1 ? DocumentWriteLine("left: "   + this.Left + ";"):"");
            (this.Right    != -1 ? DocumentWriteLine("right: "  + this.Right + ";"):"");
            (this.Bottom   != -1 ? DocumentWriteLine("bottom: " + this.Bottom + ";"):"");
            (this.Position != "" ? DocumentWriteLine("position: " + this.Position + ";"):"");
        DocumentWriteLine("\">");
    }

    function EndLayer ()
    {
        DocumentWriteLine("</DIV>");
    }

    return this;
}

function PopulateMenuItems(ThePersonTypeId)
{
    if (ThePersonTypeId == -1) // Not logged in
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_LOST_PASSWORD, "Lost Password", "../html/LostLoginIdOrPassword.html");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_REGISTER, "Register", "../html/Register.html");
    }
    else if (ThePersonTypeId == 1 || // Bride
             ThePersonTypeId == 2)   // Groom
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_HOME, "Quick Links", "../asp/Main.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MY_DETAILS, "My Details", "../asp/MyDetails.asp");
    }
    else if (ThePersonTypeId == 3)   // Wedding guest
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/GuestMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_HOME, "Quick Links", "../asp/GuestMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MY_DETAILS, "My Details", "../asp/GuestDetails.asp");
    }
    else if (ThePersonTypeId == 4)   // Administrator
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/AdministratorMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_HOME, "Quick Links", "../asp/AdministratorMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MY_DETAILS, "My Details", "../asp/AdministratorDetails.asp");
    }
    else if (ThePersonTypeId == 5)   // Vendor / Customer
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/IndustryMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_HOME, "Quick Links", "../asp/IndustryMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MY_DETAILS, "My Details", "../asp/IndustryDetails.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MAKE_BUS_PAYMENT, "Pay my account", "../asp/BusinessMakePayment.asp");
    }
    else if (ThePersonTypeId == 6)  // Site Guest
    {
        gaMenu[iMenuCounter++] = new Array(MENU_MAIN, "MAIN", "../asp/SiteGuestMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_HOME, "Quick Links", "../asp/SiteGuestMain.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SPECIALS, "Specials", "../asp/Specials.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_INTRO_LOGIN, "Home", "../asp/Home.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_MY_DETAILS, "My Details", "../asp/SiteGuestDetails.asp");
    }
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_BREAK);
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_TAKE_A_TOUR, "Tour / Tutorial", "javascript:TakeATour()");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_TELL_A_FRIEND, "Tell A Friend", "../asp/TellAFriend.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_CONTACT_US, "Contact Us", "../asp/ContactDetails.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_REGISTER_YOUR_BUSINESS, "Register Your Business", "../asp/RegisterYourBusiness.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_BREAK);
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_ABOUT_US, "About Us", "../asp/About.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_DISCLAIMER, "Disclaimer", "../asp/Disclaimer.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_PRIVACY, "Privacy", "../asp/Privacy.asp");
    if (ThePersonTypeId > 0)
    {
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_BREAK);
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_MAIN, SUBMENU_SIGNOUT, "Sign Out", "../asp/SignOut.asp");
    }

    gaMenu[iMenuCounter++] = new Array(MENU_DIRECTORY, "DIRECTORY", "../asp/Directory.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_DIRECTORY, SUBMENU_DIRECTORY, "Directory", "../asp/Directory.asp");
    if (ThePersonTypeId == 1 ||
        ThePersonTypeId == 2)
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_DIRECTORY, SUBMENU_SHORTLIST, "Short List", "../asp/ShortList.asp");
    if (ThePersonTypeId == 1 ||
        ThePersonTypeId == 2 ||
        ThePersonTypeId == 4)
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_DIRECTORY, SUBMENU_ADD_A_SUPPLIER, "Add A Business", "../asp/AddASupplier.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_DIRECTORY, SUBMENU_BREAK);

    if (ThePersonTypeId != 3 &&
        ThePersonTypeId != -1)
    {
        gaMenu[iMenuCounter++] = new Array(MENU_CALENDAR, "CALENDAR", "../asp/CalendarMonth.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_CALENDAR, SUBMENU_CALENDAR_MONTH, "Month View", "../asp/CalendarMonth.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_CALENDAR, SUBMENU_CALENDAR_DAY, "Daily View", "../asp/CalendarDay.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_CALENDAR, SUBMENU_CALENDAR_ADD, "Add an Entry", "../asp/CalendarDetail.asp");
    }

    if (ThePersonTypeId == 1 ||
        ThePersonTypeId == 2)
    {
        gaMenu[iMenuCounter++] = new Array(MENU_GUESTS, "GUESTS", "../asp/InvitationList.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_INVITATION_LIST, "Invitation List", "../asp/InvitationList.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_INVITATION_ADD, "New Invitation", "../asp/GuestList.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_BREAK);
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_INVITES_SENT, "Invitations Sent", "../asp/InvitationsListingByStatus.asp?StatusId=1");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_RSVPS_RECEIVED, "RSVP's Received", "../asp/InvitationsListingByStatus.asp?StatusId=2");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_PRESENTS_RECEIVED, "Presents Received", "../asp/InvitationsListingByStatus.asp?StatusId=3");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_THANKYOUS_SENT, "Thank-you's Sent", "../asp/InvitationsListingByStatus.asp?StatusId=4");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_BREAK);
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_INVITES_NOT_SENT, "Invitations Not Sent", "../asp/InvitationsListingByStatus.asp?StatusId=1&Done=0");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_RSVPS_NOT_RECEIVED, "RSVP's Not Received", "../asp/InvitationsListingByStatus.asp?StatusId=2&Done=0");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_PRESENTS_NOT_RECEIVED, "Presents Not Received", "../asp/InvitationsListingByStatus.asp?StatusId=3&Done=0");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_GUESTS, SUBMENU_THANKYOUS_NOT_SENT, "Thank-you's Not Sent", "../asp/InvitationsListingByStatus.asp?StatusId=4&Done=0");

        gaMenu[iMenuCounter++] = new Array(MENU_BUDGET_PLANNER, "BUDGET PLANNER","../asp/BudgetCalc.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_BUDGET_PLANNER, SUBMENU_BUDGET_CHECKLIST, "Checklist", "../asp/BudgetCheckList.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_BUDGET_PLANNER, SUBMENU_BUDGET_CALC, "Budget Calculator", "../asp/BudgetCalc.asp");
//        gaSubMenu[iSubMenuCounter++] = new Array(MENU_BUDGET_PLANNER, SUBMENU_BREAK);
//        gaSubMenu[iSubMenuCounter++] = new Array(MENU_BUDGET_PLANNER, SUBMENU_WHOS_PAYING, "Who's Paying ?", "../asp/WhosPaying.asp");
    }
/*    
var MENU_GIFT_REGISTRY = 
var SUBMENU_REGISTRY = 0;
var SUBMENU_VIEW_ITEMS = 1;
var SUBMENU_ADD_ITEM = 2;
var SUBMENU_VIEW_STORES = 3;
var SUBMENU_ADD_STORE = 4;
var SUBMENU_VIEW_PURCHASES = 5;
var SUBMENU_RECORD_PURCHASE = 6;
*/
    if (ThePersonTypeId == 1 ||
        ThePersonTypeId == 2)
    {


    }
    else if (ThePersonTypeId == 3)
    {

    }

    if (ThePersonTypeId == 1 ||
        ThePersonTypeId == 2 ||
        ThePersonTypeId == 3)
    {
        gaMenu[iMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, "PHOTOS", "../asp/ViewPhotos.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_VIEW_PHOTOS, "View Photos", "../asp/ViewPhotos.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_ADD_PHOTOS, "Add Photos", "../asp/AddPhotos.asp");
        if (ThePersonTypeId == 3)
            var DummyLine = 1;
//            gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_SEND_THANKYOU, "Send Comment", "../asp/SendComment.asp");
        else
            gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_SEND_THANKYOU, "Messages & Preferences", "../asp/SendMessage.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_BREAK);
    }
    else
        gaMenu[iMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, "PHOTOS", "../asp/WeddingPhotos.asp");

    gaSubMenu[iSubMenuCounter++] = new Array(MENU_AFTER_THE_WEDDING, SUBMENU_OTHER_WEDDING_PHOTOS, "Other people's photos", "../asp/WeddingPhotos.asp");

    gaMenu[iMenuCounter++] = new Array(MENU_USEFUL_STUFF, "USEFUL STUFF", "../asp/Customs.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_CUSTOMS, "Customs", "../asp/Customs.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_SPEECHES, "Speeches", "../asp/Speeches.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_BREAK);
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_WEDDING_TIPS, "Tips - Part I", "../asp/WeddingTips.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_MORE_WEDDING_TIPS, "Tips - Part II", "../asp/WeddingTipsMore.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_CHOOSING_ACCESSORIES, "Choosing Bridal Accessories", "../asp/ChoosingBridalAccessories.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_BREAK);
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_READINGS_POETIC, "Readings (Poems)", "../asp/ReadingsPoetic.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_READINGS_RELIGIOUS, "Readings (Religion)", "../asp/ReadingsReligious.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_USEFUL_STUFF, SUBMENU_READINGS_LITERATURE, "Readings (Literature)", "../asp/ReadingsLiterature.asp");

    gaMenu[iMenuCounter++] = new Array(MENU_FORUM, "FORUM", "../asp/Forum.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_FORUM, SUBMENU_FORUM, "Wedding Forum", "../asp/Forum.asp");
    gaSubMenu[iSubMenuCounter++] = new Array(MENU_FORUM, SUBMENU_BREAK);

    if (ThePersonTypeId == 4)
    {
        gaMenu[iMenuCounter++] = new Array(MENU_ADMIN, "ADMINISTRATION", "../asp/SiteStatistics.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_ADMIN, SUBMENU_SITE_STATISTICS, "Site Stats", "../asp/SiteStatistics.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_ADMIN, SUBMENU_SEND_NEWSLETTER, "Send Bulk Email", "../asp/SendNewsletter.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_ADMIN, SUBMENU_MAIL_MERGE, "Mail Merge to businesses", "../asp/MailMerge.asp");
        gaSubMenu[iSubMenuCounter++] = new Array(MENU_ADMIN, SUBMENU_MAKE_PAYMENT, "Make Payment", "../asp/MakePayment.asp");

    }
}

