function initialize() {
	setContentHeight();
	window.addEvent('resize', function() { setContentHeight() });
	setTimeout('setContentHeight()', 500);
	
	//Searchbox
	if($('search')) {
		$('search').addEvent('check', function() {
			if(this.get('value') == '' || this.get('value') == 'search') this.addClass('empty').set('value', 'search');
		}).addEvent('focus', function() {
			if(this.get('value') == 'search') this.removeClass('empty').set('value', '');
			if(!this.open) { 
				$('search-pane').set('morph', { duration: 600, onComplete: function() { setContentHeight() } }).morph({ 'background-color': '#f3f3f3', 'border-color': '#f3f3f3', 'height': 160 });
				this.open = true;
			}
		}).addEvent('blur', function() {
			this.fireEvent('check');
		}).fireEvent('check');
		
		if($('search-pane').hasClass('open')) {
			$('search-pane').setStyles({ 'background-color': '#f3f3f3', 'border-color': '#f3f3f3', 'height': 128 });
			$('search').open = true;
		}
	}
	
	//Tabs
	$('tab-container').getElements('a').each(function(a) {
		if(!a.hasClass('open')) a.set('tween', { duration: 100 }).addEvent('mouseenter', function() { this.tween('margin-top', [4, 0]) }).addEvent('mouseleave', function() { this.tween('margin-top', [0, 4]) });
	});
	
	//Bookmark
	$$('.article').each(function(article) {
		var bookmarkPane = article.getElement('div[class=bookmark]');
		var bookmarkLink = article.getElement('a[class=bookmark-link]');

		if(bookmarkLink) {
			bookmarkLink.addEvent('mouseenter', function() {
				//Calculate positition of the bookmark link
				var parentMiddle = bookmarkLink.getParent().getSize().x / 2;
				var contentMiddle = (window.getWidth() / 2) - 200;
				var left = (bookmarkLink.getLeft() - contentMiddle) + parentMiddle - 140;
				bookmarkPane.setStyles({ 'left': left, 'top': bookmarkLink.getTop() - 26, 'display': 'block' });
			});
			bookmarkPane.addEvent('mouseleave', function() { bookmarkPane.setStyle('display', 'none'); setContentHeight(); });
		}
	});
	
	//Commenting
	if($('comment-form')) {
		$('comment-form').getElement('input[name=confirmation]').addEvent('keyup', function(event) { this.set('value', this.get('value').toUpperCase()) });
		$('captcha').setStyle('opacity', .5);
		
		//bbCode
		var bbCode = $('comment-form').getElement('.bbcode-bar');
		
		bbCode.getElement('.bold').addEvent('click', function() { insertCode('comment-body', 'b', 'Text to be made bold') });
		bbCode.getElement('.italic').addEvent('click', function() { insertCode('comment-body', 'i', 'Text to be made italic') });
		bbCode.getElement('.strikethrough').addEvent('click', function() { insertCode('comment-body', 's', 'Text to strikethrough') });
		bbCode.getElement('.underline').addEvent('click', function() { insertCode('comment-body', 'u', 'Text to underline') });
		
		bbCode.getElement('.color').addEvent('click', function() { insertCodeAttr('comment-body', 'color', 'Standard CSS color value (colorname or hexcode)', 'Text to be colored') });
		bbCode.getElement('.code').addEvent('click', function() { insertCodeAttr('comment-body', 'code', 'Code type (e.g. php or javascript)', 'Code', true) });
		bbCode.getElement('.quote').addEvent('click', function() { insertCodeAttr('comment-body', 'quote', 'Person being quoted', 'Quoted text', true) });
		bbCode.getElement('.hyperlink').addEvent('click', function() { insertCodeAttr('comment-body', 'url', 'Url', 'Text to be hyperlinked') });
		
		var facesPane = bbCode.getElement('.faces-pane');
		bbCode.getElement('.faces').addEvent('mouseenter', function() {	facesPane.setStyle('display', 'block') });
		facesPane.addEvent('mouseleave', function() { facesPane.setStyle('display', 'none') });
		facesPane.getElements('img').each(function(face) { face.addEvent('click', function() { insertFace('comment-body', face.getProperty('alt')) }) });
	}
}

function setContentHeight() {
	$('content-container').setStyle(Browser.Engine.trident4 ? 'height' : 'min-height', window.getHeight() - 182);
	if($('right-column') && !Browser.Engine.trident4) $('right-column').setStyle('min-height', $('footer').getTop() - 148);
	
	if(!Browser.Engine.trident4) {
		var innerWidth;
		
		if(Browser.Engine.trident) {
			innerWidth = document.body.offsetWidth;
			if(Browser.Engine.trident5) innerWidth -= 2;
		} else innerWidth = window.getWidth();
		
		$('footer').setStyle('margin-left', -((innerWidth - 800) / 2));
		$('footer').getElement('.inner').setStyle('margin-left', (innerWidth - 800) / 2);
		$('footer').setStyle('width', innerWidth);
	}
}