$().ready (function() {
$('.link_block').hide();
$('.member-foto-prev').each(function(){
$(this).click(function(){
	$('.link_block').hide();
	$('#member-foto-big').attr('src', $(this).attr('src').replace(/tb/g, "crop"));
	if ($(this).attr('id') == 'member-face') {
		$('#link_block-face').addClass("active");
		$('#link_block-belt').removeClass("active");
		$('#link_block-fulllength').removeClass("active");
	} 	else if ($(this).attr('id') == 'member-belt') {
		$('#link_block-belt').addClass("active");
		$('#link_block-face').removeClass("active");
		$('#link_block-fulllength').removeClass("active");
	}	else if ($(this).attr('id') == 'member-fulllength') {
		$('#link_block-fulllength').addClass("active");
		$('#link_block-belt').removeClass("active");
		$('#link_block-face').removeClass("active");
	}
	return false;
});
});

$('#link_block_button').click(function(){
	$('.active').slideToggle();
	return false;
});

$('#seoform').hide();
$('#seolink').click(function(){
	$('#seoform').slideToggle();
	return false;
});

$('#topblock').hide();
$('#topblock_link').click(function(){
	$('#topblock').slideToggle();
	return false;
});

$('#vote-link').click(function(){
	$('#vote-block').slideToggle();
	return false;
});

$('#vote-link-top').click(function(){
	$('#vote-block').show();
});

$('#link_kontest_stop').click(function(){
	con = confirm("Вы уверены, что хотите закончить конкурс?")
	if (con) {
		parent.location='/admin/stop/';
	}
	return false;
});

if ($('#vote ul.errors').length) {
	$('#vote-block').show();
}

$('#link_kontest_start').click(function(){
	con = confirm("Вы уверены, что хотите начать конкурс?")
	if (con) {
		parent.location='/admin/start/';
	}
	return false;
});
$('#member_delete').click(function(){
	con = confirm("Вы уверены, что хотите удалить анкету этой участницы?")
	if (con) {
		parent.location= $(this).attr('href');
	}
	return false;
});

$('textarea.tiny').tinymce({
	script_url : '/js/tiny_mce/tiny_mce.js',
	mode : "textareas",
	theme : "advanced",
	language : "ru",
	remove_script_host : false,
	plugins : "safari,pagebreak,style,table,save,images,advlink,inlinepopups, media,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template, fullscreen",
	theme_advanced_blockformats : "p,h3,h4",
	theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,link,unlink,images, media, fullscreen,",
	theme_advanced_buttons2 : "bold,italic,|,bullist,numlist,blockquote,|,formatselect,fontsizeselect,|,sub,sup,charmap, code",
	theme_advanced_buttons3 : "tablecontrols,|,forecolor,backcolor, cleanup, anchor",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	});

});
