/*************
** funcs.js **
*************/

// Author: Steve Kirby - friskjazz.com, blcb.net/computersteve
// If you use it, just say where ya got it mmkay.
//

function ContentHead_SetText( s )
{
  if ( top.content_head.document )
    top.content_head.document.getElementById('idContentHead').innerHTML = s;
  else
    top.content_head.idContentHead.innerHTML = s;
}


function w( s )
{
  document.write( s + "\n" )
}


function ShowThumb( Nm, Capt )
{
  Capt = Capt ? Capt : Nm;

  w( '<a href="g/'        + Nm + '.jpg" target=_fullpic title="Click for large image">' )
  w( '<img src="g/tn/TN_' + Nm + '.jpg" border=0> <br>' )
  w( '</a>' )
  w( '<span class=caption>' + Capt + '</span>' )
}


function text_date()
{
  var d_names = new Array("Sunday", "Monday", "Tuesday",
  "Wednesday", "Thursday", "Friday", "Saturday");

  var m_names = new Array("January", "February", "March",
  "April", "May", "June", "July", "August", "September",
  "October", "November", "December");

  var d = new Date();
  var curr_day = d.getDay();
  var curr_date = d.getDate();
  var sup =
    ( curr_date == 1 || curr_date == 21 || curr_date ==31 ) ? "st" :
    ( curr_date == 2 || curr_date == 22 ) ? "nd" :
    ( curr_date == 3 || curr_date == 23 ) ? "rd" :
    "th";

  var curr_month = d.getMonth();
  var curr_year = d.getFullYear();

  var s = d_names[curr_day] + ", " + m_names[curr_month] + " " + curr_date + "<SUP style='border:0'>"
    + sup + "</SUP>, " + curr_year

  return s;
}


function replaceChar( theString, oldChar, newChar )
{
  var i = 0;
  var j = theString.length;

  for(i=0; i < theString.length; i++)
  {
    if(theString.charAt(i) == oldChar)
    {
      theString = theString.substring(0,i) + newChar +
      theString.substring(i+1,theString.length);

      if(i > j)
      { // loop-killer, just in case we mess with the code
        break;
      }
    }
  }
  return theString;
}


function Title2FileName( title )
{
  var s = replaceChar( title, "'", ""  );
  return replaceChar( s, " ", "_" );
}


// Groan ... oh the shit we have to go thru to thwart harvesters.
//
function MakeAddress( s1, s2, s3 )
{
  return s1 + "@" + s2 + "." + s3
}

// Size the width of a button to the prompt text.
//
function FixButton( id )
{
  oButton = document.getElementById(id);
  textwidth = oButton.value.length;
  oButton.style.width = (textwidth+2) + 'ex';
}


// Ensure pages are NOT cached.
//
w( '<meta http-equiv="expires" content="fri, 26 feb 2001 09:23:47 gmt">' )
w( '<meta http-equiv="cache-control" content="no-cache">' )
w( '<meta http-equiv="pragma" content="no-cache">' )


/*****************
** EOF funcs.js **
*****************/

