/**
 *  functionality for specific pages.. 
 */

$(document).ready(function(){

	$("#openFuture").click(function() {
		$(".future").fadeOut("slow", function() {
			$(".futureOpened").fadeIn("slow");
		});
		
		return false;
	})


	$("a.whyUsLink").click(function() {
		$("#contentBox_3 .inner .image").fadeOut("slow");
		$(".whyUsTeasertext div").fadeOut("slow");
		$(".whyUsTeasertext p").fadeOut("slow");
		$(".celebrateSuccess").fadeOut("slow", function () {
			changeWhyUs(this);			
		});

		return false;
	})


	$("a.whyYouLink").click(function() {
		$("#contentBox_3 .inner .image").fadeOut("400");
		
		$(".whyYouTeasertext div").slideUp("slow");
		$("#" + $(this).attr("id") + "_answer").slideDown("slow");;
		
		return false;
	})


	setTimeout("boxDynamicContentSlider('marketleader')", 500);


});


function changeWhyUs(object) {
	$("#" + $(object).attr("id") + "_answer").fadeIn("slow");
	$(object).fadeIn("slow");
}


/**
 *  functionality for opening and closing the blocks on the aufgaben/erfolge pages..
 */
function initializeSubpages() {

	/*
	 *  subpages drop downs..
	 */
	$(".successBox a").click(function() {
		
		if($("#" + $(this).attr("id") + "_ro").hasClass("open")) {
			$(".successBox .open").slideUp();
			$(".successBox .open").removeClass("open");
			$(".examplesSuccessBox a").fadeIn();
			$(".successBox a").removeClass("openSubpageLink");
			
			return false;
		}
		
		$(".successBox .open").slideUp();
		
		$(".successBox .open").removeClass("open");
		$(".successBox a").removeClass("openSubpageLink");
		//$(".examplesSuccessBox a").fadeIn();
		
		$("#" + $(this).attr("id") + "_ro").addClass("open");
		$(this).addClass("openSubpageLink");
		$(".successBox #" + $(this).attr("id") + "_ro").slideDown();
		//$("a#" + $(this).attr("id")).fadeOut("slow");
		
		return false;
	})

}
