// JavaScript Document
function changeTextBox(box)
  {
    selectboxName = box + 's';
    selectbox = document.getElementById(selectboxName);
    document.getElementById(box).value = selectbox.options[selectbox.selectedIndex].value;
  }
  
  function checkColor(box)
  {
    text = document.getElementById(box).value;
    failed = false;
    if(text.charAt(0) != '#')
      failed = true;
  	for(c=1; c < text.length && !failed; c++)
  	{
  	  curChar = text.charAt(c);
  	  if(!((curChar >= 0 && curChar <= 9) || (curChar >= 'A' && curChar <= 'F') || (curChar >= 'a' && curChar <= 'f')))
  	    failed = true;
  	}
  	if(failed)
  	  document.getElementById(box).value = '#000000';
  }

  var myCounter = null;
  var sTime;
  var aTime;
  var xPos;
  var yPos;
  var backCol;
  var textCol;
  var borderCol;
  var GUID;
  var link;
  var txtColor;
  var bkColor;
  var brdColor;
  var textSz;
  var textFnt;
  var displayText;
 // function startCounter(sTime, aTime)
  function startCounter(_sTime, _aTime, top, left, bkColor, txtColor, bordColor, bordWidth, address, guid, txtSize, txtFont, dispText)
  {
  var dthen = new Date("04/15/2010 07:00 PM");
	var dnow = new Date();
	if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
    sTime = gsecs;
    aTime = _aTime;
    xPos = top;
    yPos = left;
    backCol = bkColor;
    textCol = txtColor;
    borderCol = bordColor;
    link = address;
    textSz = txtSize;
    textFnt = txtFont;
    displayText = dispText;
    while ((dText = displayText.replace(String.fromCharCode(10),'<br>')) != displayText){displayText = dText;}
	
    GUID =  Math.floor(Math.random() * 100000000 + 1);
    delete_cookie('StartDate' + GUID);
    delete_cookie('EndDate' + GUID);
    delete_cookie('DontShow' + GUID);
    if(myCounter != null)
      myCounter.counterEnd();
    setTimeout('newCounter()', 100);
  }

  function newCounter()
  {
    myCounter = new counter();
    myCounter.counterUsingPopupCounter(sTime, aTime, parseInt(xPos), parseInt(yPos), backCol, textCol, borderCol, 1, 'none', GUID, textSz, textFnt, displayText);
    document.getElementById('outputTag').value = 
      '<scr' + 'ipt type="text/javascript">myCounter.counterUsingPopupCounter(' + sTime + ', ' + aTime + ', ' + xPos + ', ' + yPos + ', "' + backCol + '", "' + textCol + '", "' + borderCol + '", ' + '1, "' + link + '", ' + GUID + ',' + textSz + ',"' + textFnt + '","' + displayText + '");</scr' + 'ipt>';
  }

  function delete_cookie ( cookie_name )
  {
    var cookie_date = new Date ( );  // current date & time
    cookie_date.setTime ( cookie_date.getTime() - 1 );
    document.cookie = cookie_name += '=; expires=' + cookie_date.toGMTString();
  }

