// headlines.js - javascript support for headlines-art.com (CSS version)
// version: 2/14/2008
// copyright 2008 maren phillips / headlines-art.com, all rights reserved
// portions copyright 2008 amalgamated binaries, inc.

// global variables and constants
var dName = new Array ("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY")
var mName = new Array ("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER")
var wTimer;
var timerCount = 0;
var cPanel = 'null';

var pre = 'null';
var post = 'null';

// support functions
if(document.layers)
{
 pre = 'document.';
 post = '';
}
if(document.getElementById)
{
 pre = 'document.getElementById("';
 post = '").style';
}
if(document.all)
{
 pre = 'document.all.';
 post = '.style';
}

// get screen and browser window metrics
function postMetrics()
{
 var screenH = screen.height;
 var screenW = screen.width;
 alert("Screen Resolution:\n" + screenW + "px x " + screenH + "px");
 if(document.all)
 {
  availW = document.body.clientWidth;
  availH = document.body.clientHeight;
 }
 else
 {
  availW = innerWidth;
  availH = innerHeight;
 }
 alert("Available Browser Window Area:\n" + availW + "px + x " + availH + "px");
}

// _doTimer function
function doTimer()
{
 // start timer loop (hits every 1.5 seconds)
 wTimer = setTimeout("doTimer();", 1500);
 // increment count +1 every hit
 timerCount++;
 // switch block for timed events
 switch(timerCount)
 {
  case  5:
  case 15:
  case 25:
  case 35:
  case 45:
  case 55:
   // fall-through: every 10 seconds (at 5s)...
  break;
  case 10:
  case 20:
  case 30:
  case 40:
  case 50:
  case 60:
   // fall-through: every 10 seconds (at 10s)...
   // call to generate/update current date for 'date1'
   _genDate();
  break;
  default:
  break;
 }
 // rollover from 60 seconds back to 0
 if (timerCount==60) timerCount=0;
}

// _setClass function
function _setClass(target, nClass)
{
 if (document.getElementById)
 {
   document.getElementById(target).className = nClass;
 }
}

// _genDate function
function _genDate()
{
 var today = new Date;
 if (document.getElementById)
 {
  document.getElementById('iDate').innerHTML = "";
  document.getElementById('iDate').innerHTML = "" + dName[today.getDay()] + ", " + mName[today.getMonth()] + " " + today.getDate() + "&nbsp;"
 }
}

// _genCounter function
function _genCounter(c)
{
 if (document.getElementById)
 {
  if (c<10)
  {
   document.getElementById('counter1').innerHTML = "0" + c;
  }
  else document.getElementById('counter1').innerHTML = "" + c;
 }
}

// _inTxt function
function _inTxt(target, html)
{
  if (document.getElementById) document.getElementById(target).innerHTML = html
}

// _outTxt function
function _outTxt(target)
{
  if (document.getElementById) document.getElementById(target).innerHTML = '&nbsp;'
}

// showPanel function
// function conditionally hides "current" panel and resets selected object's visibility style to "visible"
function showPanel(strID)
{
 if (cPanel != 'null') hidePanel(cPanel);
 eval(pre + strID + post).visibility = 'visible';
 cPanel = strID;
}

// hidePanel function
// function resets selected object's visibility style to "hidden"
function hidePanel(strID)
{
 eval(pre + strID + post).visibility = 'hidden';
 cPanel = 'null';
}
