function updatemap( point ){
	map.setCenter(point, 11);
	updatepreview();
	updatepoint();
}
function updatepoint(){
	$j("#latlong").val( map.getCenter().toUrlValue() );
	$j("#zoom").val( map.getZoom() );
}
function findlocation(){
	var address = $j("#destination").val();
	if( geocoder ){
		geocoder.getLatLng(
		          address,
		          function(point) {
		            if (!point) {
		              alert(address + " not found. Please try another location, or find the location on the map manually.");
		            } else {
					  updatemap(point);
		            }
		          }
		        );
	}										
}
function preview(){
	previewmode = !previewmode;
	if(previewmode){
		$j('#info').fadeIn(400);
		// $j('#previewbtn').val("Hide Preview");
		updatepreview();
	}else{
		$j('#info').fadeOut(400);
		// $j('#previewbtn').val("Show Preview");
	}
}
function updatepreview(){
	if( previewmode==false ) preview();
	$j('#name').html($j('#destination').val());
	$j('#reason').html( "&ldquo;"+$j('form textarea').val()+"&rdquo;" );
}

// labelOver from Remy Sharp
jQuery.fn.labelOver = function(overClass) {
	return this.each(function(){
		var label = jQuery(this);
		var f = label.attr('for');
		if (f) {
			var input = jQuery('#' + f);
			
			this.hide = function() {
			  label.css({ textIndent: -10000 })
			}
			
			this.show = function() {
			  if (input.val() == '') label.css({ textIndent: 0 })
			}

			// handlers
			input.focus(this.hide);
			input.blur(this.show);
		  label.addClass(overClass).click(function(){ input.focus() });
			
			if (input.val() != '') this.hide(); 
		}
	})
}