// Ajax4Hire.js
//**************************************************************************
//	cTitleMSG should be defined before.
//	Format the standard title/head for all Ajax4Hire web sites..

var cHTMLrdir;  	// import =root directory; may be defined earlier..
var cTitleInfo; 	// export =cTitleHead+cNavigationBar
var cTitleHead; 	// export =Title heading
var cNavigationBar;	// export =navigation bar = Home+Search+Special
var cSearchBar; 	// export =search   bar html
var fSearchBar; 	// export =search   bar true=display
var cSpecialBar;	// export =special  bar html
var fSpecialBar;	// export =special  bar true=display
var cHomelinkBar;	// export =Homelink bar html
var fHomelinkBar;	// export =Homelink bar true=display
var cMIPS24kBar;    // export =MIPS24k/Linux  bar html
var fMIPS24kBar;    // export =MIPS24k/Linux  bar true=display
var cHiLite;		// Mouse over/out hilite coloring
var cWarnNoHTML;	// Mouse over/out warning there is not HTML
var uIconHeight=26;	// Icon height for Search/Special bar
var cIPaddr_Public="127.0.0.1";

// 	define some constants..
var cHTMLbase   = "http://www.ajax4hire.com";
var cHTMLindexL	= "site_map.html";

if(cHTMLrdir    == null) cHTMLrdir    = '';
if(fHomelinkBar == null) fHomelinkBar = "YES";
if(fSearchBar   == null) fSearchBar   = "YES";
if(fSpecialBar  == null) fSpecialBar  = "YES";
if(fMIPS24kBar  == null) fMIPS24kBar  = "NO";

//	define variables for friendly time display
var cTimeNOW_hr = new Date().getHours();
var                     cTimeNOW_am  = "am";
if( cTimeNOW_hr > 12) { cTimeNOW_am  = "pm";
						cTimeNOW_hr -=  12; }
if( cTimeNOW_hr == 0) { cTimeNOW_hr  =  12; }

var cTimeNOW = new Date();
//	define the friendly time display string (h:mm:ssam/pm)
function Format_TimeNOW() {
  cTimeNOW =    cTimeNOW_hr
			+":"+Math.floor(new Date().getMinutes()/10)
				+Math.floor(new Date().getMinutes()%10)
			+":"+Math.floor(new Date().getSeconds()/10)
				+Math.floor(new Date().getSeconds()%10)
				+cTimeNOW_am;
}
//	define the friendly date display string (h:mm:ssam/pm)
var cDateDay   = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
var cDateMonth = new Array('Jan', 'Feb', 'Mar',
                           'Apr', 'May', 'Jun',
                           'Jul', 'Aug', 'Sep',
                           'Oct', 'Nov', 'Dec');
                        var cDateNOW = new Date().toDateString();
function Format_DateNOW() {
  var oNow = new Date();
//cDateNOW = oNow.toDateString();
  cDateNOW = cDateDay[oNow.getDay()]+' '
            +cDateMonth[oNow.getMonth()]+' '
            +oNow.getDate()+', '
            +oNow.getFullYear();
}
var cPageNOW;
function Format_PageNOW() {
    cPageNOW = ''
//           + '<b>Last update:</b> '+document.lastModified
//           + '&nbsp;&nbsp;&nbsp;'
             + 'now:&nbsp;'
             +cDateNOW+' - '+cTimeNOW;
}
//*********************************************************************
//	constant string for Head Text, <home> and <list of all>
//	JavaScript output after <body> in all html files..
//	defined here to make global
function make_TitleHead() {
  Format_TimeNOW();
  Format_DateNOW();
  Format_PageNOW();
  cTitleHead = '<center><font color=black>'
+ '<table bgcolor="white" width="100%" align="center" border=0 cellpadding=0 cellspacing=0><tbody><tr>'
+   '<td align="left"   height="60" width="60"><a href="http://RedPluto.com/"  ><img src="http://RedPluto.com/Images/RedPluto_x60.jpg"    height="100%" alt="RedPluto.com"  border=0></a></td>'
+   '<td align="left"   height="60" width="56"><a href="'+cHTMLbase+'"         ><img src="'+cHTMLrdir+'Images/Ajax4Hire_x60.jpg"          height="100%" alt="Ajax4Hire.com" border=0></a></td>'
+   '<td align="center" height="60" valign="top">'
+     '<FONT SIZE=+3><b>'+cTitleMSG+'</b></font><br>'
+cPageNOW
//+     '<b>Last update:</b> '+document.lastModified
//+     '&nbsp;&nbsp;&nbsp;'
//+     '<b>load time: </b>+cDateNOW+' '+cTimeNOW
//+     ';<a href="mailto:&#65;&#106;&#97;&#120;&#52;&#72;&#105;&#114;&#101;&#64;&#99;&#111;&#109;&#99;&#97;&#115;&#116;&#46;&#99;&#111;&#109;">EMail Contact.</a>'
+   '</td>'
+   '<td align="center" height="60" width="3"></td>'
+   '<td align="right"  height="60" width="102"><a href="http://192.168.100.1/"><img src="http://ajax4hire.com/Images/cablemodem_sa.gif"  height="100%" alt="HomeNetwork-CableModem - 192.168.100.1" border=0></a></td>'
+   '<td align="right"  height="60" width="60" ><a href="http://192.168.1.1/"  ><img src="http://ajax4hire.com/Images/router.gif"         height="100%" alt="HomeNetwork-Router - 192.168.1.1"       border=0></a></td>'
//+ '<td align="right"  height="60" width="60" ><a href="http://'+cIPaddr_Public+'"><img src="'+cHTMLrdir+'Images/home.gif"               height="100%" alt="Alternate: '+cIPaddr_Public+'"          border=0></a></td>'
+ '</tr></tbody></table></font></center>';
}
//**************************************************************************
function set_cHiLiteColor(cHiLiteColor) {
  cHiLite = 'onMouseOver="javascript: this.style.backgroundColor=\''+cHiLiteColor+'\';"'
           +'onMouseOut ="javascript: this.style.backgroundColor=\'\';"';
}
//**************************************************************************
function href_from_info(cHREF, cTitle, cDescription, iBR) {
  document.write('<a href="'+cHREF+'" '+cHiLite+'title="'+cDescription+'"><b>'+cTitle+'</b></a>');
}
//**************************************************************************
function Format_BarInfo(cHREF, cIconPrefix, cIcon, cTitle) {
  if (cTitle  ==  null) { cTitle = cHREF;               } else
  if (cTitle  ==    "") { cTitle = cHREF;               } else
                        { cTitle = cHREF+' - '+cTitle;  }
  return('<td><nobr><a href="http://'+cHREF+'" title="'+cTitle+'"><img src="'+cIconPrefix+cIcon+'"width="100%" height="'+uIconHeight+'" alt="+cTitle+" border=0></a></td>');
}
//**************************************************************************
function make_SearchBar() {
  var cIconPrefix=cHTMLrdir+'Images/SearchBar/';
  set_cHiLiteColor("lime");
  cSearchBar  = '<table width="100%" bgcolor=#ffffff border=0 cellpadding=0 cellspacing=0><tbody><tr>';
//cSearchBar += '  <td align="right" width="80"><nobr><FONT SIZE="+2"><b>Search:</b></font></nobr></td>';
  cSearchBar += Format_BarInfo("Google.com"            , cIconPrefix, "google.com.gif"      );
  cSearchBar += Format_BarInfo("My.Yahoo.com"          , cIconPrefix, "myyahoo.com.gif"     );
  cSearchBar += Format_BarInfo("Bing.com"              , cIconPrefix, "bing.com.gif"        );
  cSearchBar += Format_BarInfo("Wikipedia.org"         , cIconPrefix, "wikipedia.org.gif"   );
  cSearchBar += Format_BarInfo("IMDB.com"              , cIconPrefix, "imdb.com.gif"         , "Internet Movie Database");
  cSearchBar += Format_BarInfo("Yellowpages.com"       , cIconPrefix, "yellowpages.com.gif" );
  cSearchBar += Format_BarInfo("Amazon.com"            , cIconPrefix, "amazon.com.gif"      );
  cSearchBar += Format_BarInfo("eBay.com"              , cIconPrefix, "ebay.com.gif"        );
//cSearchBar += Format_BarInfo("Answers.com"           , cIconPrefix, "answers.com.gif"     );
//cSearchBar += Format_BarInfo("MSN.com"               , cIconPrefix, "msn.com.gif"         );
//cSearchBar += Format_BarInfo("Mahalo.com"            , cIconPrefix, "mahalo.com.gif"      );
//cSearchBar += Format_BarInfo("Yahoo.com"             , cIconPrefix, "yahoo.com.gif"       );
//cSearchBar += Format_BarInfo("kartoo.com"            , cIconPrefix, "kartoo.com.gif"      );
//cSearchBar += Format_BarInfo("Ask.com"               , cIconPrefix, "askjeeves.com.gif"   );
//cSearchBar += Format_BarInfo("Lycos.com"             , cIconPrefix, "lycos.com.gif"       );
//cSearchBar += Format_BarInfo("A9.com"                , cIconPrefix, "a9.com.gif"          );
//cSearchBar += Format_BarInfo("AllTheWeb.com"         , cIconPrefix, "alltheweb.com.gif"   );
//cSearchBar += Format_BarInfo("WebCrawler.com"        , cIconPrefix, "webcrawler.com.gif"  );
//cSearchBar += Format_BarInfo("AltaVista.com"         , cIconPrefix, "altavista.com.gif"   );
  cSearchBar += Format_BarInfo("RedPluto.com/ForSale/" , cIconPrefix, "forsale.gif");
  cSearchBar += '</tr></tbody></table>';
}
//**************************************************************************
function make_SpecialBar() {
  var cIconPrefix=cHTMLrdir+'Images/SpecialBar/';
  set_cHiLiteColor("lime");
  cSpecialBar  = '<table width="100%" bgcolor=#ffffff border=0 cellpadding=0 cellspacing=0><tbody><tr>';
//cSpecialBar += '  <td align="right" width="80"><nobr><FONT SIZE="+2"><b>Special:</b></font></nobr></td>';
  cSpecialBar += Format_BarInfo("renweb.com"           , cIconPrefix, "renweb.com.gif");
  cSpecialBar += Format_BarInfo("youtube.com"          , cIconPrefix, "youtube.com.gif");
  cSpecialBar += Format_BarInfo("maps.google.com"      , cIconPrefix, "googlemaps.gif");
//cSpecialBar += Format_BarInfo("virtualearth.msn.com" , cIconPrefix, "msnmaps.gif");
  cSpecialBar += Format_BarInfo("mail.google.com"      , cIconPrefix, "google.com_gmail.gif");
  cSpecialBar += Format_BarInfo("google.com/calendar"  , cIconPrefix, "google.com_calendar.gif");
  cSpecialBar += Format_BarInfo("google.com/contacts"  , cIconPrefix, "google.com_contacts.gif");
  cSpecialBar += Format_BarInfo("facebook.com"         , cIconPrefix, "facebook.com.gif");
  cSpecialBar += Format_BarInfo("twitter.com"          , cIconPrefix, "twitter.com.gif");
  cSpecialBar += Format_BarInfo("LinkedIn.com"         , cIconPrefix, "linkedin.com.gif");
  cSpecialBar += '</tr></tbody></table>';
}
//**************************************************************************
// NOTE: the items in the next three arrays are TUPLES:
// 	[URL, button text, descriptive title]
//	list them in the order you want them to appear on screen.
var linkTxt = new Array('Home',       'Personal',                   'News-Info',                     'Funny',               'Company',                 /*'Commerce',                */ /*'Government',                               */ 'Linux',                             /*'Finance',              */ /*'Cool Sites',                 */ 'JavaScriptEx',          'SiteMap'             );
var linkURL = new Array('index.html', 'personal.html',              'newsinfo.html',                 'funny.html',          'company.html',            /*'commerce.html',           */ /*'govermnt.html',                            */ 'linux.html',                        /*'finance.html',         */ /*'internet.html',              */ 'JavaScript/index.html', 'site_map.html'       );
var linkTtl = new Array('Home page',  'Personal: Banks & ID sites', 'Newspapers, TV, Radio, Online', 'Comics & Editorials', 'Company @Work resources', /*'Commerce, shopping, eBay',*/ /*'Federal, State and Local Government sites',*/ 'All things Linux: GNU, Gnome, KDE', /*'Finance, Bank, Stocks',*/ /*'Search, Portals, Cool sites',*/ 'JavaScripe Examples',   'Index of all content');
function make_HomelinksBar() {
  cHomelinkBar =  '<table width="100%" bgcolor=#ffffcc border=0 cellpadding=1 cellspacing=0><tbody>'
              +   '<tr width="100%">';
  set_cHiLiteColor("aqua");
  for(var ii=0; (ii < linkURL.length); ii++) {
    // if this is not the current page, the button is active
    if(location.href.indexOf(cHTMLrdir+linkURL[ii]) == -1) {
      cHomelinkBar += '<td align=center><nobr><b>'
                   +  '<a class=nav TARGET="_top" '
                   +    'title="'+linkTtl[ii]+'" '
                   +    'href ="'+cHTMLrdir+linkURL[ii]+'"'
                   +    cHiLite+'>'+linkTxt[ii]+'</a></b></nobr></td>';
    } else {
      // otherwise, the button is inactive
      cHomelinkBar += '<td align="center" bgcolor="#00cccc"><nobr><b>'+linkTxt[ii]+'</b></nobr></td>';
    }
  }
  cHomelinkBar +=     '</tr>'
               +    '</tbody></table>'
               +  '</td></tr>';
}
//**************************************************************************
function Navigation_Bar() {
  cNavigationBar  = '<center>';
  cNavigationBar += '<table width=100% bgcolor=#000000 border=2 cellpadding=1 cellspacing=0><tbody>';
  make_HomelinksBar(); if(fHomelinkBar == "YES") cNavigationBar += '<tr><td width="100%">'+cHomelinkBar+'</td></tr>';
  make_SearchBar();    if(fSearchBar   == "YES") cNavigationBar += '<tr><td width="100%" height="'+uIconHeight+'">'+cSearchBar +'</td></tr>';
  make_SpecialBar();   if(fSpecialBar  == "YES") cNavigationBar += '<tr><td width="100%" height="'+uIconHeight+'">'+cSpecialBar+'</td></tr>';
                       if(fMIPS24kBar  == "YES") cNavigationBar += '<tr><td width="100%" height="'+uIconHeight+'">'+cMIPS24kBar+'</td></tr>';
  cNavigationBar += '</tbody></table></center>';
}
//**************************************************************************
function table_info_TD(cHREF, cTitle1, cTitle2) {
  document.write('<td>');
  document.write(
 '<table width=100% border=0 cellpadding=0 cellspacing=0 TITLE="'+cTitle1+'"><tbody><tr>'
+'  <td align="right" valign="top" title="'+cTitle1+'" width="48" heigth="48">'
+'    <a href="'+cHREF+'/index.html"><img src="'+cHREF+'/title.gif" alt="'+cTitle1+'" border=0></a>'
+'  </td>'
+'  <td align="left" width="2"></td>'
+'  <td align="left">'
+'    <a  href="'+cHREF+'/index.html">'
+'    <FONT SIZE=+1><b>'+cTitle1+'</b></font><br>'
+'    <FONT SIZE=+0><b>'+cTitle2+'</font></a>'
+'  </td>'
+'</tr></tbody></table>');
  document.write('</td>');
}

//document.write(
// '<style type="text/css"><!--'
//+'  .txt_navbar { font-family:arial,san-serif; font-style:normal; font-size:6pt; text-align:center; }'
//+'--></style>');
//**************************************************************************
function TitleHead_Left(cText, cFont, cHRwidth) {
  if (cHRwidth == null) cHRwidth=7;
                     document.write('<table align="center" valign="top" width="100%" border=0 cellpadding=2 cellspacing=0><tbody><tr>');
                     document.write('<td align="left" nowrap="nowrap">');
  if (cFont != null) document.write('<font '+cFont+'>');
                     document.write('<b>&nbsp;'+cText+'&nbsp;</b>');
  if (cFont != null) document.write('</font>');
                     document.write('</td><td align="left" width="95%">');
  if (cHRwidth > 0)  document.write('<hr noshade size="'+cHRwidth+'" color="#000000">');
                     document.write('</td><td align="right">&nbsp;</td>');
                     document.write('</tr></tbody></table>');
}
//**************************************************************************
function VerticalBar(cHeight, cTextAfter) {
  var cG_HBname="g_hbarc.gif";
  if(cHeight    == null) { cHeight = 32;    }
  if(cTextAfter == null) { cTextAfter = ''; }
  if(cHeight    ==   32) { cG_HBname="g_hbarc32.gif"; } else
  if(cHeight    ==   48) { cG_HBname="g_hbarc48.gif"; }
  document.write('<img src="Images/'+cG_HBname+'" height="'+cHeight+'" border=0>'+cTextAfter);
}
//**************************************************************************
//    Icon2HTML(cHTTP=0 means use default "http://
//              cHREF=href link to site,
//              cIcon=icon name in current cHTTP+cHREF/cIcon,
//              cTitle=text for no icon mouseover,
//              fTarget=non-zero for new tab; ie. target="blank",
//              cPostSpace=space after icon, default is " ", one space, enter '' for none);
//  set cPostSpace='' (rather than default of " "=1space) so horizontal bar is evenly spaced.
//  add on any Icon2HTML that is befor a g_hbarc.gif, graphic horizontal bar
function Icon2HTML(cHTTP, cHREF, cIcon, cTitle, fTarget, cPostSpace) {
  if (cTitle  ==  null) { cTitle = cHREF;               } else
  if (cTitle  ==    "") { cTitle = cHREF;               } else
  if (cHTTP   ==     0) { cTitle = cHREF+' - '+cTitle;  }
  if (fTarget ==  null) { fTarget = '';                 }
  if((fTarget  >     0) ||
     (fTarget == "YES")) { fTarget = ' target="'+cTitle+'"'; }
  if((cHTTP   ==  null) ||
     (cHTTP   <=     0)) { cHTTP  = "http://";          }
  if((cHTTP   == "YES") ||
     (cHTTP   ==     1)) { cHTTP  = "https://";         }
  if((cHTTP   ==     2)) { cHTTP = '';                  }
                    else { cIcon = 'Images/'+cIcon;     }

  if(cHREF != null) document.write('<a href="'+cHTTP+cHREF+'"'+fTarget+'>');
  if(cIcon != null) document.write('<img src="'+cIcon+'" border=0 alt="'+cTitle+'" title="'+cTitle+'">');
//if(cHREF != null) document.write('</a>&nbsp;');
  if(cHREF != null) document.write('</a>');
  if(cPostSpace == null) { document.write(" ");         }
                    else { document.write(cPostSpace);  }
}
//***************************************************************************
function not_IE_Browser() {
  var iNavigatorInUse;
  cStatusText = "You are using "+navigator.appName;
  if(navigator.appName == "Microsoft Internet Explorer") {
    iNavigatorInUse = 0;
  //cStatusText += "...feeb.";
  } else {
    iNavigatorInUse = 1;
    cStatusText += ",  Kudos to you!";
  } StatusWindowText(cStatusText);
  return(iNavigatorInUse);
}
//***************************************************************************
var iButtonCount;
var cButtonColor = new Array(
  '#7FFF00',	// 1 chartreuse
  '#00ff00',	// 2 lime
  '#00ffff',	// 3 aqua
  '#808000',	// 4 olive
  '#c0c0c0',	// 5 silver
  '#ff00ff',	// 6 fuchsia
  '#FF7F50',	// 7 coral
  '#ffff00',	// 8 yellow
  '#DEB887' 	// 9 burlywood
);
function MakeButton(buttonText, buttonAction, buttonDescription) {
  if(iButtonCount ==null) iButtonCount  = 1;
  else                    iButtonCount += 1;
  document.write(
       '<button onClick="'+buttonAction+'"'
      +' title="'+buttonDescription+'"'
      +' onMouseOver="javascript: this.style.backgroundColor=\''+cButtonColor[parseInt(Math.random()*9)]+'\';'
      +                          'this.style.fontWeight=\'bold\';'
      +'StatusWindowText(\''+buttonDescription+'\');'
      +'" onMouseOut="javascript: this.style.backgroundColor=\'\';'
      +                          'this.style.fontWeight=\'\';'
      +'"><b>'+iButtonCount+'</b> - '+buttonText+'</button>&nbsp;');
  if((((iButtonCount+1)%4) == 0) &&
     (not_IE_Browser() == 0)) document.write('<br>');
}
//**************************************************************************
// export the Title Info text for inclusion in body..
make_TitleHead(); cTitleInfo  = cTitleHead;
Navigation_Bar(); cTitleInfo += cNavigationBar;

//**************************************************************************
