﻿var App = {};

App.bindHomePage = function()
{
	jQuery('.hero ul li').each(function()
	{
		var item = jQuery(this);
		item.click(function()
		{
			window.location.href = item.find('a')[0].href;
		});
	});
};

App.bindLinkForms = function()
{
	jQuery('.link-form select').change(function()
	{
		var url = jQuery(this).val();
		if (url) window.location.href = url;
	});
};

App.bindSearchForms = function()
{
	jQuery('.nav-search .search-text, #feature-column .search-text').focus(function()
	{
		var ipt = jQuery(this);
		if (!ipt.data('cleared'))
		{
			ipt.val('');
			ipt.data('cleared', true);
		}
	});
};

App.bindFlash = function()
{
	var flashHolder = jQuery('#flash-holder');
  if (window.SWFObject && flashHolder.length && flashUrl)
  {
		var so = new SWFObject(flashUrl, "FlashMovie", flashWidth, flashHeight, flashVersion, "#FFFFFF");
		so.addParam("wmode", "transparent");
		so.write(flashHolder[0]); 
	}
};

jQuery(document).ready(function()
{
	App.bindHomePage();
	App.bindLinkForms();
	App.bindSearchForms();
	App.bindFlash();
});

/*
function openWindow(url, name, width, height, resizable, scrollbars, statusbar, menubar, toolbar)
{
//	aaert(name);
//	var win = (window.name) ? eval(name) : null;
	var optionString = '';
	if (width) optionString += 'width=' + width + ',';
	if (height) optionString += 'height=' + height + ',';
	if (resizable) optionString += 'resizable=' + resizable + ',';
	if (scrollbars) optionString += 'scrollbars=' + scrollbars + ',';
	if (statusbar) optionString += 'status=' + statusbar + ',';
	if (menubar) optionString += 'menubar=' + menubar + ',';
	if (toolbar) optionString += 'toolbar=' + toolbar + ',';
	win = window.open(url,name,optionString);
	if (win) win.focus();
}

function viewMap(lat, lon, text)
{
	lat = parseFloat(lat);
	lon = parseFloat(lon);
	var width = 500;
	var height = 500;
	if (Prototype.Browser.WebKit)
	{
		height += 1;
	}
	var mapWin = openWindow('/LocationMap.aspx?Latitude=' + lat + '&Longitude=' + lon + '&Text=' + escape(text), 'mapWin', width, height, 0, 0, 0, 0, 0);
}
*/


