window.addEvent('domready', function() {
	document.id('meta').fade('hide');
	w = '70%'; // standard width in case first post is a text post
	/* show meta panel */
	document.id('info').addEvent('click', function() {
		s = window.getScroll(); /* remember scroll state */
		document.id('meta').setStyle('display', 'block');
		document.id('meta').get('tween').start('opacity',1).chain(function(){
			document.id('main').setStyles({
				height: '10px',
				overflow: 'hidden'
			});
		});
	});
	/* hide meta panel */
	document.id('meta-close').addEvent('click', function() {
		document.id('meta').get('tween').start('opacity',0);
		document.id('main').setStyles({
			height: 'auto',
			overflow: 'visible'
		});
		window.scrollTo(s.x, s.y); // restore scroll state
	});
});

if ((!navigator.userAgent.match(/iPhone/i)) || (!navigator.userAgent.match(/iPod/i))) {  //check for iphone
	window.addEvent('load', function() {
		/* adjust paragraph sizes to images */
		$$('.post').each(function(el) {
			if (el.getElements('img') != false) {
				w = el.getElements('img').measure(function(){
   		 			return this.getSize().x;
				});
			w = w+'px';
			}
			el.setStyle('width', w); //set article width, fit to last post if no image is used
		});
	});
};
