$(document).ready(function() {
	
	/* Trappetype */
	// Handle onclick's
	$('.attribute-trappetype li').click(function() {
		// Set the value of the hidden form field to the selected type
		$(this).siblings().removeClass('selected');
		$(this).addClass('selected');
		$('.attribute-trappetype .form-field input').val($('.name', this).val());
	});
	
	// Handle reposted values
	var type = $('.attribute-trappetype .form-field input').val();
	if(type) {
		$('.attribute-trappetype li .name').each(function() {
			if(this.value == type) {
				$(this).parent('li').click();
			}
		});
	}
	
	/* Modell */
	
	$('.attribute-modell .modeller').change(function() {
		$('.attribute-modell .form-field input').val(this.value);
	});

	// Handle reposted values
	var type = $('.attribute-modell .form-field input').val();
	if(type) {
		$('.attribute-modell .modeller').val(type);
	}
	
});