jQuery(document).ready(function(){
	jQuery('.Post:not(.style_mixed) p.wp-caption-text').each(function(){
		var margin = (jQuery(this).parent().children('img').attr('width')-570)/2;
		if (!margin) {
			margin = (jQuery(this).parent().children('a').children('img').attr('width')-570)/2;
		}
		if (isNaN(margin)) {
			margin = 0;
		}
		if (margin < 0) {
			margin *= -1;
		}
		if (jQuery.browser.msie) {
			if (parseInt(jQuery.browser.version) > 7) {
				jQuery(this).css({'position':'absolute'});
				jQuery(this).css({'margin-left':(550-jQuery(this).width()-margin)+'px'});
			} else {
				jQuery(this).css({'margin-right':margin-10+'px'});
			}
		} else {
			jQuery(this).css({'margin-right':margin-10+'px'});
		}	
	});
	
	if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8) {
		jQuery('.style_mixed .wp-caption').each(function(){
			jQuery(this).css({'margin-bottom':'20px'});
		});
	}
	
	jQuery('.style_mixed p.wp-caption-text').each(function(){
		
		var w = jQuery(this).parent().children('img').attr('width');
		if (!w) {
			w = jQuery(this).parent().children('a').children('img').attr('width');
		}
		
		if (jQuery.browser.msie && parseInt(jQuery.browser.version) > 7) {
			jQuery(this).css({'margin-left':'0px'});
			jQuery(this).css({'position':'relative'});
		}
		jQuery(this).css({'width':w+'px'});
	});
	
	jQuery('.PostContent p a.tt').each(function(){
		jQuery(this).parent().addClass('fixPostTwitter');
	});
});
