jQuery(function() {
	jQuery('#guide_navigator h3 a, #guide_navigator .less a').bind('mouseover',function() {
		jQuery(this).parents("li").toggleClass('state_open');
	});

	jQuery("#toggle_all").bind('click',function() {
		if (jQuery(this).hasClass('open_all')) {
			jQuery("#guide_navigator li").removeClass('state_open').addClass('state_open');	// to make sure we don't double add the 'state_open' class.
			jQuery(this).html("Hide all").removeClass('open_all');
		} else {
			jQuery("#guide_navigator li").removeClass('state_open');
			jQuery(this).html("Show all").addClass('open_all');
		}
		return false;
	});

	jQuery('.unlove').bind('click',function() {
		var id = jQuery("input[name='location_id']").val();
		jQuery.get('/places/dislike/'+id, function() {		
			InterNations.flash('You don\'t like this place anymore.');
		});
		jQuery('.i_am_a_lover').hide();
		
		return false;
	});

	jQuery('.love').bind('click',function() {
		var id = jQuery("input[name='location_id']").val();
		jQuery.get('/places/like/'+id, function() {
			InterNations.flash('You now like this place.');
		});
		jQuery('.i_am_a_lover, #lovers').show();
		
		return false;
	});
});

