//MBLESSDE = {'typo3':{'config':{'language':'de'}}}; bzw. 'en'
// alert(MBLESSDE.typo3.config.language);

$('document').ready(function() {
	var bghint;

	$('div#headerpicbox12').hover(
		function() {
			o = $('div#headerpicbox11');
			o.stop(false, true);
			$(this).css('cursor', 'pointer');
			o.animate({opacity:0.90}, 400);
		},
		function() {
			o = $('div#headerpicbox11');
			o.stop(false, true);
			$(this).css('cursor', 'auto');
			o.animate({opacity:0.5}, 600);
		}
	);
	$('div#headerpicbox12').click(function() {
		dest = $(this).find('a').attr('href');
		if (dest) {
			window.location.href = dest;
		}
	});

	$('div.mcolColumns div.col-1 div.news-latest-item')
		.hover(
			function() {
				$(this).css('cursor', 'pointer');
				// $(this).css('background', 'url("fileadmin/layout/enbg/img/grau-20x40-e0-f4.png") repeat-x scroll top left #f4f4f4').css('color', '#000000');
			},
			function() {
				$(this).css('cursor', 'auto');
				// $(this).css('background', 'transparent').css('color', '#333333');
			}
		)
		.click(function() {
			window.location.href = $(this).find('a:first').attr('href');
	});
	$('div.mcolColumns div.col-2 div.news-latest-item')
		.hover(
			function() {
				$(this).css('cursor', 'pointer');
				$(this).css('background', 'url("fileadmin/layout/enbg/img/grau-20x40-e0-f4.png") repeat-x scroll top left #f4f4f4').css('color', '#000000');
			},
			function() {
				$(this).css('cursor', 'auto');
				$(this).css('background', 'transparent').css('color', '#333333');
			}
		)
		.click(function() {
			window.location.href = $(this).find('a:first').attr('href');
	});


	$('div#headerpicbox11').animate({opacity:0.5}, 0);
	window.setTimeout(function() {$('div#headerpicbox').fadeIn(1200);},1500);

	//$('div#headerpicbox').fadeIn(1200);
	//$('div#headerpicbox').animate({opacity:0.8}, 1200);


	// $('#sites-1').draggable();
	$('#sites-0').bind(
		'click',
		function(event, ui){
			$('#sites-1').fadeIn(400)
			$('#sites-1').css('height',$('#sites-1 .ddBody ul').height()+ 23);
			event.preventDefault();
		}
	);
	$('#sites-1').mouseleave( function(){ $(this).fadeOut(300) });


	$.each($('a.clickEnlarge'), function (i,v) {
		$(v).attr({
			'rel':$(v).parent().find('a:first').attr('rel'),
			'href':$(v).parent().find('a:first').attr('href')
		});
	})


	// $('table tr:even').addClass('even');
	// $('table tr:odd').addClass('odd');

	$('table.hover tbody tr').mouseover(function() {
			$(this).addClass('hover');
			// $(this).css('cursor','pointer');
	}).mouseout(function() {
			$(this).removeClass('hover');
	});


	if (MBLESSDE.typo3.config.language == undefined) {
		bghint = 'bghint_de';
	} else {
		bghint = 'bghint_' + MBLESSDE.typo3.config.language;
	}
	$('#searchinput').focus(function(){
		$(this).removeClass('bghint_de bghint_en');
	});
	$('#searchinput').blur(function(){
		if (!$(this).val().length) {
			$(this).addClass(bghint);
		}
	}).trigger('blur');
	
})
