//alert('testing');
var int = 0;
$(document).ready(function() {


	function fudge_images(){
	
		//alert('...');
		
		$('div.post_block_large').each(function(indexUl) {
	
			//$(this).find('img').load(function(){
	
				var w = $(this).find('img').width();
				var h = $(this).find('img').height();
				//alert('w: '+w+' h: '+h);
				
				if(h>w){
					//alert('move up');
					var posval = (h - w)/2;
					var posvall = "-"+posval;
					$(this).find('img').css('position', 'relative');
					$(this).find('img').animate({
						top: posvall,
						left: 0
						}, 1500);
		
				}
		
				if(w>h){
					//alert('move up');
					var posval = (w - h)/2;
					var posvall = "-"+posval;
					$(this).find('img').css('position', 'relative');
					$(this).find('img').animate({
						top: 0,
						left: posvall
						}, 1500);
				}
			//});
	
		});
	
		$('div.post_block_small').each(function(indexUl) {
	
			//$(this).find('img').load(function(){
	
				var w = $(this).find('img').width();
				var h = $(this).find('img').height();
				//alert('w: '+w+' h: '+h);
				
				if(h>w){
					//alert('move up');
					var posval = (h - w)/2;
					var posvall = "-"+posval;
					$(this).find('img').css('position', 'relative');
					$(this).find('img').animate({
						top: posvall,
						left: 0
						}, 1500);
		
				}
		
				if(w>h){
					//alert('move over');
					var posval = (w - h)/2;
					var posvall = "-"+posval;
					$(this).find('img').css('position', 'relative');
					$(this).find('img').animate({
						top: 0,
						left: posvall
						}, 1500);
				}
			//});
			
			
		});
	
	
		//clearInterval(int);
	}
	//fudge_images();
	setInterval(fudge_images, 3000);
	
	
	//my_image
	$('.my_image').each(function(indexUl) {
		
		//alert('.....');
		var w = $(this).width();
		//var p = $(this).parent().find('p').height();
		//alert('img: '+i+' p: '+p);
			
		$('#left_column p').css('margin-left', w+20);
		$('.one_half p').css('margin-left', w+20);
		
	});
	
	

});
