jQuery.noConflict();
/*** FOLDER ***/
jQuery(document).ready(function() {
	jQuery(".folderContent").hide();
	
	if (jQuery(".activeEvent").next().is(":hidden")) {
		jQuery(".activeEvent").next().slideDown();
		jQuery(".activeEvent").addClass("folderUp");
		jQuery(".activeEvent").removeClass("activeEvent");
	}	
		
	jQuery(".folderTop").click(function() {
		if (jQuery(this).next().is(":visible")) {
			jQuery(this).next().slideUp();
			jQuery(this).removeClass("folderUp");
			return false;
		}
		jQuery(".folderContent:visible").slideUp().prev().removeClass("folderUp");
		jQuery(this).next().slideDown();
		jQuery(this).addClass("folderUp");
	});
});
/*** BLOTTER ***/
jQuery(document).ready(function() {
	var leftPosition = 13;
	jQuery(".blotterTab").each(function() {
		jQuery(this).css("left",leftPosition);
		leftPosition = leftPosition + jQuery(this).innerWidth()+7;
	});
	jQuery(".blotterTab a:last").css("border","none");
});

function Blotter() {	
	this.blotterTab = [];
	this.blotterRegister = [];
	this.startTab = "";
	this.startRegister = "";
	this.setStartTab = function(tab, register) {
		this.startTab = tab;
		this.startRegister = register;
	}
	this.showStartTab = function(tab, register) {
		this.closeAllTabs();
		this.setStartTab(tab, register);
		document.getElementById(this.startTab).className = "active";
		document.getElementById(this.startRegister).style.display = "block";
	}
	this.addTab = function(tab, register) {
		this.blotterTab.push(tab);
		this.blotterRegister.push(register);
	}
	this.showTab = function(tab, register) {
		this.closeAllTabs()
		document.getElementById(tab).className = "active";
		document.getElementById(register).style.display = "block";
	}
	this.closeAllTabs = function() {
		var blotterRegisterCount = this.blotterRegister.length;
		for (var i = 0; i < blotterRegisterCount; i++) {
			document.getElementById(this.blotterRegister[i]).className = "";
		}
		var blotterTabCount = this.blotterTab.length;
		for (var i = 0; i < blotterTabCount; i++) {
			document.getElementById(this.blotterTab[i]).style.display = "none";;
		}
	}
} 
/*** SUCHFELD - Animation ***/
jQuery(document).ready(function() {

	jQuery('#search').css("display", "none");

	jQuery('#searchLink').click(function() {
		jQuery('#search').slideToggle('fast', function() {
			// Animation complete.
			//jQuery('#inputQuickSearch').focus();
			return false;
		});
	});
	jQuery('#search').focusout(function() {
		jQuery('#search').slideUp('fast', function() {
			// Animation complete.
			return false;
		});
	});	
});		
/*** QUICK ACCESS - Animation ***/
jQuery(document).ready(function() {
	jQuery('#quickAccessNav').css("display", "none");
	jQuery('#quickAccessNav li:last').css("border","none");			
	
	jQuery('#quickAccessLabel').toggle(function() {
		jQuery('#quickAccessText').fadeOut('fast', function() {						  
			// Animation complete.
			return false;
		});						
	}, function() {
		jQuery('#quickAccessText').fadeIn('fast', function() {						  
			// Animation complete.
			return false;
		});	
	});						
	jQuery('#quickAccessLabel').click(function() {				
		jQuery('#quickAccessNav').slideToggle('fast', function() { 
			// Animation complete.
			//jQuery('#quickAccess').focus();
			return false;
		});
	});
	/*jQuery('#quickAccess').focusout(function() {
		jQuery('#quickAccessNav').slideUp('fast', function() {
			jQuery('#quickAccessText').fadeIn('fast');
			// Animation complete.
			return false;
		});
	});*/		
});	

/*** TEAM TEASER - Animation ***/
jQuery(document).ready(function() {
	jQuery('.teaserTeam').mouseenter(function() {
		jQuery(this).find('.memberQuote').css('display', 'block');	
		jQuery(this).find('.teamMember').stop().animate({ 
			height: "160px",
			marginBottom: "-160px"
		}, 200 , "linear", function() {
				// Animation complete.
				jQuery(this).find('.memberLink').css('display', 'block');
		});
	});

	jQuery('.teaserTeam').mouseleave(function() {
		jQuery(this).find('.memberQuote').css('display', 'none');
		jQuery(this).find('.memberLink').css('display', 'none');
		jQuery(this).find('.teamMember').stop().animate({ 
			height: "40px",
			marginBottom: "0"
		}, 10 );
	});	
});		
/*** NEWS MODUL - Remove border-right from last news teaser ***/
jQuery(document).ready(function() {
	jQuery(".newsTeaser:last").css("border","none");
});
/***  TABLE MODUL - Remove border-right from last news teaser ***/
jQuery(document).ready(function() {
	jQuery("table.stammdatenTable tr td:last-child").css("border","none");
});	

/*** HELIAD INTERFACE / NAVIGATION ***/
jQuery(document).ready(function() {
	
	var NextNavElement; 											//Dort wird die als nächstes auszuführende Navigation gespeichert
	var aktivNav; 													//Hier wird die momentan aktive Navigation gespeichert

	function setHover(navElement)
	{
		navElement.initialize(); 									//Initialisiere die Navigation
		jQuery('#navItem'+navElement.navName).mouseenter(function() { 	//Wenn der Button der Navigation berührt wird
			if( !aktivNav || aktivNav == navElement ) 				//Ist keine Navigation aktiviert oder ich bin selber die aktive Navigation
				navElement.slideIn(); 								//Führe den SlideIn aus
			else 
				nextNav=navElement; 								//Ansonsten bin ich die nächste Navigation die aktiviert wird
		});

		jQuery('#navItem'+navElement.navName).mouseleave(function() { 	//Wenn der Button der Navigation verlassen wird
			if( aktivNav == navElement ) 							//Bin ich die aktive Navigation
				navElement.slideOut();								//Führe den SlideOut aus
			if( nextNav == navElement ) 							//Bin ich die nächste Navigation die aktiviert werden soll
				nextNav=""; 										//Dann gibt es keine nachfolgende Navigation mehr
		});
	}

	function navElement(NavName) 											//Navigations-Klasse
	{
		this.navName=NavName;
		
		//this.animationDuration=300;
		this.animationDuration=150;
		//this.animationWidth=744;
		this.animationWidth=224;
		this.animationActiv=false;
		
		this.initialize = function(){ 											//Initialisierung
			jQuery('#navItem'+NavName).removeClass('navItem'+NavName+'UseHover'); 	//Entferne den CSS Hover-Effekt
			jQuery(	'  #flyout'+NavName+
				', #statement'+NavName+
				', #flyLink'+NavName+
				', #cntFlyout'+NavName
			).css("display", "none");											//Mache den Navigationsbereich unsichtbar
			jQuery('#cntFlyout'+NavName).css("width", "0px"); 						//Setze die breite auf 0 Pixel
		}
		
		this.slideIn = function(){ 												//SlideIn-Effekt
			jQuery('#navItem'+NavName).addClass("navItem"+NavName+"Hover"); 			//Den Button die Hoverklasse zuweisen
			jQuery(	'  #flyout'+NavName+
				', #statement'+NavName+
				', #flyLink'+NavName+
				', #cntFlyout'+NavName
			).css("display", "block"); 											//Navigationsbereich sichtbar machen
			
			this.animationActiv=true; 											//Ich bin der aktive Navigationsbereich
			aktivNav=this; 														//Das ist der aktive Navigationsbereich
			nextNav="";
			
			jQuery('#cntFlyout'+NavName).stop(); 									//Stoppe momentane Animation
			
			jQuery('#cntFlyout'+NavName).animate(
				{ width: this.animationWidth+"px" },
				{ 
					duration: this.animationDuration, queue: false , complete: function()
					{
						//Starte neue Animation, und anschließend...
						jQuery(	'  #flyout'+NavName+
							', #statement'+NavName+
							', #flyLink'+NavName+
							', #cntFlyout'+NavName
						).css("display", "block"); 								//Navigationsbereich sichtbar machen
					}
				}
			);
		}
		
		this.slideOut = function(){ 											//SlideOut-Effekt
			jQuery(	'#flyout'+NavName+
				', #statement'+NavName+
				', #flyLink'+NavName
			).css("display", "block"); 											//Navigationsbereich sichtbar machen
			
			jQuery('#cntFlyout'+NavName).stop(); 									//Stoppe momentane Animation
			
			jQuery('#cntFlyout'+NavName).animate(
				{width: "0px"},
				{
					duration: this.animationDuration, queue: true, complete: function()
					{
						//Starte neue Animation, und anschließend...
						jQuery(	'#flyout'+aktivNav.navName+
							', #statement'+aktivNav.navName+
							', #flyLink'+aktivNav.navName+
							', #cntFlyout'+aktivNav.navName
						).css("display", "none"); 														//Mache den Navigationsbereich unsichtbar
						
						jQuery('#navItem'+aktivNav.navName).removeClass("navItem"+aktivNav.navName+"Hover");	//Entferne den Button die Hoverklasse 
						
						aktivNav.animationActiv=false;	 												//Ich bin nichtmehr die aktive Navigation
						aktivNav=""; 
						if(nextNav) 																	//Gibt es eine nachfolgende Navigation die aktiviert werden muss?
							nextNav.slideIn(); 															//Dann führe dessen SlideIn aus
					} 
				}
			);
		}
	}

	//Erstellung und Hover zuweisung der Navigationselemente
	navAbout = new navElement("About");
	navPortfolio = new navElement("Portfolio");
	navInvestor = new navElement("Investor");
	setHover(navAbout);
	setHover(navPortfolio);
	setHover(navInvestor);
	/****************/
	
});

/* 4ER TEASER MODUL - height */
jQuery(document).ready(function() {	
	var teasTextArray = new Array();
	jQuery('#cntContent .teasText').each(function(index) {
		teasTextArray[index] = jQuery(this).height();	
	});

	// Function to get the Max value in Array
	Array.max = function( array ){
		return Math.max.apply( Math, array );
	};

	// Function to get the Min value in Array
	Array.min = function( array ){
		return Math.min.apply( Math, array );
	};

	// alert(Array.max(teasTextArray));
	// alert(Array.min(teasTextArray));
	
	jQuery('#cntContent .teasText').each(function(index) {
		if(jQuery(this).height()<Array.max(teasTextArray)){
			jQuery(this).height(Array.max(teasTextArray));
		}			
	});

});	


