$(document).ready(function(){
  $("#slides").slides({
    effect: 'fade',
    crossfade: true,
    fadeSpeed: 1000,
    generatePagination: false,
    play: 8000,
    pause: 2500,
    hoverPause: true
  });
});



$(document).ready(function(){
  $('#vip_code').focus(function() {
  	$(this).val('');
  });
});



$(document).ready(function() {
	$("#consult-date-time").datepicker();
	$("#event-date-time").datepicker();
});


function vip_contact_submit() {
	var first_name = escape($('#your-first-name').val());
	var last_name = escape($('#your-last-name').val());
	var fiance_first = escape($('#fiance-first-name').val());
	var fiance_last = escape($('#fiance-last-name').val());
	var address = escape($('#your-form-address').val());
	var city = escape($('#your-city').val());
	var state = escape($('#your-form-state').val());
	var zip = escape($('#your-form-zip-code').val());
	var email = escape($('#your-email-address').val());
	var day_phone = escape($('#your-phone-number').val());
	var night_phone = escape($('#your-evening-phone-number').val());
	var contact_time = escape($('#contact-times').val());
	var consult_date = escape($('#consult-date-time').val());
	var event_type = escape($('#type-of-event').val());
	var event_date = escape($('#event-date-time').val());
	var ceremony_location = escape($('#location-of-event').val());
	var reception_location = escape($('#location-of-reception').val());
	var num_guest = escape($('#number-of-guest').val());
	var comments = escape($('#how-did-you-hear-about-us').val());
	var code = escape($('#entered_vip_code').val());
	

	$('#vip_contact_form').height(1000);
	$('#vip_contact_form').html('<h4 class="vip_submission_message">Sending your message...</h4>');
	
	// Prepare query string and send AJAX request
	$.ajax({
		type: "POST",
		url: 'http://thefinishingtouchevents.com/wp-content/themes/TheFinishingTouch/send-contact.php',
		data: 	'ajax=true&first_name='+first_name+
				'&last_name='+last_name+
				'&fiance_first='+fiance_first+
				'&fiance_last='+fiance_last+
				'&address='+address+
				'&city='+city+
				'&state='+state+
				'&zip='+zip+
				'&email='+email+
				'&day_phone='+day_phone+
				'&night_phone='+night_phone+
				'&contact_time='+contact_time+
				'&consult_date='+consult_date+
				'&event_type='+event_type+
				'&event_date='+event_date+
				'&ceremony_location='+ceremony_location+
				'&reception_location='+reception_location+
				'&num_guest='+num_guest+
				'&comments='+comments+
				'&code='+code,
		success: function(success) {
			$('#vip_contact_form').html('<h4 class="vip_submission_message">Thank you for contacting us, one of our consultants will be in touch with you within 24-48 hours to set up your consultation. Please note your appointment is not set until confirmed with The Finishing Touch and is subject to availability</h4>');
		}
	});

	return false;
}


$(document).ready(function(){
  $('#vip_contact_form').submit(function() {
  	var first_name = $('#your-first-name').val();
  	var last_name = $('#your-last-name').val();
  	var email = $('#your-email-address').val();
  	
  	if (first_name == '' || last_name == '' || email == '') {
  		$('.highlight_required').css('color', 'red');
  	} else {
  		vip_contact_submit();
  	}
  	
  	return false;
  });
});
