$(function() {

// Body .safari class
	if ($.browser.safari) $('body').addClass('safari');
	
	$('body').addClass('mocha');

/* Hover effects */
	var fadeSpeed = ($.browser.safari ? 600 : 450);
	
	$('#logotype, ul.features a,#notice a').append('<span class="hover"></span>');
	$('.hover').css('opacity', 0);
	
/*$('#navigation .home, #navigation .contact,#logotype').hover(function() {*/
	$('.hover').parent().hover(function() {
		$('.hover', this).stop().animate({
			'opacity': 1
		}, fadeSpeed);
	}, function() {
		$('.hover', this).stop().animate({
			'opacity': 0
		}, fadeSpeed);
	});

/* Side Subnavigation */
	$('#subnavigation a').each(function() {	// Each <a>
		var html = this.innerHTML;
		$(this).html('<span class="hover"></span><span class="cap"></span><span>' + html + '</span>');
	});
	
/* Building Trailer */
	$('#trailer').html('<div class="loading"><img src="/lib/i/altar/bar.gif?x=' + Math.random() + '" class="bar" alt="" /><img src="/lib/i/altar/bar_reflect.gif?x=' + Math.random() + '" class="bar_reflect" alt=""/></div>');

/* Fading Trailer */
	setTimeout(function() {
			$('#trailer').fadeOut(2500);
		}, 4500);
		setTimeout(function() {
			$('#trailer img').animate({ opacity: 0 }, 1500);
		}, 2700);

/* Fade Out Notice */

$('#notice .close').click(function() { $('#notice').fadeOut(2500); return false; }); 

/* Octopus Engine */

	$('.section').each(function() {	// Each .section
		var html = this.innerHTML;
		$(this).html('<div class="highlight"><div class="shadow">' + html + '</div></div>');
	});

/* List Classing */
$("#sideblade ul,.features").each(function(i) {
			var lis = $(this).children();

			lis.filter(":first").addClass("first").end().filter(":last").addClass("last");
			lis.each(function(x) {
				if (x % 2 == 0) { $(this).addClass("even"); }
				if (x % 2 == 1) { $(this).addClass("odd"); }
				if (x % 4 == 3) { $(this).addClass("doubleEven"); }
			})
});

// Parallax
/*
	if ($.browser.safari) {
		var p1 = new Parallax({
			cName: '.b1',
			time: 35000,
			animate: [
				['left', 1400]
			]
		});
	}
*/
});
$(function() {

// Body .safari class
	if ($.browser.safari) $('body').addClass('safari');
	
	$('body').addClass('mocha');

/* Hover effects */
	var fadeSpeed = ($.browser.safari ? 600 : 450);
	
	$('#logotype, ul.features a,#notice a').append('<span class="hover"></span>');
	$('.hover').css('opacity', 0);
	
/*$('#navigation .home, #navigation .contact,#logotype').hover(function() {*/
	$('.hover').parent().hover(function() {
		$('.hover', this).stop().animate({
			'opacity': 1
		}, fadeSpeed);
	}, function() {
		$('.hover', this).stop().animate({
			'opacity': 0
		}, fadeSpeed);
	});

/* Side Subnavigation */
	$('#subnavigation a').each(function() {	// Each <a>
		var html = this.innerHTML;
		$(this).html('<span class="hover"></span><span class="cap"></span><span>' + html + '</span>');
	});
	
/* Building Trailer */
	$('#trailer').html('<div class="loading"><img src="/lib/i/altar/bar.gif?x=' + Math.random() + '" class="bar" alt="" /><img src="/lib/i/altar/bar_reflect.gif?x=' + Math.random() + '" class="bar_reflect" alt=""/></div>');

/* Fading Trailer */
	setTimeout(function() {
			$('#trailer').fadeOut(2500);
		}, 4500);
		setTimeout(function() {
			$('#trailer img').animate({ opacity: 0 }, 1500);
		}, 2700);

/* Fade Out Notice */

$('#notice .close').click(function() { $('#notice').fadeOut(2500); return false; }); 

/* Octopus Engine */

	$('.section').each(function() {	// Each .section
		var html = this.innerHTML;
		$(this).html('<div class="highlight"><div class="shadow">' + html + '</div></div>');
	});

/* List Classing */
$("#sideblade ul,.features").each(function(i) {
			var lis = $(this).children();

			lis.filter(":first").addClass("first").end().filter(":last").addClass("last");
			lis.each(function(x) {
				if (x % 2 == 0) { $(this).addClass("even"); }
				if (x % 2 == 1) { $(this).addClass("odd"); }
				if (x % 4 == 3) { $(this).addClass("doubleEven"); }
			})
});

// Parallax
/*
	if ($.browser.safari) {
		var p1 = new Parallax({
			cName: '.b1',
			time: 35000,
			animate: [
				['left', 1400]
			]
		});
	}
*/
});
