/*
 * mooTools fader functionality
 */
function highlight(elm) {
	opacity = 0.4;
	id = this.getProperty('id');
	if (id != 'c-linde') {
		$('c-linde').fade(opacity);
	}
	else {
		$('h-start').fade(0);
		$('h-linde').setStyle('display', 'block');
		$('h-linde').fade(1);
		$$('#c-linde .t1').setStyle('display', 'block');
		$$('#c-linde .t1').fade(1);
		$$('#c-linde .t2').fade(0);
	}
	if (id != 'c-parkhotel') {
		$('c-parkhotel').fade(opacity);
	}
	else {
		$('h-start').fade(0);
		$('h-parkhotel').setStyle('display', 'block');
		$('h-parkhotel').fade(1);
		$$('#c-parkhotel .t1').setStyle('display', 'block');
		$$('#c-parkhotel .t1').fade(1);
		$$('#c-parkhotel .t2').fade(0);
	}
	if (id != 'c-lindenhof') {
		$('c-lindenhof').fade(opacity);
	}
	else {
		$('h-start').fade(0);
		$('h-lindenhof').setStyle('display', 'block');
		$('h-lindenhof').fade(1);
		$$('#c-lindenhof .t1').setStyle('display', 'block');
		$$('#c-lindenhof .t1').fade(1);
		$$('#c-lindenhof .t2').fade(0);
	}
}

function normalize(elm) {
	opacity = 1;
	id = this.getProperty('id');
	if (id == 'c-linde') {
		$('h-start').fade(1);
		$('h-linde').fade(0);
		$$('#c-linde .t1').fade(0);
		$$('#c-linde .t2').fade(1);
	}
	if (id == 'c-parkhotel') {
		$('h-start').fade(1);
		$('h-parkhotel').fade(0);
		$$('#c-parkhotel .t1').fade(0);
		$$('#c-parkhotel .t2').fade(1);
	}
	if (id == 'c-lindenhof') {
		$('h-start').fade(1);
		$('h-lindenhof').fade(0);
		$$('#c-lindenhof .t1').fade(0);
		$$('#c-lindenhof .t2').fade(1);
	}
	$('c-linde').fade(opacity);
	$('c-parkhotel').fade(opacity);
	$('c-lindenhof').fade(opacity);
}
function link(elm) {
	id = this.getProperty('id');
	if (id == 'c-linde') {
		window.open('http://www.hotel-zur-linde.de');
	}
	if (id == 'c-parkhotel') {
		window.open('http://www.wellings-parkhotel.de');
	}
	if (id == 'c-lindenhof') {
		window.open('http://www.wellings-lindenhof.de');
	}
}
window.addEvent('domready', function() {
		// init
		$('h-start').fade(1);
		$('h-linde').fade(0);
		$('h-parkhotel').fade(0);
		$('h-lindenhof').fade(0);
		$$('#c-linde .t1').fade(0);
		$$('#c-parkhotel .t1').fade(0);
		$$('#c-lindenhof .t1').fade(0);

		// add hover events
		$('c-linde').addEvent('mouseover', highlight);
		$('c-linde').addEvent('mouseout', normalize);
		$('c-linde').addEvent('click', link);

		$('c-parkhotel').addEvent('mouseover', highlight);
		$('c-parkhotel').addEvent('mouseout', normalize);
		$('c-parkhotel').addEvent('click', link);

		$('c-lindenhof').addEvent('mouseover', highlight);
		$('c-lindenhof').addEvent('mouseout', normalize);
		$('c-lindenhof').addEvent('click', link);
   }
);

