function $ (id)
{
	return (document.all ? document.all[id] : document.getElementById(id));
}

function contact (who, where, what)
{
	var z = "";

	switch (what)
	{
		case "c":
			what = "com";
			break;

		case "o":
			what = "org";
			break;

		case "n":
			what = "net";
			break;
	}

	switch (where)
	{
		case "VFD":
			var sub = who,w = "vistafd",what= "om",z="ma"+"il"+"to",a="ail.c",b="gm",c=b+a+what,d=z+":"+w+"@"+c+"?subject="+who;
			break;

		default:
			var z="ma"+"il"+"to",a=where,b=".",c=a+b+what,d=z+":"+who+"@"+c;
			break;
	}

	document.location = d;
}

var NavAgent = window.navigator.userAgent;
var NavVers = parseInt(NavAgent.charAt(NavAgent.indexOf("/") + 1), 10);

function isIE ()
{
	return NavAgent.indexOf("MSIE") > 0;
}

function isNetscape ()
{
	result = !(NavAgent.indexOf("MSIE") > 0 || NavAgent.indexOf("Gecko") > 0);
	//alert(NavAgent + "\n isNetscape returns " + result);
	return result;
}

function isGecko ()		// Mozilla Netscape 6
{
	return NavAgent.indexOf("Gecko") > 0;
}

var now = new Date();

Date.prototype.DateOnly = function ()
{
	var d = new Date(this.valueOf());
	d.setHours(0);
	d.setMinutes(0);
	d.setSeconds(0);
	d.setMilliseconds(0);
	return d;
};

function showEnding (date)
{
	if (date >= 11 && date <= 13)
	{
		document.write(date + "th");
	}
	else if (date % 10 == 1)
	{
		document.write(date + "st");
	}
	else if (date % 10 == 2)
	{
		document.write(date + "nd");
	}
	else if (date % 10 == 3)
	{
		document.write(date + "rd");
	}
	else
	{
		document.write(date + "th");
	}
}

// - - - - - -  - - - - - -  - - - - - -  - - - - - -  - - - - - - 

/*

var message = "\
	Vista Fire District #1 Board of Fire Commissioners\n\
	Meeting scheduled for:\n\
	Tuesday, September 28, 2010\n\
	7:30pm\n\
	Vista Firehouse - Trailer\n\
	377 Smith Ridge Road - Route 123\n\
	South Salem NY 10590-2327\n\
	\n\
	Additional information:\n\
	vistafd&nbsp;@&nbsp;gmail.com\n\
	914-533-2727\n\
	";

if (now.DateOnly().getTime() <= new Date (2010,9 - 1,28).getTime())
{
	confirmOkay(message);
}

// - - - - - -  - - - - - -  - - - - - -  - - - - - -  - - - - - - 

var message1 = "\
	<b>Vista Fire District #1\n\
	Budget Hearing for the 2011 Proposed Budget</b>\n\
	is scheduled for: Tuesday, October 19, 2010	7:30pm\n\
	\n\
	The Willows\n\
	260 Oakridge Commons - Route 123\n\
	South Salem NY 10590-2327\n\
	\n\
	To view the 2011 Proposed Budget:\n\
	<a href='downloads/2011_Budget_Proposal[1].pdf'>Click Here</a>\n\
	\n\
	Additional information:\n\
	<a href=\"javascript:contact('vistadm','hotmail','c')\">e-mail</a>\n\
	914-533-2727\n\
	";

var message2 = "\
	<b>Vista Fire District #1\n\
	Board of Fire Commissioners Meeting</b>\n\
	is scheduled for: Tuesday, October 19, 2010\n\
	Immediately following the Budget Hearing\n\
	\n\
	The Willows\n\
	260 Oakridge Commons - Route 123\n\
	South Salem NY 10590-2327\n\
	\n\
	Additional information:\n\
	<a href=\"javascript:contact('vistadm','hotmail','c')\">e-mail</a>\n\
	914-533-2727 \n\
	";

if (now.DateOnly().getTime() <= new Date (2010,10 - 1,19).getTime())
{
	confirmOkay(message1);
	confirmOkay(message2);
}

*/

// - - - - - -  - - - - - -  - - - - - -  - - - - - -  - - - - - - 

/*
var message3 = "\
<b>ANNUAL ELECTION OF THE VISTA FIRE DISTRICT\n\
ON DECEMBER 14, 2010</b>\n\
\n\
NOTICE IS HEREBY GIVEN that the Annual Election of the Vista Fire District will take place on December 14, 2010 between the hours of 6:00 p.m. and 9:00 p.m. at the following location:\n\
\n\
The Willows\n\
260 Oakridge Common\n\
South Salem, NY 10590\n\
\n\
For the purpose of electing one Commissioner for a five (5) year term, commencing January 1, 2011 and ending December 31, 2015.\n\
\n\
All voters registered with the Westchester County Board of Elections on for before November 22, 2010 shall be eligible to vote.\n\
\n\
For more information you can call: 914-533-2727.\n\
";

if (now.getTime() <= new Date (2010,12 - 1,14, 21,0,0).getTime())
{
	setTimeout(function () { confirmOkay(message3); }, 100);
}
*/

var message3 = "\
Vista Fire District Board of Fire Commissioners will hold it's 2011 Organizational meeting with the regular meeting following afterwards on:\n\
Thursday, January 6 2011\n\
7:30 PM\n\
The Willows\n\
260 Oak Ridge Commons\n\
South Salem NY 10590\n\
\n\
For more information you can call: 914-533-2727\n\
";

if (now.getTime() <= new Date (2011,1 - 1,6, 21,0,0).getTime())
{
	setTimeout(function () { confirmOkay(message3); }, 100);
}

var message4 = "\
The Vista Fire Department and the Board of Fire Commissioners wish Everyone a Safe and Healthy New Year!\
";

if (now.getTime() <= new Date (2011,1 - 1,6, 21,0,0).getTime())
{
	setTimeout(function () { confirmOkay(message4); }, 100);
}

// - - - - - -  - - - - - -  - - - - - -  - - - - - -  - - - - - - 

//if (now.getFullYear() == 2009 && (now.getMonth() == 7 - 1) && (now.getDate() <= 16))
//{
//	$("groundbreakingFrame").style.display = "inline";
//}

//if (now.DateOnly().getTime() < new Date (2010, 9 - 1, 11).getTime())
//{
//	window.open("/charlie.htm", "Charlie", "width=450,height=800");
//}
//else if (now.DateOnly().getTime() < new Date (2010, 9 - 1, 21).getTime())
//{
//	window.open("/charlie2.htm", "Charlie", "width=450,height=400");
//}



function Panel ()
{
	var openFrame = function ()
	{
		var pi = new PositionInfo($("winSizeBug"));
		var winWidth = pi.Left();
		var winHeight = pi.Top();
		var top = parseInt(winHeight / 2 - (_height / 2)); 
		var left = parseInt(winWidth / 2 - (_width / 2)); 
		var iframe = document.createElement("iframe"); 
		iframe.name = _name; 
		iframe.id = _name; 
		iframe.src = _url; 
		iframe.style.top = top + "px";
		iframe.style.left = left + "px";
		iframe.style.width = _width + "px";
		iframe.style.height = _height + "px";
		iframe.style.position = "absolute";
		iframe.style.zIndex = 99999;
		iframe.style.border = "4px silver outset";
		iframe.style.backgroundColor = "white";
		document.body.appendChild(iframe);
	}

	var theClosure = function ()
	{
		return (function () { openFrame() });
	}
	var closureRef = theClosure();

	var _url, _name, _width, _height;

	this.open = function (url, name, width, height)
	{
		_url = url;
		_name = name;
		_width = width;
		_height = height;
		setTimeout(closureRef, 100);
	}

	this.close = function (name)
	{
		if ($(name).length)
		{
			for (var i = 0; i < $(name).length; ++i)
			{
				$(name)[i].style.display = "none";
			}
		}
		else
		{
			$(name).style.display = "none";
		}
	}

	return this;
}

function timeOf (y, m, d, hh, mm, ss)
{
	hh = hh || 0;
	mm = mm || 0;
	ss = ss || 0;
	return new Date (y, m - 1, d, hh, mm, ss).getTime();
}

var win;
var panel = new Panel ();
var timeNow = new Date ().getTime();

if (timeNow < timeOf(2011, 1, 31))
{
	win = window.open("/howard.htm", "howard", "width=450,height=300");
	setTimeout(function () { win.focus(); }, 500);
}

if (timeNow < timeOf(2011, 5, 31))
{
	win = window.open("/woody.htm", "woody", "width=360,height=360");
	setTimeout(function () { win.focus(); }, 500);
}

if (timeNow < timeOf(2011, 7, 19))
{
	win = window.open("/jumbo.htm", "jumbo", "width=360,height=380");
	setTimeout(function () { win.focus(); }, 500);
}

if (timeNow < timeOf(2011, 8, 29))
{
	panel.open("/Irene.htm", "Irene", 360, 550);
}
else if (timeNow < timeOf(2011, 9, 12))
{
	panel.open("/9-11.htm", "911", 360, 550);
}

if (timeNow < timeOf(2011, 10, 19))
{
	panel.open("/2011BudgetPublicNotice.htm", "VFD_popup", 360, 570);
}

if (timeNow < timeOf(2011, 12, 14))
{
	panel.open("/DistrictElections2011.htm", "VFD_popup", 360, 500);
}

if (timeNow < timeOf(2012, 1, 7))
{
	panel.open("/OrganizationalMeetingNotice2012.htm", "VFD_popup", 600, 500);
}

if ((timeNow > timeOf(2012, 1, 13)) && (timeNow < timeOf(2012, 1, 22)))
{
	panel.open("/BloodDrive2012.htm", "VFD_popup", 400, 320);
}


