Rain.define(function() {
	$('#select-os').change(function() {
		if ('0' != $('option:selected', this).val()) {
			$('#os-version-toggler').show();
		} else {
			$('#os-version-toggler').hide();
		}
		var id = ('0' == $('option:selected', this).val()) ? '2' : $('option:selected', this).val();
		$('.os-version').hide();
		$('#os-'+id).show();

		$('#computer-types img').each(function() {
			var newSrc = $(this).attr('src');
			$(this).attr('src', newSrc.replace(new RegExp('computers\/(.+)\/'), 'computers/'+id+'/'));
		});
	});
	$('.os-version').change(function() {
		$('#input-os-version').val($('option:selected', this).val());
	});

    $('.delete-computer').submit(function() {
	if (!confirm('Do you want to delete this computer?')) {
		return false;
	}
});
});
