Cookie.write('mainContent', 'default');
var work = new Hash({
	bg : '#317e97',
	bottom_height : '600px',
	top_bottom : '240px',
	mainContent : 'work',
	content_height : '260px'
});
var cv = new Hash({
	bg : '#3993B0',
	bottom_height : '450px',
	top_bottom : '90px',
	mainContent : 'cv',
	content_height : '410px'
});
var contact = new Hash({
	bg : '#48A5C4',
	bottom_height : '600px',
	top_bottom : '240px',
	mainContent : 'contact',
	content_height : '260px'
});
function initialize() {
	$('menu_work').addEvent('click', function() {
		changeMainContent(work);
	});
	$('menu_cv').addEvent('click', function() {
		changeMainContent(cv);
	});
	$('menu_contact').addEvent('click', function() {
		changeMainContent(contact);
	});
}

function loadContent(obj) {
	var myRequest = new Request.HTML({
		url: 'inc/' + obj.mainContent + '.html',
		onRequest: function(){
		$('content_inc').set('text', '');
		},
		onComplete: function(response){
			$('content_inc').empty().adopt(response);
		},
	}).send();
}


function changeMainContent(obj) {
	$('content_inc').empty();
	var bodyFx = new Fx.Morph('body');
	var topFx = new Fx.Morph('top');
	var bottomFx = new Fx.Morph('bottom');
	$('top').setStyle('height', obj.content_height);
	$('content').setStyle('height', obj.content_height);
	$('content_inc').setStyle('height', obj.content_height);
	bodyFx.start({
		'background-color': obj.bg
	}).chain(function(){
		topFx.set({
			'bottom': obj.top_bottom
		});
		bottomFx.start({
			'height': obj.bottom_height
		}).chain(function(){loadContent(obj)
		});
	});
	Cookie.write('mainContent', obj.mainContent);
}

function activateCompany(str) {
	var workFx = new Fx.Morph('work_inc');
	var novomindFx = new Fx.Morph('novomind_ul');
	var cdigitFx = new Fx.Morph('cdigit_ul');
	var side;
	if (str == 'novomind') {
		side = 'right';
		chosenFX = novomindFx;
	}
	else {
		side = 'left';
		chosenFX = cdigitFx;
	};
	$(side + '_inc').empty();
	workFx.start({
		'padding-top' : '0px'
	}).chain(function(){
		chosenFX.set({
			'height' : '184px'
		});
		$(side + '_inc').addClass('content');
		var myRequest = new Request.HTML({
			url: 'inc/' + Cookie.read('mainContent') + '/' + str + '.html',
			onRequest: function(){
			$(side + '_inc').set('text', '');
			},
			onComplete: function(response){
				$(side + '_inc').empty().adopt(response);
			},
		}).send();
	})
};

function activateProject(str, target) {
	var myRequest = new Request.HTML({
		url: 'inc/' + Cookie.read('mainContent') + '/' + str + '.html',
		onRequest: function(){
		$(target).set('text', '');
		},
		onComplete: function(response){
			$(target).empty().adopt(response);
		},
	}).send();
};
