/**
 * jQuery-based animation on Home-Site
 *
 * Author: Mathias Demmer
 */
 
	// Set Values for Icon-Animation
 	var iconValue = new Array;
	var identifierString;
	
	var isSliding = false;
	
	
	iconValue[0] = new Array;
	iconValue[0]['pa_id'] = "Menu-01";			// identifying first class of main text-element
	iconValue[0]['ob_id'] = "Inhalt01";			// parent elements-class including text and icon
	iconValue[0]['ob_class'] = "icon_lehrer";	// class for identify icon-element
	iconValue[0]['top_before'] = 0;				// Y-position before sliding in; not yet in use
	iconValue[0]['top_after'] = -143;			// Y-position after sliding in; not yet in use
	iconValue[0]['opacity'] = 0.7;				// opacity after hover. Range: 0 - 1
	
	iconValue[1] = new Array;
	iconValue[1]['pa_id'] = "Menu-02";
	iconValue[1]['ob_id'] = "Inhalt02";
	iconValue[1]['ob_class'] = "icon_kletterer";
	iconValue[1]['top_before'] = 0;
	iconValue[1]['top_after'] = -204;
	iconValue[1]['opacity'] = 0.7;
	
	iconValue[2] = new Array;
	iconValue[2]['pa_id'] = "Menu-03";
	iconValue[2]['ob_id'] = "Inhalt03";
	iconValue[2]['ob_class'] = "icon_industriekletterer";
	iconValue[2]['top_before'] = 0;
	iconValue[2]['top_after'] = -204;
	iconValue[2]['opacity'] = 0.7;
	
	iconValue[3] = new Array;
	iconValue[3]['pa_id'] = "Menu-04";
	iconValue[3]['ob_id'] = "Inhalt04";
	iconValue[3]['ob_class'] = "icon_outdoor";
	iconValue[3]['top_before'] = 0;
	iconValue[3]['top_after'] = -204;
	iconValue[3]['opacity'] = 0.7;
	
	
 
$(document).ready(function(){
	
	// Define Event-Trigger, referencing to function proAnimate()
	$("#paedagogik").hover(function(){proAnimate(0,true)},function(){proAnimate(0,false)});
	$("#absturz").hover(function(){proAnimate(1,true)},function(){proAnimate(1,false)});
	$("#industrie").hover(function(){proAnimate(2,true)},function(){proAnimate(2,false)});
	$("#outdoor").hover(function(){proAnimate(3,true)},function(){proAnimate(3,false)});
	
});

/**
 * Sets opacity for called icon-element to zero
 *
 * @param int $iconId index-unique ID of element in iconValue-Array
 * @return no return
 */
function hideIcon(iconId) {	
	identifierString = "#" + iconValue[iconId]['ob_id'] + " ." + iconValue[iconId]['ob_class'];

	$(identifierString).animate({opacity: "hide"}, "fast")
}

/**
 * Sets opacity for called icon-element to full
 *
 * @param int $iconId index-unique ID of element in iconValue-Array
 * @return no return
 */
function showIcon(iconId) {	
	identifierString = "#" + iconValue[iconId]['ob_id'] + " ." + iconValue[iconId]['ob_class'];

	$(identifierString).animate({opacity: "show"}, "fast")
}

/**
 * Handle  show- and hide-status for main-elements triggering in callback to icon-handling-functions
 *
 * @param int $iconId index-unique ID of element in iconValue-Array
 * @param boolean $type call function with type=true for display and type=false for hiding element
 * @return no return
 */
function proAnimate(iconId,type) {

	var idString1 = "#" + iconValue[iconId]['ob_id'] + " ." + iconValue[iconId]['pa_id'];
	var idString2 = "#" + iconValue[iconId]['ob_id'] + " ." + iconValue[iconId]['ob_class'];
	var idOpacity = iconValue[iconId]['opacity'];
	
	if (type) {
		$(idString1).animate({ opacity: idOpacity }, 10 );
		$(idString1).animate({top: "0px"}, "slow", function(){showIcon(iconId); });
	}
	else {
		$(idString1).animate({top: "-205px"}, "slow", function(){hideIcon(iconId);});
	}

}

