/*-------------------
 * Global
 *-------------------*/
var	g_Geocoder	= null;
var	g_GMap		= null;
var	g_GMarker	= null;

function initPage( map )
{
	// ツールチップの初期化
	$('#wf_event_pre_create_form_title,#wf_event_pre_create_form_address').tooltip({ 
		position: "top center",
		offset: [20, 0],
		effect: 'slide',
		tip: '.tooltip'
	});
	
	// 入力フォームにフック
	$("#wf_event_pre_create_form_start_date").datepicker( { dateFormat: 'yy/mm/dd D' } );
	$('#wf_event_pre_create_form_start_time').timeEntry( { show24Hours: true, spinnerImage: ''} );
	
	initLocationSearch( map );
}

// GoogleMapの初期化
function initLocationSearch( map )
{
	g_Geocoder	= new GClientGeocoder();
	g_GMap		= map;
	$("#wf_event_pre_create_form_address").bind( "change", showLocationToMap );
}

function showLocationToMap( e )
{
	if( g_Geocoder != null )
	{
		g_Geocoder.getLatLng( $("#wf_event_pre_create_form_address").val(), function(point){
								if( !point )
								{
									point	= new GLatLng( 0, 0 );
								}
								
								g_GMap.setCenter( point, 16 );
								if( g_GMarker == null )
								{
									g_GMarker = new GMarker( point );
									g_GMap.addOverlay( g_GMarker );
								}
								else
								{
									g_GMarker.setLatLng( point );
								}
							});
	}
}

function sendForm()
{
}
