$(window).bind('load', function(){

	if ($.history.getCurrent() != '') {
		homecontent = $.history.getCurrent();
	}

	if ($.swfobject.getFlashPlayerVersion().major < 9) {
		window.location = 'Content/Island_Districts.aspx';
		return;
	} else {
	
		// 200909151439 Demo the news ticker
		// to demo the scrolling news feature have hardcoded in a shownews param
		// added by David
		var shownews = (location.href.match(/shownews\=true/i));
		$.swfobject.embedSWF("media/flash/home-master.swf", "flash-file", "100", "100", "9.0.0", '', {id:homecontent,root:".",settings:"media/xml/home.aspx" + (shownews?'?shownews=true':'')},{wmode:'transparent'});
	}

	fullscreen = function(){
		
		var ow = 980;
		var oh = 600;
		var w = $(window).width();
		var h = $(window).height();
		var fc = $('#flash-container');
		var ff = $('#flash-file');
		
		w = Math.max(w, ow);
		h = Math.max(h, oh);
		
		ff.css({
			'width':w+'px',
			'height':h+'px'		
		});
		
		fc.css({
			'width':(w>$(window).width())?$(window).width():w+'px',
			'height':(h>$(window).height())?$(window).height():h+'px',
			'overflow-y':(h>$(window).height())?'scroll':'hidden',
			'overflow-x':(w>$(window).width())?'scroll':'hidden'
		});
	}
	fullscreen();
	
	setInterval(fullscreen, 1000);

});

function wisiMapLink() {
	$('a#faux-wismap-link').click();
}

$(function(){
	$.pbBox({ showclose: true });});


// Add an item to the history object (flash calls this function)
function addHistory(n) {
	$.history.add(n);
}

// A flash function that returns the data in the hash
function getLocationHash() {
	return $.history.getCurrent();
}

// A flash function that returns the location string
function getLocation() {
	return location.href;
}

// Make a call the flash when the history changes
$(function(){
	
	$(window).history(function(e, hash) {
		thisMovie("flash-file").update(hash);
	});
	
});

// Standard Adobe flash selector
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}