$(document).ready(function() {
$('#gallery').cycle({		     //controls for slide show
	fx: 'scrollRight',
	timeout: 5000,
	speed: 1000,
	delay: -2000,
	next: '#rightArrow',
	prev: '#leftArrow'
});

$('#gallery2').cycle({		     //controls for slide show
	fx: 'scrollRight',
	timeout: 5000,
	speed: 1000,
	delay: -2000,
	next: '#rightArrow',
	prev: '#leftArrow'
});

$('#signup').validate();//validate form

$('a#map').bind('click', function() {
	window.location = 'http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=47+west+dundee+rd+wheeling+il+60090&sll=37.0625,-95.677068&sspn=59.119059,60.820313&ie=UTF8&hq=&hnear=47+W+Dundee+Rd,+Wheeling,+Cook,+Illinois+60090&ll=42.139112,-87.917404&spn=0.013811,0.014913&z=16&iwloc=r3';
	return false;
});

$('#new_patient_info').submit(function() {

	var name = $('#patient_name').val();
	var text = $('#new_information').val();
	var send = true;
	
	if (text === '') {
		var send = false;
		$('#text_error').show();
	}
	
	if (name === '') {
		var send = false;
		$('#name_error').show();
	}

	if (send) {
		var str = $(this).serialize();
		var url = 'includes/infoUpdate.php';
		
		$.post(url, str, function(data) {
			if (data == 'success') {
				$('#new_patient_info').remove();
				$('#thank_you').show();
				$('#text_error').hide();
				$('#name_error').hide();
			} else {
				alert('Something went wrong plese try again');
			}
		});//end post
	}
	
return false;
});//end submit

});//end ready
