/* Copyright (C) 2002-2011 by Home of the Brave
   Web http://home.of.the.brave.de
   E-Mail info@brave.de */
/* $Revision: 1.8 $ $Date: 2011/03/03 12:25:35 $ */

$(document).ready(function(){

	//Portrait Mouseover
	$('.matrix_8,.matrix_8_alpha,.matrix_8_omega').each(function() {
		var blocks = $(this).find('.block')
		if(blocks.length >= 2 && !$(this).parent().hasClass('anton_block')) {
			blocks.eq(1).addClass('matrix_8_text').hide();
			$(this).hover(function() {
				$(this).find('.matrix_8_text').show();
				$(this).find('.block:not(.matrix_8_text)').hide();
				if($(this).find('u').html() == 'E-Mail') {
					$(this).find('u').hide();
					$(this).find('.matrix_8_text').addClass('with_mail_icon');
				}
			}, function() {
				$(this).find('.block:not(.matrix_8_text)').show();
				$('.matrix_8_text').hide();
			});
		}
	});
	$('.matrix_6,.matrix_6_alpha,.matrix_6_omega').each(function() {
		var blocks = $(this).find('.block')
		if(blocks.length >= 2 && !$(this).parent().hasClass('anton_block')) {
			blocks.eq(1).addClass('matrix_6_text').hide();
			$(this).hover(function() {
				$(this).find('.matrix_6_text').show();
				$(this).find('.block:not(.matrix_6_text)').hide();
				if($(this).find('u').html() == 'E-Mail') {
					$(this).find('u').hide();
					$(this).find('.matrix_6_text').addClass('with_mail_icon');
				}
			}, function() {
				$(this).find('.block:not(.matrix_6_text)').show();
				$('.matrix_6_text').hide();
			});
		}
	});
	$('.matrix_8_text, .matrix_6_text').click(function() {
		var firstlink = $(this).parent().find('.block:first a:first')
		var gotourl = firstlink.attr('href');
		if(firstlink.length == '1') { window.location.href = gotourl; }
	});
	
	// News-Teaser bei Bedarf ausblenden
	if($('div.news_teaser').length == 1  && $('div.anton_block').length <= 0 && ($('div.news_teaser .block:first').html() == $('#content_main .block:first').html())) {
		$('div.news_teaser').hide();
	}
	
	// Highlightbox mouseover
	$('.highlight_box').hover(function() {
		$(this).addClass('highlight_box_hover');
	}, function() {
		$(this).removeClass('highlight_box_hover');
	});
	
	// Share
	var link = $('#tools_bookmark a.bookmark_share');
	var div = $('#bookmarks_social');
	div.hide();
	var bookmark_share_text = link.show().html();
	link.click(function() {
		if(div.css('display') == 'none') {
			div.fadeIn();
			$(this).html(bookmark_share_text.substr(0,bookmark_share_text.length - 1)+' &laquo;');
		} else {
			div.fadeOut();
			$(this).html(bookmark_share_text);
		}
		return false;
	});

});

