toggle_full_description = function(el) {
	project_name = $(el).up(1).down('h1').id;
	description = $(project_name + '-full-description');
	if(description.visible()) {
		new Effect.SlideUp(description, {duration: 0.5});
		el.innerHTML = el.innerHTML.replace('-', '+');
	} else {
		new Effect.SlideDown(description, {duration: 0.5});
		el.innerHTML = el.innerHTML.replace('+', '-');
	}
}

hover_logo = function() {
	$('logo_image').src = "assets/logo-hover.png";
}

unhover_logo = function() {
	$('logo_image').src = "assets/logo.png";
}

if(!Control) var Control = {};
Control.Header = Class.create();

Control.Header.prototype = {
	initialize: function(options) {
		this.images = $$("#slogans .slogan");
		this.current_image_index = 0;
		this.current_image = this.images[this.current_image_index - 1];
		this.image_count = this.images.size();
		this.options    = Object.extend({duration: 1.0, frequency: 5 }, options || {});
		// Hide unwated images
		for (var index = 0; index < this.images.size(); ++index) {
		  if(index > 0) this.images[index].hide();
		}
		this.periodicallyUpdate();
	},
	periodicallyUpdate: function() { 
		if (this.timer != null) {
			clearTimeout(this.timer);
			this.switchImage();
		}
		this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency*1000);
	},
	switchImage: function() {
		current_image = this.current_image_index;
		if(this.current_image_index < this.image_count - 1) {
			next_image = ++this.current_image_index;
		} else {
			next_image = this.current_image_index = 0;
		}
		this.hide(this.images[current_image]);
		this.show(this.images[next_image]);
	},
	hide: function(image) {
		new Effect.Fade(image, {duration: this.options.duration, queue: {position:'end', scope: 'menuxscope'}});
	},
	show: function(image) {
		new Effect.Appear(image, {duration: this.options.duration, queue: {position:'end', scope: 'menuxscope'}});
	}
}
