﻿var g_oParkIcons = [
[1, 'system/resources/parks_map/fishing-icon.gif'],
[2, 'system/resources/parks_map/picnic-shelters-icon.gif'],
[4, 'system/resources/parks_map/picnic-icon.gif'],
[8, 'system/resources/parks_map/trails-icon.gif'],
[16, 'system/resources/parks_map/wildfowl-blind.gif'],
[32, 'system/resources/parks_map/playgroundIcon.gif'],
[64, 'system/resources/parks_map/hiking-icon.gif'],
[128, 'system/resources/parks_map/horseback-riding-icon.gif'],
[256, 'system/resources/parks_map/CrossCountrySkiing.gif'],
[512, 'system/resources/parks_map/canoeing-icon.gif'],
[1024, 'system/resources/parks_map/wildfowl-blind.gif'],
[2048, 'system/resources/parks_map/camping-icon.gif']
]

function PhPark( map_location, name, street, city_state, local_number, toll_free_number, description, features )
{
	this.m_oLocation			= map_location;
	this.m_strName				= name;
	this.m_strStreet			= street;
	this.m_strCityState			= city_state;
	this.m_strLocalNumber		= local_number;
	this.m_strTollFreeNumber	= toll_free_number;
	this.m_strDescription		= description;
	this.m_iFeatures			= features;
	
	this.InitObject();
}

PhPark.prototype = new PhWidget();

PhPark.prototype.InitObject = function()
{
	var me		= this;
	
	var name	= document.createElement( 'div' );
	var address	= document.createElement( 'div' );
	var phone1	= null;
	var phone2	= null;
	var desc	= null;
	
	this.m_oContainer = document.createElement( 'div' );
	this.m_oContainer.style.width			= '223px';
	this.m_oContainer.style.cursor			= 'pointer';
	
	name.id				= 'park_name';
	name.innerHTML		= this.m_strName;
	this.m_oContainer.appendChild( name );
	
	address.id			= 'park_address';
	address.innerHTML	= this.m_strStreet+'<br />'+this.m_strCityState;
	this.m_oContainer.appendChild( address );
	
	if( this.m_strLocalNumber != '?' )
	{
		phone1				= document.createElement( 'div' );
		phone1.id			= 'park_phone_1';
		phone1.innerHTML	= this.m_strLocalNumber;
		this.m_oContainer.appendChild( phone1 );
	}
	
	if( this.m_strTollFreeNumber != '?' )
	{
		phone2				= document.createElement( 'div' );
		phone2.id			= 'park_phone_2';
		phone2.innerHTML	= this.m_strTollFreeNumber;
		this.m_oContainer.appendChild( phone2 );
	}
	
	if( this.m_strDescription != '' )
	{
		desc				= document.createElement( 'div' );
		desc.id				= 'park_description';
		desc.innerHTML		= this.m_strDescription;
		this.m_oContainer.appendChild( desc );
	}

	var icon		= null;
	var icon_tray	= document.createElement( 'div' );
	var i			= 0;
	
	icon_tray.id	= 'icon_tray';
	
	for( i = 0; i < g_oParkIcons.length; i++ )
	{
		if( g_oParkIcons[i][0] & this.m_iFeatures )
		{
			icon = document.createElement( 'img' );
			icon.src = g_oParkIcons[i][1];
			icon.className = 'icon';
			icon_tray.appendChild( icon );
		}
	}
	
	this.m_oContainer.appendChild( icon_tray );
	g_oClient.AttachEvent( this.m_oContainer, "click", function(){me.ShowInfoWindow();} );
}

PhPark.prototype.ShowInfoWindow = function()
{
	if( this.m_oLocation.Marker != null )
		this.m_oLocation.Marker.showMapBlowup( {zoomLevel:16, mapType:G_SATELLITE_MAP} );
}