$(document).ready(function(){
	




$('#posts li.postWrapper div.post p a img').each(function() {
	$(this).attr({'title':'Click to enlarge'});
	
	var original_width = $(this).width();
var new_width = 450;
var k = new_width / original_width;
var new_height = $(this).height() * k;
$(this).width(450);
$(this).height(new_height);

});

$('#posts li.postWrapper div.post p a img').hover(function() {

	$(this).width(500);
	$(this).height($(this).height()*1.111);

}, function() {

	$(this).width(450);
	$(this).height($(this).height()/1.111);


});


	
	if($('#primaryContent').height() < $('#secondaryContent').height()) {

		$('#primaryContent').height($('#secondaryContent').height());		
		
		AY = $('#primaryContent').position().top;
		BY = $('#primaryContent .postWrapper:last').position().top;
		CY = $('#primaryContent .postWrapper:last').height();
		DY = $('#primaryContent').height();
		
var		missing_height = CY + (DY - ((BY- AY) + (CY))) - 10;
		
/* 			var missing_height = $('#primaryContent').height() + $('#secondaryContent').height() - $('#primaryContent').height() -10; */
/*
			var missing_height = 	$('#primaryContent .postWrapper:last').position().top 
								  + $('#primaryContent .postWrapper:last').height() ;
*/

			

			
	 	$('#primaryContent .postWrapper:last').height(missing_height);

		
	} else {
		$('#secondaryContent').height($('#primaryContent').height());
	}
	
/* 	$('#secondaryContent ul#sidebar').height($('#secondaryContent').height()-20); */
	
	
	
	setTimeout(change,800); 
	
	function change() {
		
		var sourceArr	= new Array(":)", ":(", ":/", ":$", ";)", "8)", ":|");
		
var 	randomKey = Math.floor(Math.random()*sourceArr.length);
var 	randomText = sourceArr[randomKey];
		
		
		$('#smiley').html(randomText).css({
			    'padding-top'	:	'0',
			    'margin-top'	:	'0',
		    	'padding-top'	:	'20px',
		    	'font-family': 'iaspis, iaspis_regular, Helvetica',
				'font-size':'30px'
		});
		

		setTimeout(change,800); 
	}
	
});
