// Webs Unlimited's J-BOTS FrontPage 2000 JavaScript Generator version 3.0
// Copyright Webs Unlimited 1998, 1999 All rights reserved - http://WebsUnlimited.com
function IsIn(value,search) {
	if(search.indexOf(value) != -1) {
	  return 1;
 } else {
		return 0;
   }
}

function LeadZero(value) {
	if ( value < 10) 
	  document.write('0');
}

function displayGlobalClock(format,GMTTime,twoplace) {
var operators = 'HIMSp%';
var value = '';

var today = new Date();

// get the numbers
hours = today.getHours();
minutes = today.getMinutes();
seconds = today.getSeconds();
TimezoneOffset = today.getTimezoneOffset()/60;
//convert local time to GMT
hours += TimezoneOffset;
if (hours > 23) {hours -= 24};
if (hours < 0 ) {hours += 23};

// Get time in time zone required
	GMTTime = -8; //OVERRIDES THE HOUR OFF SETTING ENTRY ON EACH WEB PAGE
hours += GMTTime;

if (hours > 23) {hours -= 24};
if (hours < 0 ) {hours += 23};
var pos = 0;

while (pos < format.length) {
	if( format.substring(pos,pos+1) != '%') 
	{
		document.write(format.substring(pos,pos+1));
		pos++;
		continue;
	} else {
		if (!IsIn(format.substring(pos,pos+1), operators))
		{
			document.write(format.substring(pos,pos+1));
			pos++;
			continue;
		} else {
			if ( format.substring(pos,pos+1) == '%') 
			{
				pos++; // look ahead
				if (format.substring(pos,pos+1) == '%') 
				{
					document.write('%');
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'H') 
				{
					if(twoplace) LeadZero(hours);
					document.write(hours);
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'M') 
				{
					if(twoplace) LeadZero(minutes);
					document.write(minutes);
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'I') 
				{
					var newhours = hours;
					if(hours > 12) newhours = hours - 12;
					//if(twoplace) LeadZero(newhours);
					document.write(newhours);
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'S') 
				{
					if(twoplace) LeadZero(seconds);
					document.write(seconds);
					pos++;
					continue;
				} else {
				if (format.substring(pos,pos+1) == 'p') 
				{
					if (hours < 12) 
						document.write('AM');
					else 						document.write('PM');
					pos++;
					continue;
				} 
       pos++; // ignore the char 
		}
} } } } } } } } }

// PRINT DAY
function PrintDay(){
   var day = new Array()
	day[0] = "Sunday"
	day[1] = "Monday"
	day[2] = "Tuesday"
	day[3] = "Wednesday"
	day[4] = "Thursday"
	day[5] = "Friday"
	day[6] = "Saturday"
	
today = new Date()
var dayOfWeek = today.getDay();
document.write(day[dayOfWeek]);
document.write(' - ');
}	

