$(document).ready(function(){
	
	if($("div#Logogalerie").length){
		$.getScript('fileadmin/templates/js/galerie.js', function() {
		});
	}
	
	// You need to specify the size of your background image here 
	var FullscreenrOptions = {  width: 1772, height: 866, bgID: '#Studio #bgimgroot' };
	// This will activate the full screen background!
	jQuery.fn.fullscreenr(FullscreenrOptions);
	

	/*----------- Colorbox ------------*/
	$("body#studio .images a, #News .colorbox, .seeit .images a").colorbox({
		transition:'fade', 
		returnFocus:true ,
		height: '90%',
		current : 'Bild {current} von {total}'
	});

	$("#Navigation ul").lavaLamp({
			fx: "easeInSine", 
			speed: 400
		});
	
	$('#Middle').css({'height': (($(window).height()))});
	$(window).resize(function(){
 		$('#Middle').css({'height': (($(window).height()))});
	});
	
	//$("#background").fullBg();
	
	$('#Logogalerie').fadeTo("fast", 0.4);
	$('#Logogalerie').hover(
	function(){ //mouse over
		var $this=$(this);
		$this.stop().fadeTo("slow", 1);
	},
	function(){ //mouse out
		var $this=$(this);
		$this.stop().fadeTo("slow", 0.4);
	});
	
	$('#BPP a, #Facebook a, #MainContent a, #IPQ a').fadeTo("fast", 0.6);
	$('#BPP a, #Facebook a, #MainContent a, #IPQ a').hover(
	function(){ //mouse over
		var $this=$(this);
		$this.stop().fadeTo("slow", 1);
	},
	function(){ //mouse out
		var $this=$(this);
		$this.stop().fadeTo("slow", 0.6);
	});
	
	
	
	//error meldung bei formhandler
	$('.errornote').css({
		'position'			: 'absolute', 
		'z-index'			: '10000'
		});
	$('.errornote').addClass('errornoteposition');	
	$('.closebutton').css('display', 'block');
	$('.errorhide').click(function() {
  		$('.errornote').hide('fast', function() {
  		});
	});
	
	
	$('#News .content').hide();
	$('#News .head').click(function() {
		$('#News .head').removeClass('active');
	 	$('#News .content').slideUp('normal');
			if($(this).next().is(':hidden') == true) {
				$(this).addClass('active');
				$(this).next().slideDown('normal');
		 	} 
	 });
	 $('#News .close').click(function() {
		$('#News .head').removeClass('active');
	 	$('#News .content').slideUp('normal');
	 });
	 
	 
	 if($("#Studio div.fadetext").length){
		$('#Navigation ul li.first').append('<ul><li class="showtext"><a href="#">Information</a></li></ul>');
		$('.fadetext .inner').prepend('<div class="hidetext"><a href="#" title="schließen">X</div>');
		
	 }
	 
	 $('.hidetext:last').hide();
	 
	 if($("div.fadetext").length){
		$('#Navigation ul li ul .selectedLava').append('<li class="showtext"><a href="#">Information</a></li>');
		$('.fadetext .inner').prepend('<div class="hidetext"><a href="#" title="schließen">X</div>');
	 }
	 
	 $('.fadetext').hide();
	 $('.showtext').show();
	 
	 
	 
	 
	 $('.showtext').click(function() {
		$('.fadetext').fadeTo("slow", 1.0);
		$('.showtext').hide();
		return false;
	 });
	 
	 $('.hidetext a').click(function() {
		$('.fadetext').fadeTo("slow", 0.0);
		$('.showtext').show();
		return false;
	 });
	
	var title = $("em").attr("title");
  	$("div").text(title);


});



