<!--
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: William and Mari Bontrager :: http://willmaster.com/ */

<!-- Copyright 1999, 2000 by William and Mari Bontrager.

// See complete instructions in the article "Easy Time
//   Zone Offset Calculator" in WillMaster Possibilities
//   issue # 46: http://willmaster.com/possibilities/archives/


here_offset = 300;
// The above number must be changed to the number of minutes
//   difference between your time and UT during STANDARD TIME
//   -- not Daylight Savings Time. If you are in UT, (the
//   same time zone as Greenwich, England), this number
//   will be 0 (zero). If your time is later than UT (east
//   of Greenwich, England), the number is negative.
//   Otherwise, the number is positive.
// NOTE: To calculate the number automatically, go to
//   http://willmaster.com/possibilities/demo/eztzoffset.html

DST_month_start = 0;
// If your geographical area observes daylight savings time,
//   the above number represents the month the period begins.
//   Otherwise, the number is 0 (zero).

DST_day_start = 0;
// If your geographical area observes daylight savings time,
//   the above number represents day of the month the period
//   begins. Otherwise, the number is 0 (zero).

DST_month_end = 0;
// If your geographical area observes daylight savings time,
//   the above number represents the month the period ends.
//   Otherwise, the number is 0 (zero).

DST_day_end = 0;
// If your geographical area observes daylight savings time,
//   the above number represents day of the month the period
//   ends. Otherwise, the number is 0 (zero).

clocktype = 24;
// The above number must be either 12 or 24. Use 12 if you
//   want a 12-hour clock with "AM" or "PM" appended to the
//   time. Use 24 if you want a 24-hour clock.
// NOTE: What you specify here is the default. You can change
//   this value right before you use a function.

here_appt_weekday = 2;
// The day of the week in your time zone that you want
//   calculated into your visitor's time zone. Use a
//   number 1-7: 1=Sunday 2=Monday 3=Tuesday
//   4=Wednesday 5=Thursday 6=Friday 7=Saturday
// NOTE: What you specify here is the default. You can change
//   this value right before you use a function.

here_appt_hour = 10;
// The hour in your time zone that you want calculated into
//   your visitor's time zone. Use 12 for noon and 0 for midnight.
// NOTE: What you specify here is the default. You can change
//   this value right before you use a function.

here_appt_minute = 27;
// The number of minutes after the hour in your time zone
//   that you want calculated into your visitor's time zone.
// NOTE: What you specify here is the default. You can change
//   this value right before you use a function.

here_appt_ampm = 'AM';
// If the above appt_hour and appt_minute is before noon,
//   use 'AM', otherwise use 'PM'. If your clocktype
//   variable (above) is 24, use 'AM';
// NOTE: What you specify here is the default. You can change
//   this value right before you use a function.

// NOTE: The above appt_... variables must have values assigned
//       to them whether or not you plan to calculate a specific
//       time for your visitor's time zone.

disp_dow = 'yes';
// Shall time displays include the day of the week ('yes' or 'no')?
// NOTE: What you specify here is the default. You can change
//   it right before you use a function.

// No other customizations are required.

can_use_this = false;
if(parseInt(navigator.appVersion) >= 4) { can_use_this = true; }
vtime = new Date();
if(DST_month_start > 0) {
	var b = false;
	var m = vtime.getMonth();
	var d = vtime.getDate();
	DST_month_start--;
	DST_month_end--;
	if((m > DST_month_start) && (m < DST_month_end)) { b = true; }
	else
	{
		if((m == DST_month_start) && (d >= DST_day_start)) { b = true; }
		if((m == DST_month_end) && (d <= DST_day_end)) { b = true; }
	}
	if(b == true) { here_offset -= 60; }
}
Diff = vtime.getTimezoneOffset() - here_offset;
weekdays=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
if(! weekdays) { can_use_this = 0; }
function get_future() {
	if(can_use_this == false) { return ''; }
	var apm = 'AM';
	var rs = '';
	if((clocktype == 12) && (here_appt_ampm == 'PM')) { here_appt_hour += 12; }
	b = new Date(vtime.getYear(),1,1,here_appt_hour,here_appt_minute,0);
	var t = 0;
	if(here_appt_weekday > 0)
	{
		var tt = here_appt_weekday - 1;
		if(tt != b.getDay()) { t = tt - b.getDay(); }
	}
	if(t != 0) { b.setTime(Number(b) + (1000 * 60 * 60 * 24 * t)); }
	b.setTime(Number(b) - (Diff * 60000));
	var nowweekday = b.getDay();
	var hr = b.getHours();
	if(clocktype == 12)
	{
		if(hr > 11) { apm = 'PM'; }
		if(hr > 12) { hr -= 12; }
	}
	rs = hr + ':';
	if(b.getMinutes() < 10) { rs += '0'; }
	rs += b.getMinutes();
	if(clocktype == 12) { rs += ' ' + apm; }
	if(here_appt_weekday > 0) { rs += ', ' + weekdays[b.getDay()]; }
	return rs;
}
function get_current(s,minutesoff) {
	Diff = vtime.getTimezoneOffset() - minutesoff;
	if(can_use_this == false) { return ''; }
	var apm = 'AM';
	var rs = '';
	if((s == 'here') || (s == 'Here') || (s == 'HERE'))
	{
		htime = new Date();
		htime.setTime(Number(vtime) + (Diff * 60000));
		var hr = htime.getHours();
		if(clocktype == 12)
		{
			if(hr > 11) { apm = 'PM'; }
			if(hr > 12) { hr -= 12; }
		}
		rs = hr + ':';
		if(htime.getMinutes() < 10) { rs += '0'; }
		rs += htime.getMinutes();
		if(clocktype == 12) { rs += ' ' + apm; }
		if((disp_dow == 'yes') || (disp_dow == 'Yes') || (disp_dow == 'YES'))
		{ rs += ', ' + weekdays[htime.getDay()]; }
	}
	else
	{
		var hr = vtime.getHours();
		if(clocktype == 12)
		{
			if(hr > 11) { apm = 'PM'; }
			if(hr > 12) { hr -= 12; }
		}
		rs = hr + ':';
		if(vtime.getMinutes() < 10) { rs += '0'; }
		rs += vtime.getMinutes();
		if(clocktype == 12) { rs += ' ' + apm; }
		if((disp_dow == 'yes') || (disp_dow == 'Yes') || (disp_dow == 'YES'))
		{ rs += ', ' + weekdays[vtime.getDay()]; }
	}
	return rs;
}
var timer=null;
function times()
{

	var d=document.getElementById('times');
	disp_dow = 'no';
	d.innerHTML=get_current('visitor')+"<br><h1>AKTUALNY CZAS W USA:</h1><br>";
						disp_dow = 'no';
	d.innerHTML+=get_current('here',300)+"<span class=zone_bold> EST</span>  New York <br /> ";

						disp_dow = 'no';
d.innerHTML+=get_current('here',360)+"<span class=zone_bold> CST</span>	Chicago Illinois<br />  ";
						disp_dow = 'no';
d.innerHTML+=get_current('here',420)+"<span class=zone_bold> MST</span> Denver Colorado<br />   ";
				
						disp_dow = 'no';
d.innerHTML+=get_current('here',480)+"<span class=zone_bold> PST</span> Los Angeles CA	";




}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||
var MenuCurrent='';
var MenuTimer=null;
function MenuShow(name)
{
	MenuCurrent=name;
	var d=document.getElementById(name);
	if(d)
	{
		var x=findPos(d);
		d=document.getElementById('sub_'+name);
		if(d)
		{
			d.className='menu_container_over';
			d.style.left=(x[0]+1)+'px';
			d.style.top=(x[1]+36)+'px';
		}
			
		
	}
	if(MenuTimer) 
		clearTimeout(MenuTimer);
}
function MenuHide()
{
	MenuTimer = setTimeout("MenuDoHide()",400);
}
function MenuDoHide()
{
	if(MenuCurrent!="")
	{
		var d=document.getElementById(MenuCurrent);
		if(d)
		{
			d.className='menuroot';
			d=document.getElementById('sub_'+MenuCurrent);
			if(d)
				d.className='menu_container';
		}
	}

}
