window.addEvent('domready', function() {

	// Enable signup click
	$('signup').addEvent('click', function() {
		window.location="/signup";
	});

	// Enable pricing click
	$('pricing').addEvent('click', function() {
		window.location="/pricing2";
	});
	
	// Enable pricing click
	$('tour').addEvent('click', function() {
		window.location="/tour";
	});

	
	// Show download splash
	$('download').addEvent('click', function() {
		show_splash();
	});
	
	// Show video splash
//	$('video').addEvent('click', function() {
//		alert("splash");
//	});
	
	$$('.inactive').addEvent('click', change_menu);
	
	// Change content according to the option
	$$('#links .item').addEvents({
		'mouseenter': function() {
			//this.getElement('.name').morph({height: 100, width: 200});
			//this.getElement('.subtitle').morph({height: 100, width: 200});
			//this.getElement('.name').morph({font: 28px Verdana, letter-spacing:-1px, font-style: bold});
		},
		'mouseleave': function() {
			//this.getElement('.name_hover').morph('.name');
			//this.getElement('.subtitle_hover').morph('.subtitle');
		}
	});
	
	$$('.size').setStyle("display", "none");
	
	$$('#download_container .linux').addEvents({
		'mouseenter': function() {

			this.getElement('.linux_logo').morph({height: 65, width: 55});
			$$('.lin_size').setStyle("display", "");
		},
		'mouseleave': function() {
			this.getElement('.linux_logo').morph({height: 58, width: 49});
			$$('.lin_size').setStyle("display", "none");
		}
	});
	
	$$('#download_container .mac').addEvents({
		'mouseenter': function() {

			this.getElement('.mac_logo').morph({height: 76, width: 68});
			$$('.mac_size').setStyle("display", "");
		},
		'mouseleave': function() {
			this.getElement('.mac_logo').morph({height: 68, width: 61});
			$$('.mac_size').setStyle("display", "none");
		}
	});
	
	$$('#download_container .windows').addEvents({
		'mouseenter': function() {

			this.getElement('.windows_logo').morph({height: 59, width: 67});
			$$('.win_size').setStyle("display", "");
		},
		'mouseleave': function() {
			this.getElement('.windows_logo').morph({height: 53, width: 60});
			$$('.win_size').setStyle("display", "none");
		}
	});
	
	$$('#splash_container .close')[0].addEvent('click', function() {
		hide_splash();
	});

});

function show_splash()
{
	var containerWidth = 350;
	var containerHeight = 545;
	
	$('splash').setStyle('display', '');
	$('splash_container').setStyle('display', '');
	
	var splashHeight = $(window).getHeight();
	var splashWidth = $(window).getWidth();
	
	$('splash_container').setStyle('width', containerWidth);
	$('splash_container').setStyle('height', containerHeight);
	
	$('splash_container').setStyle('left', (splashWidth - containerWidth)/2);
	$('splash_container').setStyle('top', (splashHeight - containerHeight)/2);

}

function hide_splash()
{
	$("splash").style.display = 'none';
	$("splash_container").style.display = 'none';
}

function change_menu() {
	
	if ($(this).hasClass('blog') || $(this).hasClass('support')) {
		return;
	}
	
	$$('.active').addClass('inactive') & $$('.active').removeClass('active') & $(this).addClass('active') & $(this).removeClass('inactive');
	
	$$('.box').each(function(e) {
		$(e).style.display = 'none';
	});
	if ($(this).hasClass('information')) {
		$('box_information').style.display = '';
	}
	if ($(this).hasClass('pulse')) {
		$('box_pulse').style.display = '';
	}
	if ($(this).hasClass('cards')) {
		$('box_cards').style.display = '';
	}
	if ($(this).hasClass('management')) {
		$('box_management').style.display = '';
	}
	if ($(this).hasClass('desktop')) {
		$('box_desktop').style.display = '';
	}
	
	$$('.inactive').addEvent('click', change_menu);
}

/*		
	
	$('.text').removeClass('active');
	$('.text').addClass('inactive');
	$(this).removeClass('inactive');
	$(this).addClass('active');
	$("#info_box").slideUp();
	$("#info_box").slideDown();
	
*/