// JavaScript Document
$(document).ready(  function(){
	
	var news = $('.newsblock').outerHeight();
	$('.right-block').height(news);
	$('#footer, #footclear').height(news+113);
	$('#wrapper').css('margin-bottom',-(news+113));
	
	if (!($.browser.msie && $.browser.version == 7)) {							 
		$(window ).bind('load resize', function(){							 
			var hh = $('#main').height();
			var ch = $('#content').height();
			if (ch < hh-10){
				$('#content').height(hh+10);
			}
		})
	}	
	else{
		$(window ).bind('load resize', function(){							 
			var hh = $('#main').height();
			var ch = $('#content').height();
			if (ch < hh-11){
				$('#content').height(hh+11);
			}
		})
	}

	// Инициализация prettyPhoto
	$("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'facebook',
		overlay_gallery: false
	});

	// Эмуляция атрибутов vspace, hspace и border у картинок в зоне визуального редактора
	$('div.wysiwyg img[vspace]').each(function() {
		$(this).css('margin-top',parseInt($(this).attr('vspace'))+'px').css('margin-bottom',parseInt($(this).attr('vspace'))+'px');
	});
	$('div.wysiwyg img[hspace]').each(function() {
		$(this).css('margin-left',parseInt($(this).attr('hspace'))+'px').css('margin-right',parseInt($(this).attr('hspace'))+'px');
	});
	$('div.wysiwyg img[border]').each(function() {
		$(this).css('border',parseInt($(this).attr('border'))+'px solid #4C4C4C');
	});
	
})
