// Hubertus Design
window.addEvent('domready', function() {
	
	Cufon('#logo, #phone, #address, #email, #right h1, #right h2, #right h3, a.back');
	
	$$('div.tab').setStyle('display', 'none').each(function(el){
		el.store('show', 1).fade('hide').getPrevious().addEvent('click', function(){
			if(el.retrieve('show')) el.store('show', 0).setStyle('display', 'block').fade('in');
			else el.store('show', 1).fade('out').get('tween').chain(function(){el.setStyle('display', 'none')});
		}).getElement('a').erase('href');
	});
	
$$('div#right div.inner a[href^=http://], div#info a[href^=http://]').setProperty('target', '_blank')
	
});

// http://gist.github.com/133677
// MooTools based document.write replacement
// By: Thomas Aylott -- SubtleGradient.com
// With: Daniel Steigerwald -- daniel.steigerwald.cz
// License: MIT
// @require 'mootools'

(function($){
	var wrapper  = new Element('div'),
		fragment = document.createDocumentFragment();
	
	document._writeOriginal = document.write;
	document.write = function(){
		var args = arguments, id = 'document_write' + $time().toString(36);
		if (!Browser.loaded)
			document._writeOriginal('<span id="' + id + '"></span>');
		else
			id = new Element('span',{id:id}).inject(document.write.context);
		
		function documentWrite(){
			var html = Array.join(args, '');
			document.addEvent('domready', function(){
				Array.filter(wrapper.set('html', html).childNodes, document.write.filter).each(function(node){
					fragment.appendChild(node);
				});
				(id = $(id)).parentNode.replaceChild(fragment, id);
			});
		}
		
		setTimeout(documentWrite, 0);
	};
	document.write.context = document.body;
	document.write.filter = function(el){ return true; };
})(document.id||window.$);

