// -----------------------
// Document Ready
// -----------------------
$(document).ready(function(){

	// ---------------
	// SETUP 
	// ---------------
	
	// Check if form fields are empty, if not, apply filled_field class
	$('#assessment_form form input').each(function(){
		if($(this).val() == ""){
			$(this).removeClass('filled_field');
		} else {
			$(this).addClass('filled_field');
		}
	});
	
	//Field contents switches background
	$('#assessment_form form input').change(function(){
		if($(this).val() == ""){
			$(this).removeClass('filled_field');
		} else {
			$(this).addClass('filled_field');
		}
	});
	
	//Swap out input backgrounds when focused
	$('#assessment_form form input').focus(function(){
		$(this).addClass('field_focus');
	});
	
	//Remove focus class on blur
	$('#assessment_form form input').blur(function(){
		$(this).removeClass('field_focus');
	});
	
	//Swap out input backgrounds when focused
	$('#assessment_form form select').change(function(){
		$(this).removeClass('error');
	});
	
	// -------------
	// END FORM CODE



	// Check if form fields are empty, if not, apply filled_field class
	$('#offer_window form input').each(function(){
		if($(this).val() == ""){
			$(this).removeClass('filled_field');
		} else {
			$(this).addClass('filled_field');
		}
	});
	
	
	//Field contents switches background
	$('#offer_window form input').change(function(){
		if($(this).val() == ""){
			$(this).removeClass('filled_field');
		} else {
			$(this).addClass('filled_field');
		}
	});
	
	//Swap out input backgrounds when focused
	$('#offer_window form input').focus(function(){
		$(this).addClass('field_focus');
	});
	
	//Remove focus class on blur
	$('#offer_window form input').blur(function(){
		$(this).removeClass('field_focus');
	});
	
	//Swap out input backgrounds when focused
	$('#offer_window form select').change(function(){
		$(this).removeClass('error');
	});
	
	//Remove error class from email on change
	$('#field_ebook_email').change(function(){
		$(this).removeClass('error');
	});
	
	$('#field_assessment_email').change(function(){
		$(this).removeClass('error');
	});

	
});
