// Document function types--synchronize with EN_DocumentType enumeration.
T_NONE                    = '0';
T_HOME                    = '1';
T_NEWS                    = '2';
T_TOTE                    = '3';
T_ENTRIES                 = '4';
T_ENTRIES_DETAIL          = '5';
T_ENTRIES_TOTE_DETAIL     = '6';
T_RESULTS                 = '7';
T_RESULTS_DETAIL          = '8';
T_RESULTS_TOTE_DETAIL     = '9';
T_DATA                    = 'a';
T_DATA_PAST_PERFORMANCES  = 'b';
T_DATA_SELECTIONS         = 'c';
T_DATA_ANALYSIS           = 'd';
T_DATA_JOCKEYS            = 'e';
T_DATA_CLOSER_LOOK        = 'f';
T_DATA_GRADED_ENTRIES     = 'g';
T_DATA_TRACK_RECORDS      = 'h';
T_DATA_TRAINERS           = 'i';
T_DATA_STANDINGS          = 'j';
T_WATCHES                 = 'k';
T_INTERACT                = 'l';
T_SPORTS                  = 'm';
T_LEADERBOARD             = 'n';
T_LEADERBOARD_TRAINERS    = 'o';
T_LEADERBOARD_JOCKEYS     = 'p';
T_LEADERBOARD_HORSES      = 'q';
T_LEADERBOARD_STALLIONS   = 'r';
T_LEADERBOARD_BEST_BEYERS = 's';
T_SITEMAP                 = 't';
T_LOGIN                   = 'u';

// URLs for the tabs on the horizontal nav bar.
URL_TAB_HOME        = "/";
URL_TAB_PHP         = "/admin/drfwebMembersPage.jsp";
URL_TAB_NEWS        = "/news/content/1.html";
URL_TAB_TOTE        = "http://tote.drf.com/drftote/index.asp";
URL_TAB_ENTRIES     = "/entries/eindex.html";
URL_TAB_RESULTS     = "/results/rindex.html";
URL_TAB_DATA        = "/drfPastPerformance.do";
URL_TAB_WATCHES     = "/CarryoverWatches.do";
URL_TAB_INTERACT    = "http://tote.drf.com/interactive/prospero.asp?Web_Tag=dr-row";
URL_TAB_SPORTS      = "/sports/sports.html";
URL_TAB_LEADERBOARD = "/leaderboard/displayTrainers.html";
URL_TAB_SITEMAP     = "/misc/sitemap.html";

// URLs for masthead vertical nav bar.
URL_MASTHEAD_MENU_MEMBERSHIP  = "http://store.drf.com/drf/custom_template/drf_freemembership.cfm";
URL_MASTHEAD_MENU_BOOKSTORE   = "http://store.drf.com/acb/webpage.cfm?DID=7&WebPage_ID=161&af_id=56";
URL_MASTHEAD_MENU_BUYPPS      = "http://store.drf.com/acb/showprod.cfm?DID=7&CATID=17&ObjectGroup_ID=303&af_id=55";
URL_MASTHEAD_MENU_ACCOUNT     = "http://store.drf.com/drf/custom_template/drf_account_login.cfm";
URL_MASTHEAD_MENU_PERSONALIZE = "/drfTrackPreferences.do";
URL_MASTHEAD_YOUBET  = "/misc/youbet.html";

// URLs for status bar.
URL_STATUS_LOGIN      = "/logonAction.do";
URL_STATUS_LOGOUT     = "/drfwebLogout.do";
URL_STATUS_NEWSSEARCH = "/news/drfwebNewsArchiveSearch.jsp";

//URL for Formulator Page

URL_MASTHEAD_FORMULATOR = "/formulator/formulator_ad.html";

// Customer ID cookie properties.
COOKIE_CUSTOMER_ID_NAME = "drf_web_customer_id";

// Logged in message.
MSG_LOGGED_IN = "You are currently LOGGED IN: ";

// Effective width of the generated table.
TABLE_WIDTH = 770;

function generateMastHead(fnType) 
{
    // Get logged in state
    var isLoggedIn = (document.cookie.indexOf(COOKIE_CUSTOMER_ID_NAME) != -1);

    // Generate the masthead
    document.writeln("<table width=\"" + TABLE_WIDTH + "\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");

//    sendTopNavBar(fnType, isLoggedIn);
    sendMasthead(fnType, isLoggedIn);

    document.writeln("</table>");
}

// function sendTopNavBar(fnType, isLoggedIn) 
// {
//  Preload the mouseover images
//     MM_preloadImages('/eclipse/2002/images/topnav/topnav_home_02.gif',
//       '/eclipse/2002/images/topnav/topnav_news_02.gif',
//         '/eclipse/2002/images/topnav/topnav_tote_02.gif',
//         '/eclipse/2002/images/topnav/topnav_entries_02.gif',
//         '/eclipse/2002/images/topnav/topnav_results_02.gif',
//         '/eclipse/2002/images/topnav/topnav_pps_02.gif',
//         '/eclipse/2002/images/topnav/topnav_watches_02.gif',
//         '/eclipse/2002/images/topnav/topnav_interact_02.gif',
//         '/eclipse/2002/images/topnav/topnav_sports_02.gif',
//         '/eclipse/2002/images/topnav/topnav_leader_02.gif',
//         '/eclipse/2002/images/topnav/topnav_site_02.gif',
// 		'/bc/2002/images/topbull_account_02.gif',
//         '/bc/2002/images/topbull_prefs_02.gif',
//         '/bc/2002/images/topbull_buy_02.gif');
		

//     document.writeln("<tr bgcolor=\"#000000\">");
//     document.writeln("<td>");

//     document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
//     document.writeln("<tr>");
//     document.write("<td>");

//     if (fnType == T_HOME) {
//         document.write("<img src=\"/images/topnav_home_03.gif\" height=\"20\">");
//         }
//     else {
//         if (isLoggedIn == true) {
//             document.write("<a href=\"" + URL_TAB_PHP + "\"");
//             }
//         else {
//             document.write("<a href=\"" + URL_TAB_HOME + "\"");
//             }
            
//         document.write(" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image1816','','/eclipse/2002/images/topnav/topnav_home_02.gif',1)\"><img name=\"Image1816\" border=\"0\" src=\"/eclipse/2002/images/topnav/topnav_home_01.gif\" width=\"71\" height=\"20\"></a>");

//         if (fnType != T_NEWS) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if (fnType == T_NEWS) {
//         document.write("<img src=\"/images/topnav_news_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_NEWS + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('new16','','/eclipse/2002/images/topnav/topnav_news_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_news_01.gif\" width=\"54\" height=\"20\" name=\"new16\" alt=\"News\" border=\"0\"></a>");

//         if (fnType != T_TOTE) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if (fnType == T_TOTE) {
//         document.write("<img src=\"/images/topnav/topnav_tote_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"JavaScript:self.location.href=VerifyUserLogin('" + URL_TAB_TOTE + "');\"");
//         document.write(" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('tot16','','/eclipse/2002/images/topnav/topnav_tote_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_tote_01.gif\" width=\"51\" height=\"20\" name=\"tot16\" alt=\"Tote\" border=\"0\"></a>");

//         if ((fnType != T_ENTRIES) && (fnType != T_ENTRIES_DETAIL)) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if ((fnType == T_ENTRIES) || (fnType == T_ENTRIES_DETAIL)) {
//         document.write("<img src=\"/images/topnav_entries_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_ENTRIES + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('ent16','','/eclipse/2002/images/topnav/topnav_entries_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_entries_01.gif\" width=\"70\" height=\"20\" name=\"ent16\" alt=\"Entries\" border=\"0\"></a>");

//         if ((fnType != T_RESULTS) && (fnType != T_RESULTS_DETAIL)) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if ((fnType == T_RESULTS) || (fnType == T_RESULTS_DETAIL)) {
//         document.write("<img src=\"/images/topnav_results_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_RESULTS + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('res16','','/eclipse/2002/images/topnav/topnav_results_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_results_01.gif\" width=\"71\" height=\"20\" name=\"res16\" alt=\"Results\" border=\"0\"></a>");

//         if ((fnType != T_DATA) && (fnType != T_DATA_PAST_PERFORMANCES) && (fnType != T_DATA_SELECTIONS) && (fnType != T_DATA_ANALYSIS) && (fnType != T_DATA_JOCKEYS) && (fnType != T_DATA_CLOSER_LOOK) && (fnType != T_DATA_GRADED_ENTRIES) && (fnType != T_DATA_TRACK_RECORDS) && (fnType != T_DATA_TRAINERS) && (fnType != T_DATA_STANDINGS)) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if ((fnType == T_DATA) || (fnType == T_DATA_PAST_PERFORMANCES) || (fnType == T_DATA_SELECTIONS) || (fnType == T_DATA_ANALYSIS) || (fnType == T_DATA_JOCKEYS) || (fnType == T_DATA_CLOSER_LOOK) || (fnType == T_DATA_GRADED_ENTRIES) || (fnType == T_DATA_TRACK_RECORDS) || (fnType == T_DATA_TRAINERS) || (fnType == T_DATA_STANDINGS)) {
//         document.write("<img src=\"/images/topnav_pps_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_DATA + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('pps16','','/eclipse/2002/images/topnav/topnav_pps_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_pps_01.gif\" width=\"49\" height=\"20\" name=\"pps16\" alt=\"Download Data\" border=\"0\"></a>");

//         if (fnType != T_WATCHES) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if (fnType == T_WATCHES) {
//         document.write("<img src=\"/images/topnav_watches_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"JavaScript:self.location.href=VerifyUserLogin('" + URL_TAB_WATCHES + "');\"");
//         document.write(" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('wat14','','/eclipse/2002/images/topnav/topnav_watches_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_watches_01.gif\" width=\"77\" height=\"20\" name=\"wat14\" alt=\"Watches\" border=\"0\"></a>");

//         if (fnType != T_INTERACT) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if (fnType == T_INTERACT) {
//      document.write("<img src=\"/images/topnav_interact_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"JavaScript:self.location.href=VerifyUserLogin('" + URL_TAB_INTERACT + "');\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('int16','','/eclipse/2002/images/topnav/topnav_interact_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_interact_01.gif\" width=\"78\" height=\"20\" name=\"int16\" alt=\"Interact\" border=\"0\"></a>");

//         if (fnType != T_SPORTS) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if (fnType == T_SPORTS) {
//         document.write("<img src=\"/images/topnav_sports_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_SPORTS + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('spo16','','/eclipse/2002/images/topnav/topnav_sports_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_sports_01.gif\" width=\"68\" height=\"20\" name=\"spo16\" alt=\"Sports\" border=\"0\"></a>");

//         if ((fnType != T_LEADERBOARD) && (fnType != T_LEADERBOARD_TRAINERS) && (fnType != T_LEADERBOARD_JOCKEYS) && (fnType != T_LEADERBOARD_HORSES) && (fnType != T_LEADERBOARD_STALLIONS) && (fnType != T_LEADERBOARD_BEST_BEYERS)) {
//             document.write("<img src=\"/eclipse/2002/images/topnav/topnav_divider.gif\" width=\"3\" height=\"20\" border=\"0\">");
//             }
//         }

//     if ((fnType == T_LEADERBOARD) || (fnType == T_LEADERBOARD_TRAINERS) || (fnType == T_LEADERBOARD_JOCKEYS) || (fnType == T_LEADERBOARD_HORSES) || (fnType == T_LEADERBOARD_STALLIONS) || (fnType == T_LEADERBOARD_BEST_BEYERS)) {
//         document.write("<img src=\"/images/topnav_leader_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_LEADERBOARD + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('lead16','','/eclipse/2002/images/topnav/topnav_leader_02.gif',1)\"><img src=\"/eclipse/2002/images/topnav/topnav_leader_01.gif\" width=\"70\" height=\"20\" name=\"lead16\" alt=\"Leaderboard\" border=\"0\"></a>");
//         }

//     document.writeln("</td>");
// 	document.writeln("<td>");
// 	document.write("<img src=\"/eclipse/2002/images/topnav/topnav_spacer.gif\" width=\"16\" height=\"20\" border=\"0\">");
// 	document.writeln("</td>");
//     document.write("<td align=\"right\">");

//     if (fnType == T_SITEMAP) {
//         document.write("<img src=\"/images/topnav_site_03.gif\" height=\"20\">");
//         }
//     else {
//         document.write("<a href=\"" + URL_TAB_SITEMAP + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image3616','','/eclipse/2002/images/topnav/topnav_site_02.gif',1)\"><img name=\"Image3616\" border=\"0\" src=\"/eclipse/2002/images/topnav/topnav_site_01.gif\" width=\"58\" height=\"20\" alt=\"Site Map\" border=\"0\"></a>");
//         }

//     document.write("</td>");

//     document.writeln("</tr>");
//     document.writeln("</table>");

//     document.writeln("</td>");
//     document.writeln("</tr>");
// }

function sendMasthead(fnType, isLoggedIn) 
{
    // Generate masthead proper
	//document.writeln("<tr bgcolor=\"#007681\">");
    //document.writeln("<td><img src=\"/bc/2002/images/007681.gif\" width=\"4\" height=\"4\"></td>");
    //document.writeln("</tr>");
    //document.writeln("<tr>");
    //document.writeln("<td>");
     document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
     document.writeln("<tr>");
    // document.writeln("<td valign=\"top\" width=\"140\" align=\"left\">");

    // Generate masthead vertical nav bar
    // document.writeln("<table bgcolor=\"#007681\" width=\"140\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
    
        
    // if (isLoggedIn == true) {
    //     if (fnType != T_TOTE) {
    //         document.writeln("<tr>");
    //         document.writeln("<td><a href=\"" + URL_MASTHEAD_MENU_ACCOUNT + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('account','','/bc/2002/images/topbull_account_02.gif',1)\"><img src=\"/bc/2002/images/topbull_account_01.gif\" width=\"140\" height=\"15\" name=\"account\" border=\"0\"></a></td>");
    //         document.writeln("</tr>");
    //         }

    //     document.writeln("<tr>");
    //     document.writeln("<td><a href=\"#null\" onClick=\"window.open('" + URL_MASTHEAD_MENU_PERSONALIZE + "','personalize','scrollbars=yes,resizable=yes,width=490,height=550');\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('pref','','/bc/2002/images/topbull_prefs_02.gif',1)\"><img src=\"/bc/2002/images/topbull_prefs_01.gif\" width=\"140\" height=\"15\" name=\"pref\" border=\"0\"></a></td>");
   //      document.writeln("</tr>");
   //      }
   //  else {
   //      document.writeln("<tr>");
   //      document.writeln("<td><a href=\"" + URL_MASTHEAD_MENU_MEMBERSHIP + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('fre','','/bc/2002/images/topbull_free_02.gif',1)\"><img src=\"/bc/2002/images/topbull_free_01.gif\" width=\"140\" height=\"15\" name=\"fre\" border=\"0\"></a></td>");
   //     document.writeln("</tr>");
   //      document.writeln("<tr>");
   //      document.writeln("<td><a href=\"" + URL_MASTHEAD_MENU_BOOKSTORE + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('boo','','/bc/2002/images/topbull_book_02.gif',1)\"><img src=\"/bc/2002/images/topbull_book_01.gif\" width=\"140\" height=\"15\" name=\"boo\" border=\"0\"></a></td>");
   //      document.writeln("</tr>");
   //      }
    
    // if ((fnType != T_DATA_PAST_PERFORMANCES) && (fnType != T_DATA_SELECTIONS) && (fnType != T_DATA_ANALYSIS) && (fnType != T_DATA_JOCKEYS) && (fnType != T_DATA_CLOSER_LOOK) && (fnType != T_DATA_GRADED_ENTRIES) && (fnType != T_DATA_TRACK_RECORDS) && (fnType != T_DATA_TRAINERS) && (fnType != T_DATA_STANDINGS)) {
    //     document.writeln("<tr>");
    //     document.writeln("<td><a href=\"" + URL_MASTHEAD_MENU_BUYPPS + "\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('buy','','/bc/2002/images/topbull_buy_02.gif',1)\"><img src=\"/bc/2002/images/topbull_buy_01.gif\" width=\"140\" height=\"15\" name=\"buy\" border=\"0\"></a></td>");
    //     document.writeln("</tr>");
    //     }
    
    // document.writeln("</table>");
    // document.writeln("</td>");

    // Generate masthead images and links references
        if ((fnType != T_TOTE) &&
            (fnType != T_DATA_PAST_PERFORMANCES) &&
             (fnType != T_DATA_SELECTIONS) &&
             (fnType != T_DATA_ANALYSIS) &&
             (fnType != T_DATA_JOCKEYS) &&
             (fnType != T_DATA_CLOSER_LOOK) &&
             (fnType != T_DATA_GRADED_ENTRIES) &&
             (fnType != T_DATA_TRACK_RECORDS) &&
             (fnType != T_DATA_TRAINERS) &&
             (fnType != T_DATA_STANDINGS)) {
             if ((fnType != T_ENTRIES) &&
    			 (fnType != T_RESULTS) &&
    			 (fnType != T_DATA) &&
    			 (fnType != T_ENTRIES_DETAIL) &&
	    		 (fnType != T_RESULTS_DETAIL))
	    //		{
	    //		document.writeln("<td height=\"89\"><a href=\"/\"><img src=\"/eclipse/2002/images/eclipse_upper-1125_05.gif\" width=\"528\" height=\"89\" border=\"0\"></a></td>");
	    //		document.writeln("<td width=\"232\">");
       //     	document.writeln("<table bgcolor=\"#D04000\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	    //		document.writeln("<tr>");
	    //		document.writeln("<td><a href=\"/eclipse/2002/polls/polls.html\"><img src=\"/eclipse/2002/images/eclipse_upper_04a.gif\" width=\"232\" height=\"30\" border=\"0\"></a></td>");
      //      	document.writeln("</td>");
      //      	document.writeln("</tr>");
	    //		document.writeln("<tr>");
	    //		document.writeln("<td><a href=\"http://www.thoroughbredmemories.com/Index.cfm?vendorID=dfr\"><img src=\"/eclipse/2002/images/eclipse_upper_06a.gif\" width=\"232\" height=\"59\" border=\"0\"></a></td>");
       //     	document.writeln("</td>");
        //    	document.writeln("</tr>");
	    //		document.writeln("</table>");
	    //		document.writeln("</td>");
	    //		}         
      //       else
    //			{
	    //		document.writeln("<td height=\"89\"><a href=\"/\"><img src=\"/eclipse/2002/images/eclipse_upper-1125_05.gif\" width=\"528\" height=\"89\" border=\"0\"></a></td>");
	    //		document.writeln("<td width=\"232\">");
       //     	document.writeln("<table bgcolor=\"#D04000\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	    //		document.writeln("<tr>");
	    //		document.writeln("<td><a href=\"/eclipse/2002/polls/polls.html\"><img src=\"/eclipse/2002/images/fan_polls_232x30.gif\" width=\"232\" height=\"30\" border=\"0\"></a></td>");
        //    	document.writeln("</td>");
      //      	document.writeln("</tr>");
	    //		document.writeln("<tr>");
	    //		document.writeln("<td><a href=\"http://www.thoroughbredmemories.com/Index.cfm?vendorID=dfr\"><img src=\"/eclipse/2002/images/photos_232x59.gif\" width=\"232\" height=\"59\" border=\"0\"></a></td>");
        //    	document.writeln("</td>");
        //    	document.writeln("</tr>");
	    //		document.writeln("</table>");
	    //		document.writeln("</td>");
	    //		}
     //       document.writeln("</tr>");
      //      document.writeln("</table>");
     //       document.writeln("</td>");
    //        document.writeln("</tr>");

        // Generate login form
        sendLoginElement(fnType, isLoggedIn);
        }
    else {
        document.writeln("<td align=\"center\"><img src=\"/images/drf_com_small.gif\" width=\"120\" height=\"32\"><img src=\"/images/oldstyle_logo_small.gif\" width=\"176\" height=\"32\"></td>");

        // Generate today's date
       sendDateElement();

       document.writeln("</tr>");
       document.writeln("</table>");
       document.writeln("</td>");
        document.writeln("</tr>");
        }
}

function sendLoginElement(fnType, isLoggedIn) 
{
    //document.writeln("<tr nowrap bgcolor=\"#D04000\">");
    //document.writeln("<td>");
    document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
    document.writeln("<tr>");

    // Generate login form
    document.writeln("<td height=\"23\" bgcolor=\"#1F526A\" valign=\"top\" align=\"left\">");
    document.writeln("<table border=\"0\">");
	
	if (fnType != T_LOGIN) {
        if (isLoggedIn == true) {
            document.writeln("<tr>");
            //document.writeln("<td><img src=\"/images/blank.gif\" width=\"5\" height=\"10\"></td>");
            document.writeln("<td height=\"16\" nowrap width=\"73%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#FFFFFF\" size=\"1\">"+ MSG_LOGGED_IN + "</font></td>");
            document.writeln("<td height=\"16\"><a href=\"" + URL_STATUS_LOGOUT + "\"><img src=\"/dmr/2005/images/logout.gif\" width=\"56\" height=\"16\" border=\"0\" alt=\"Logout\"></a></td>");
            document.writeln("</tr>");
            }
        else {
			document.writeln("<form name=\"login\" action=\"" + URL_STATUS_LOGIN + "\" method=\"post\">");
            document.writeln("<tr>");
            document.writeln("<td height=\"16\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#FFFFFF\" size=\"1\">Login:</font>&nbsp;</td>");
            document.writeln("<td height=\"16\"><input class=\"input\" type=\"text\" name=\"p_full_name\" size=\"10\" maxlength=\"16\"></td>");
            document.writeln("<td height=\"16\">&nbsp;&nbsp;<font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#FFFFFF\" size=\"1\">Password:</font>&nbsp;</td>");
            document.writeln("<td height=\"16\"><input class=\"input\" type=\"password\" name=\"p_password\" size=\"10\" maxlength=\"16\"></td>");
            document.writeln("<td height=\"16\"><a href=\"JavaScript:document.login.submit();\"><img src=\"/dmr/2005/images/go_button.gif\" width=\"50\" height=\"16\" border=\"0\" alt=\"Login\"></a></td>");
			document.writeln("</tr>");
            document.writeln("</form>");
            }
        }
    else {
        document.writeln("<tr>");
        document.writeln("<td><img src=\"/images/blank.gif\" width=\"200\" height=\"10\"></td>");
        document.writeln("</tr>");
        }
   
    document.writeln("</table>");
    document.writeln("</td>");

    // Generate today's date
    sendDateElement();

    // Generate search form
    document.writeln("<td valign=\"bottom\" align=\"right\"><a href=\"" + URL_STATUS_NEWSSEARCH + "\"><img src=\"/dmr/2005/images/archives_157x16.gif\" width=\"157\" height=\"16\" alt=\"News Archive Search\" border=\"0\"></a>&nbsp;&nbsp;</td>");
    document.writeln("</tr>");
    document.writeln("</table>");
    document.writeln("</td>");
    document.writeln("</tr>");
}

function sendDateElement()
{
    document.write("<td align=\"right\" height=\"16\"><font face=\"Verdana, Arial\" color=\"#FFFFFF\" size=\"1\">");
    document.write("<script language=\"JavaScript\">");
    document.write("JavaScript:todayIs()");
    document.write("</script>");
    document.writeln("</font>&nbsp;</td>");
}
