// ----------------------------------------------
// It's moo time!
// ----------------------------------------------

// When dom's ready
window.addEvent('domready', function() {

	// ----------------------------------------------
	// Browser detection for IE
	// ----------------------------------------------
	if(Browser.Engine.trident) {
		var myElement = new Element ('div', {
			'class':'alert',
			'html':'<p>This website uses the latest in HTML5 and CSS3 technologies which Internet Explorer just doesn\'t understand, which is a shame. I recommend you use one of the more cooler browsers like <a href="http://getfirefox.com">Firefox</a>, <a href="http://apple.com/safari">Safari</a> or <a href="http://google.com/chrome/">Chrome</a> that are much faster and FREE!</p>'
		});
		myElement.inject(document.body, 'top')
	}


	// ----------------------------------------------
	// Milkbox
	// ----------------------------------------------
	$$('#flickr a').setProperty('rel','milkbox[gall1]');
	milkbox = new Milkbox({
		autoPlay: true
	});


	// ----------------------------------------------
	// Lighter
	// ----------------------------------------------
	$$('pre').light({
		mode: 'ol',
		altLines: 'hover'
	});


	// ----------------------------------------------
	// Contact form [Ajax]
	// ----------------------------------------------
	var formContainer = $$('.contactform')[0];
	if($defined(formContainer)) {
		var formAction = formContainer.getElement('form').get('action');
		formContainer.getElement('form').addEvent('submit', function(e) {
		    e.stop();
		    this.set('send', {
		        url: formAction,
				onComplete: function() {
			    	var successMsg = new Element('p', {
			    		'text': 'Success! You\'re message has been sent.',
			    		'class': 'success'
			    	});
					successMsg.replaces(formContainer.getFirst()).highlight();
		    	}
		    }).send();
		});
	}

});