$(function() {
	$('.trigger').mouseover(function() {
		$('.pop#_' + this.id).each(function() {
			if (navigator.appName == 'Microsoft Internet Explorer')
				{this.parentNode.parentNode.style.display = 'block';}
			else
				{this.parentNode.parentNode.style.display = 'table-row';}
				
			$(this).show(300);
		});
	})
	
	$('.trigger').mouseout(function() {
		$('.pop#_' + this.id).each(function() {
			$(this).hide(300, function() {this.parentNode.parentNode.style.display = 'none';});
		});
	});
	
	
	$('.balloontrigger').mouseover(function() {
		$('.balloon', this.parentNode).show(300);
	});
	
	$('.balloontrigger').mousemove(function(e) {
		this.style.left = 300
	});
	
	$('.balloontrigger').mouseout(function() {
		$('.balloon', this.parentNode).hide(300);
	});
	
	$('.foldable .switch').prepend("<img class='foldImage' src='images/arrow_down.gif' alt='unfold' /> ")
	$('.foldable .hidden#default').each(function() {unfold(this)})
	
	function unfold(self)
	{
		$(self).show(300);
		$('img.foldImage', self.parentNode).each(function() {this.src="images/arrow_up.png";})
	}
	
	function fold(self)
	{
		$(self).hide(300);
		$('img.foldImage', self.parentNode).each(function() {this.src="images/arrow_down.gif";})
	}

	$('.foldable .switch').click(function() {
		
		$('.hidden', this.parentNode).each(function() {
			if (this.style.display != 'block')
			{
				$('.hidden', this.parentNode.parentNode).each(function() {fold(this)});
				$('.hidden', this.parentNode).each(function() {unfold(this)})
			}
			else
			{
				fold(this)
			}
		})
	})
	
})