/**
 * Schools
 * @version 1.0.2
 */
function schools_init()
{
	$(".search_data tbody tr").hover(
		function()
		{
			$(this).addClass("selected_row");
		},
		function()
		{
			$(this).removeClass("selected_row");

		}
	);

	$(".search_data tbody tr").bind("click", function()
	{
		location.href = $(this).find("a.school_link").attr("href");
	});

	$(".vote_link_yes, .vote_link_no").bind("click", function()
	{
		var element = $(this);
		var row = element.closest("tr");

		var school_id = row.find(".id").text();
		
		$("#vote_dialog_school_id").text(school_id);
		$("#vote_dialog_school").text(row.find(".school_link").text());
		$("#vote_dialog_town").text(row.find(".town").text());

		votes_set_values(element);

		return false;
	});

	$("#table_show").toggle(
		function() {
			$("#table_down").show('normal');
			return false;
		},
		function() {
			$("#table_down").hide("normal");
			return false;
		}
	);
	
	$("#table_close").bind('click', function(){
		$("#table_down").hide();
		return false;
	});

	$('.photo_image a').lightBox
	({
		txtImage: 'Фото',
		txtOf: 'из',
		txtPrev: ' Назад',
		txtNext: ' Вперед',
		imageBtnClose: '/!modules/jquery/css/lightbox/images/close.gif',
		imageBtnPrev:  '/!modules/jquery/css/lightbox/images/prev.gif',
		imageBtnNext: '/!modules/jquery/css/lightbox/images/next.gif',
		imageLoading: '/!modules/jquery/css/lightbox/images/loading.gif'
	});

}

$(schools_init);
