$(document).ready(function () {
	
	var form = $('#quickcheck_form');
	
	if (form) {
		form.find('.save').live('change', function () {
			$.cookie($(this).attr('name'), $(this).val());
		});
		
		form.find('input[type="text"].save').each(function () {
			var value = $.cookie($(this).attr('name'));
			if (value) {
				if (!$(this).attr('value')) {
					$(this).attr('value', value);				
				} else {
					$.cookie($(this).attr('name'), $(this).attr('value'));
				}			
			}
		});
		
		form.find('input[type="radio"].save').each(function () {
			var value = $.cookie($(this).attr('name'));
			if (value && $(this).val() == value) {
				$(this).click();
			}
		});
		
		
		form.find('select.save').each(function () {
			var value = $.cookie($(this).attr('name'));
			
			if (value) {
				$(this).find('option').each(function () {				
					if ($(this).attr('value') == value) {
						$(this).attr('selected', 'selected');
					}
				});
			}
		});		
	}	
	 
});

