$(function(){
	window.defaultStatus="Design + Programming by FEINHEIT kreativ studio · www.feinheit.ch";

	$('#navi a').each(function () {
	   $(this).hover(function () {
	           $(this).animate({'margin-right':0}, 100);
	   }, function () {
	        if (!$(this).hasClass('mark')) {
	           $(this).animate({'margin-right':-30}, 100);
	        };
	   });
	});
	
	
	$('#create').hover(function () {
	    $(this).animate({'left':100}, 100); 
	}, function () {
	    $(this).animate({'left':112}, 100); 
	});
	
});


function exchange_crop_picture(picture_url) {
    show_crop_tool();
	$('#identity_form input[type=submit]').hide();
    $('#croptool').html('<img id="cropimg" src="'+picture_url+'" />');
    
    $('#cropimg').Jcrop({
        onSelect: updateValues,
        setSelect: [ 0, 0, 165, 185],
        aspectRatio: 0.9
    });
}

function cloneMore(selector, type) {
    var newElement = $(selector).clone(true);
    var total = $('#id_' + type + '-TOTAL_FORMS').val();
    
    newElement.children('input').each(function() {
        var name = $(this).attr('name').replace('-' + (total-1) + '-','-' + total + '-');
        var id = 'id_' + name;
        $(this).attr({'name': name, 'id': id}).val('').removeAttr('checked');
    });
    
    newElement.find('label').each(function() {
        var newFor = $(this).attr('for').replace('-' + (total-1) + '-','-' + total + '-');
        $(this).attr('for', newFor);
    });
    
    total++;
    $('#id_' + type + '-TOTAL_FORMS').val(total);
    $(selector).after(newElement);
}
