$.fn.qtip.styles.err = { // Last part is the name of the style
   // width: 200,
   // background: '#A2D959',
   // color: 'black',
   // textAlign: 'center',
   // border: {
   //    width: 7,
   //    radius: 5,
   //    color: '#A2D959'
   // },
   tip: 'bottomMiddle',
   name: 'red'
}

$(function() {
	
	$('#place_add_next_form').click(function() {
		$('fieldset.place_form:hidden:eq(0)').show();
		if ($('fieldset.place_form:hidden:eq(0)').length == 0) {
			$(this).hide();
		}
		return false;
	});
	
	$('.place_form a.change_pic').click(function() {
		$(this).hide();
		$(this).next('input.change_pic').show();
		return false;
	});
	
	$('.list_form').submit(function() {
		var do_submit = true;
		
		if($('#list_noun').val() == '') { $('#list_noun').qtip("show"); do_submit = false; }
		if($('#list_city_id').val() == '') { $('#list_city_id').qtip("show"); do_submit = false; }
		
		if(do_submit == false) {
			$('html, body').animate({scrollTop:0}, 'fast')
			$('html, body').animate({scrollLeft:0}, 'fast')
		}
		
		return do_submit;
	});
	
	// Form error tips
	
	$('.form_error').qtip({
		style: 'err',
		position: {corner: {target: 'topMiddle', tooltip: 'bottomMiddle'}},
		show: {when: {event: false}, effect: {type: 'fade'}}
	})
});