﻿function PhGolfCourse( map_location, name, street1, street2, phone_number, hole_count )
{
	this.m_oLocation		= map_location;
	this.m_strName			= name;
	this.m_strStreet1		= street1;
	this.m_strStreet2		= street2;
	this.m_strPhoneNumber	= phone_number;
	this.m_iHoleCount		= hole_count;
	
	this.InitObject();
}

PhGolfCourse.prototype = new PhWidget();

PhGolfCourse.prototype.InitObject = function()
{
	var me = this;
	
	var wrapper	= document.createElement( 'div' );
	var name	= document.createElement( 'div' );
	var address	= document.createElement( 'div' );
	var phone	= document.createElement( 'div' );
	var holes	= document.createElement( 'div' );
	
	this.m_oContainer = document.createElement( 'div' );
	this.m_oContainer.style.width			= '223px';
	this.m_oContainer.style.height			= '124px';
	this.m_oContainer.style.backgroundImage	= 'url(system/resources/golf_courses/courseBG.jpg)';
	this.m_oContainer.style.cssFloat		= 'left';
	this.m_oContainer.style.styleFloat		= 'left';
	this.m_oContainer.style.cursor			= 'pointer';
	
	wrapper.style.position	= 'relative';
	wrapper.style.width		= '223px';
	wrapper.style.height	= '124px';
	wrapper.style.top		= '0px';
	wrapper.style.height	= '0px';
	
	name.id				= 'course_name';
	name.innerHTML		= this.m_strName;
	
	address.id			= 'course_address';
	address.innerHTML	= this.m_strStreet1+'<br />'+this.m_strStreet2;
	
	phone.id			= 'course_phone_number';
	phone.innerHTML		= this.m_strPhoneNumber;
	
	holes.id			= 'course_hole_count';
	holes.innerHTML		= this.m_iHoleCount;
	
	//this.m_oContainer.appendChild( name );
	//this.m_oContainer.appendChild( address );
	//this.m_oContainer.appendChild( phone );
	//this.m_oContainer.appendChild( holes );
	
	wrapper.appendChild( name );
	wrapper.appendChild( address );
	wrapper.appendChild( phone );
	wrapper.appendChild( holes );	
	
	this.m_oContainer.appendChild( wrapper );
	
	g_oClient.AttachEvent( this.m_oContainer, "click", function(){me.ShowInfoWindow();} );
}

PhGolfCourse.prototype.ShowInfoWindow = function()
{
	if( this.m_oLocation.Marker != null )
		this.m_oLocation.Marker.showMapBlowup( {zoomLevel:16, mapType:G_SATELLITE_MAP} );
}
