var header    = document.id('h');
var headerol  = document.id('slideshow');
var headerlis = headerol.getElements('li');
var headerfx = new Fx.Tween(header);

var headerHeight = function() {
	if(document.id(document.body).get('id') && document.id(document.body).get('id').test('index')) {
		if(window.getHeight().toInt() < 500 && header.getHeight().toInt() > 300) {
			headerfx.start('height', '255px');
		} else if(window.getHeight().toInt() > 500 && header.getHeight().toInt() < 300) {
			headerfx.start('height', '355px');
		}
	}
}
window.addEvents({
	'load': function() {
		
	},
	'resize': function() {
		headerHeight();
	}, 
	'domready': function() {
		
		headerHeight();
		
		if(document.id('slideshow')) {
			var slide = document.id('slideshow');
			var slides = slide.getElements('li'); 
			s = 0, l = (slides.length-1);
			slides.each(function(sl, ix) {
				if(ix > 0) sl.fade(0);
			});
			(function() {
				slides[s].fade(0);
				s = (s < l) ? (s+1) : 0;
				slides[s].fade(1);
			}).periodical(6000);
		}
		
		if(document.id('popout')) {
			var pop = document.id('popout');
			var put = pop.getElements('input')[0];
			pop.setStyle('cursor', 'default').addEvent('click', function(clk) {
				new Event(clk).stop();
				put.focus();
				put.select()
			});
		}
		
	} 
});
