window.addEvent('domready', function() {
	
	window.addEvent('resize', resize);
	
	//resize();
	window.fireEvent('resize');
	
	antispam_reloadmailto($('container'));
	
});

var resize = function() {
	debug('resize');
	var container = $('container');
	var wrap = container.getFirst('.wrap');
	var top = ( window.getSize().y - wrap.getSize().y ) / 2;
	container.setStyle('overflow-y', 'hidden');
	wrap.setStyle('margin-top', top);
	debug('top '+top);
	debug('window.getSize().y ' +window.getSize().y);
	debug('wrap.getSize().y '+wrap.getSize().y);
}

var antispam_reloadmailto = function(lid) {
	if($(lid) == null) {
		return;
	}
	$(lid).getElements('a[href^=mailto:]').each(
		function(el) {
			el.href = el.href.replace(/\[chez\]/,'@');
			el.set('html', el.get('html').replace(/\[chez\]/,'@'));
		}

	);
}
