$(document).ready(function () {
	//Красивые Alert'ы
	window._alert = window.alert;
	window.alert = function(message) {
		$.pnotify({
			pnotify_title: 'Системное сообщение',
			pnotify_text: message,
			pnotify_delay: 5000
		});
	};
	
	$('.top_menu td').mouseover(function() {
		$('.context-menu', this).show();
		$('a:first', this).addClass('active');
	}).mouseout(function() {
		$('.context-menu', this).hide();
		$('a:first', this).removeClass('active');
	});
	
	$('#page_content img, .blue_label').load(function() {
		var $this = $(this);
		if ($this.attr('alt') || $this.attr('title')) {
			$this.replaceWith(
				$('<div>').css('position', 'relative')
				.append($this.clone())
				.append($('<div>').text($this.attr('alt') || $this.attr('title')).css({
					position: 'absolute',
					bottom: '3px',
					width: $this.width()-16+'px',
					height: '26px',
					'background-image': 'url("/public/site/img/media_label.png")',
					color: '#fff',
					padding: '9px 15px 3px 3px'
				}))
			);
		}
	});
	
	$('#projects_filter').change(function(){
		location.href = $(this).val();
	});
});
