$(function() {
	$('#themes div').click(function() {
		$(this).find('input[type=radio]').attr('checked','checked');
	});
	
	$('#themes div:not(.current-theme) img:not([src$=noscreenshot.png])').
		mouseover(function() {
			$(this).parent().css('z-index','1000');
			$(this).animate({width:'240px',height:'210px'},500);
		}).
		mouseout(function() {
			$(this).parent().css('z-index','0');
			$(this).animate({width:'57px',height:'50px'},100);
		});
	
	$('#themes-form input[type=submit][name=remove]').click(function() {
		if ($('#theme_default').attr('checked') != undefined) {
			alert(dotclear.msg.cant_delete_default_theme);
			return false;
		}
		
		if ($('#themes div.current-theme input[type=radio]').attr('checked') != undefined) {
			var msg = dotclear.msg.confirm_delete_theme_current;
		} else {
			var msg = dotclear.msg.confirm_delete_theme;
		}
		
		return window.confirm(msg);
	});
});