// Webs Unlimited's J-BOTS FrontPage 2002 JavaScript Generator version 4.0
// Copyright Webs Unlimited 1998, 1999, 2000, 2001 All rights reserved - http://WebsUnlimited.com
function IsIn(value,search) {
	if(search.indexOf(value) != -1) {
	  return 1;
 } else {
		return 0;
   }
}

var operators = 'HIMSp%';
var value = '';

var timenow = '';

function ticktock(format,twoplace) {
sCall = 'ticktock("' + format + '",' + twoplace + ')';
var today = new Date;
// get the numbers
hours = today.getHours();
minutes = today.getMinutes();
seconds =today.getSeconds();
var pos = 0;

timenow = '';
while (pos < format.length) {
	if( format.substring(pos,pos+1) != '%') 
	{
		timenow += format.substring(pos,pos+1);
		pos++;
		continue;
	} else {
		if (!IsIn(format.substring(pos,pos+1), operators))
		{
			timenow += format.substring(pos,pos+1);
			pos++;
			continue;
		} else {
			if ( format.substring(pos,pos+1) == '%') 
			{
				pos++; // look ahead
				if (format.substring(pos,pos+1) == '%') 
				{
					timenow += '%';
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'H') 
				{
					if(twoplace) if(hours<10) timenow += '0';
					timenow += hours;
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'M') 
				{
					if(twoplace) if(minutes<10) timenow += '0';
					timenow += minutes;
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'I') 
				{
					var newhours = hours;
					if(hours > 12) newhours = hours - 12;
					if(newhours == 0) newhours = 12;
					timenow += newhours;
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'S') 
				{
					if(twoplace) if(seconds<10) timenow += '0';
					timenow += seconds;
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'p') 
				{
					if (hours < 12) 
						timenow += 'am';
					else 						timenow += 'pm';
					pos++;
					continue;
				}   else {
				if (format.substring(pos,pos+1) == 'P') 
				{
					if (hours < 12) 
						timenow += 'AM';
					else 						timenow += 'PM';
					pos++;
					continue;
				} 
       pos++; // ignore the char 
		}
} } } } } } } } } document.ticktock.Clock.value = timenow; timer = setTimeout(sCall,1000); }