Cufon.replace('.mpc, h1', {fontFamily: 'MyriadProCond'});

$(document).ready(function () {
	
	page_resize();
	
	var preload = new Image();
	for (var i = 0; i < menu.length; i++) preload.src =  menu[i][1];
	
	$('#menu img').mouseover(function () {
		var id = $(this).attr('id').substring(5);
		$(this).attr('src', menu[id][1]);
	});
	$('#menu img').mouseout(function () {
		var id = $(this).attr('id').substring(5);
		$(this).attr('src', menu[id][0]);
	});	
	
	hs.showCredits = 0;	 
	hs.graphicsDir = '/e2/templates/harlamov/highslide/';
	hs.wrapperClassName = 'wide-border';
	
	hs.lang = {
		cssDirection: 'ltr',
		loadingText : 'Загрузка...',
		loadingTitle : 'Кликните для отмены',
		focusTitle : 'Кликните для вделения',
		fullExpandTitle : 'Сделать исходным размером (f)',
		creditsText : '',
		creditsTitle : '',
		previousText : 'Предыдущая',
		nextText : 'Следующая', 
		moveText : 'Двигать',
		closeText : 'Закрыть', 
		closeTitle : 'Закрыть (esc)', 
		resizeTitle : 'Изменить размер',
		playText : 'Вперед',
		playTitle : 'Запустить слайдшоу (пробел)',
		pauseText : 'Пауза',
		pauseTitle : 'Остановить слайдшоу (spacebar)',
		previousTitle : 'Прудыдущая (стрелка влево)',
		nextTitle : 'Следующая (стрелка вправо)',
		moveTitle : 'Двигать',
		fullExpandText : '1:1',
		number: 'Изображение %1 из %2',
		restoreTitle : 'Кликните для закрытия просмотра изображения, кликните и тащите для перемещения. Используйте стлеочки на клавиатуре для навигации по фотографиям.'
	}	
	
	$('.aa').mouseover(function () {$(this).addClass('aaa'); $(this).mouseout(function () {$(this).removeClass('aaa')});});
});

function get_menu_src_a (elem) {
	return elem.attr('src').replace('.png', '_a.png');
}

function get_menu_src (elem) {
	return elem.attr('src').replace('_a.png', '.png');
}

$(window).resize(function() {
	page_resize();
});

function page_resize() {
	var overflow_height = $(document).height() - ($('#content').height() + $('#header').height() + $('#menu').height() + $('#footer').height() - 3);
	if (overflow_height > 0) 
		$('#content').css('height', overflow_height + $('#content').height());
}

function feedback_post(form) {
	
	$('body').css('cursor', 'wait');

	$.getJSON('/ajax/feedback', $(form).serialize(), function(data) {
		$('body').css('cursor', 'default');
			if (data.result == 'success') {
				alert('Ваше сообщение отправлено.');
				form.reset();
				//$('#image_captcha').attr('src', '/e2/files/captcha.png?' + Math.random());
			} else {
				alert('Ошибка! ' + data.content + '.');
			}
		});	
	
}
