


/*
========================================================
========================================================
========================================================
========================================================
!!!!!! NACH DEM LETZTEN WERT IN ARRAYS KEIN KOMMA !!!!!!
!!!!!! NACH DEM LETZTEN WERT IN ARRAYS KEIN KOMMA !!!!!!
!!!!!! NACH DEM LETZTEN WERT IN ARRAYS KEIN KOMMA !!!!!!
========================================================
========================================================
========================================================
========================================================
JA, WAR SCHON WIEDER.....
BEACHTEN, ANSONSTEN WIRD QUALITÄTSKONTROLLE HIERMIT
http://www.jslint.com/
EINGEFÜHRT
*/
 /*
	* itScaleInput = function to expand a given input
	* @ var options	=	array, keys are:
	* [defWidth]	=	int, the initial width of the input
	* [expWidth]	=	int, the expanded width of the input
	* [defText]		=	string,the default text for the input
	*
	*/
(function( $ ){ 
	$.fn.itScaleInput = function(options) {
		var settings = {
			'defWidth' : '100',
			'expWidth' : '250',
			'defText' : 'Search'
		};
		return this.each(function() {
			if ( options ) {
				$.extend( settings, options );
			}
			$(this).width(settings.defWidth);
			if( $(this).val()=== '' ){
				$(this).val(settings.defText);
			}
			$(this).focus(function(){
				if( $(this).val()== settings.defText ){
					$(this).val('');
				}
				$(this).animate({width:settings.expWidth}, 'fast' )
			});
			$(this).blur(function(){
				if($(this).val()===''){
					$(this).val(settings.defText);
				}
				$(this).animate({width:settings.defWidth}, 'fast' )
			});
		});
	};
})( jQuery );




/* Default function for fading elements on mouseover
 * 14.06.2011: SSp, DSp
 * Old version without hoverIntent:
 *  
	(function( $ ){
		$.fn.itFader = function (options) {
			var settings = {
				'fadeOut' : '.classname',
				'fadeIn' : '.classname',
				'duration' : 400,
				'delay' : 500
			};
			if (options) {
				$.extend(settings, options);
			};
			$(settings.fadeIn).hide();
			$(this).mouseenter(
				function () {
					$(this).find(settings.fadeOut).children().stop(true, true).fadeTo(settings.duration,'0.2');
					$(this).find(settings.fadeIn).stop(true, true).fadeTo(settings.duration,'1');
				}
			)
			$(this).mouseleave(
				function () {
					$(this).find(settings.fadeIn).delay(200).fadeTo(settings.duration,'0');
					$(this).find(settings.fadeOut).children().delay(settings.delay).fadeTo(settings.duration,'1');
				}
			);
		}
	})( jQuery );
	
 * New version with hoverIntent:
*/
 
(function( $ ){
	$.fn.itFader = function (options) {
		var settings = {
			'fadeIn' : '.classname',
			'fadeOut' : '.classname',
			'duration' : 400
		}; 
		if (options) {
			$.extend(settings, options);
		};
		$(this).hoverIntent({
			over: mouseEnter,
			timeout: 500,
			out: mouseLeave
		});
		$(settings.fadeIn).hide();
		function mouseEnter(){
			$(this).find(settings.fadeOut).children().fadeTo(settings.duration,'0.2');
			$(this).find(settings.fadeIn).fadeTo(settings.duration,'1');
		}
	
		function mouseLeave(){
			$(this).find(settings.fadeIn).fadeTo(settings.duration,'0');
			$(this).find(settings.fadeOut).children().fadeTo(settings.duration,'1');
		}
	}
})( jQuery );


/* Default function for filter foldout with hoverIntent
 * 30.08.2011: SSp
 * @ var options	=	array, keys are:
 * [filterOver]	=	string, Klasse des Overelements
 * [filterShow]	=	string, Klasse des 'Show'-Elements
 */
(function( $ ){
	$.fn.itFilter = function (options) {
		var settings = {
			'filterShow' : '.classname'
		}; 
		if (options) {
			$.extend(settings, options);
		};
		$(settings.filterShow).removeClass('noJavaScript');
	
		$(this).hoverIntent({
			over: filterListShow,
			timeout: 500,
			out: filterListHide
		});
	
		function filterListShow(){
			$(this).find(settings.filterShow).fadeIn(400);
		}
	
		function filterListHide(){
			$(this).find(settings.filterShow).fadeOut(250);
		}
	}
})( jQuery );

/* Default function for setting the hight of elements to fit in the grid
 * 14.06.2011: DSp, SSp
 */
(function( $ ){
	$.fn.defaultHeight = function (options) {
		var settings = {
			'multiplier' : 35,
			'corrector' : 1,
			'height_correction' : 0
		};
		if (options) {
			$.extend(settings, options);
		};
		$(this).each(function(){
			var totalHeight = $(this).outerHeight();
			if (totalHeight > settings.multiplier) {
				var innerHeight = $(this).height();
				var rounded = Math.ceil(totalHeight/settings.multiplier);
				var newTotalHeight = (rounded*settings.multiplier);
				var newHeight = (newTotalHeight - totalHeight) + innerHeight - settings.corrector;
				if ((newTotalHeight-totalHeight-settings.corrector)<settings.height_correction) {
					newHeight = newHeight + settings.multiplier;
				};
				$(this).height(newHeight);
			}
		});
	}
})($);

/* Default function for setting the height of "Nutzenbox" to 100%
 * 19.07.2011: SSp
 * @ var options	=	array, keys are:
 * [abzug]	=	int, Abzüglich der Elemente darüber (Überschrift etc.)
 * [referenz]	=	string, Klasse der Referenzhöhe
 */
(function( $ ){
	$.fn.nutzen = function (options) {
		var settings = {
			'abzug' : 48,
			'referenz' : ''
		};
		if (options) {
			$.extend(settings, options);
		};
		$(this).height($(settings.referenz).height() - settings.abzug);
	}	
})($);


/*
	Description: ???
	vars : ???
*/
(function( $ ){
	$.fn.gridHeight = function (options) {
		var settings = {
			'multiplier' : 35,
			'resize' : 1,
			'altChild' : '',
			'altResize' : 1,
			'debug' : 0
		};
		if (options) {
			$.extend(settings, options);
		};
		$(this).each(function(i){
			//Setzte Höhe des Kind-Elements
			var totalHeight = $(this).outerHeight();
			if (settings.resize==1) {
				var rounded = Math.ceil(totalHeight/settings.multiplier);
			}
			else {
				var rounded = Math.ceil(totalHeight/settings.multiplier)-1;
			}
			var missing = (rounded*settings.multiplier) - totalHeight;
			var childHeight = $(this).find(settings.child).height();
			var newChildHeight = childHeight + missing + 1;
			$(this).find(settings.child).height(newChildHeight);

			//Wenn nicht im Grid, setze Höhe des alternativen Kind-Elements
			if (settings.altChild!="" && ($(this).outerHeight()%settings.multiplier)!=0) {
				var totalHeight = $(this).outerHeight();
				if (settings.altResize==1) {
					var rounded = Math.ceil(totalHeight/settings.multiplier);
				}
				else {
					var rounded = Math.ceil(totalHeight/settings.multiplier)-1;
				}
				var missing = (rounded*settings.multiplier) - totalHeight;
				var childHeight = $(this).find(settings.altChild).height();
				var newChildHeight = childHeight + missing;
				$(this).find(settings.altChild).height(newChildHeight);
			};

			//Debug-Ausgabe
			if (((($(this).outerHeight()-1)%settings.multiplier)!=0)&&settings.debug==1) {
				alert("Fehler bei der Größenanpassung!");
				$(this).children().css({"background":"red"})
			}
		});
	}
})($);



$(function() {


	//find all form with class jqtransform and apply the plugin
	$(".jqtransform").jqTransform();

// main menu left foldout
	$('.menuMainDropdown').removeClass('noJavaScript');

	$('.menuMainLeftLi, .menuMainRightLi').removeClass('noJavaScriptLi').hoverIntent({
		over: topMenuDropShow,
		timeout: 500,
		out: topMenuDropHide
	});

	$('.menuMainLeftLink').bind({
		focusin: function() {
			$('.menuMainDropdown').stop(true, true).fadeOut(250);
			$(this).next('.menuMainDropdown').stop(true, true).fadeIn(500);
		},
		click: function() {
			$('.menuMainDropdown').remove();
		}
	});

	function topMenuDropShow(){
		$(this).addClass('javaScriptLi').find('.menuMainDropdown').fadeIn(400);
	}

	function topMenuDropHide(){
		$(this).removeClass('javaScriptLi').find('.menuMainDropdown').fadeOut(250);
	}


//$('.notepadItem').defaultHeight();

// mk 19.06.2011 17:34:25
//new teaser extension, please check the effect
	$('.itTeaser-link a').defaultHeight({
		"corrector" : 1
	});
	$('.itTestimonial-link a').defaultHeight({
		"corrector" : 0
	});
	$('.itTeaserLayout-2-cnt').gridHeight({
		"child" : ".itTeaserLayout-2-txt"
	});
	$('.itTeaserLayout-3-cnt').gridHeight({
		"child" : ".itTeaserLayout-3-txt"
	});

	$('.itTeaserLayout-12-cnt').gridHeight({
		"child" : ".itTeaserLayout-12-txt"
	});
	$('.tx-itpressmessages-item-link-first a').defaultHeight({
		"corrector" : 0
	});
	$('.tx-itpressmessages-item-link-middle a').defaultHeight({
		"corrector" : 0
	});
	$('.tx-itpressmessages-item-link-last a').defaultHeight({
		"corrector" : 0
	});		
  /*
	$('.itTestimonial-layout-1').gridHeight({
		"child" : ".itTestimonial-rightCnt-1"
	});
	*/
	/*
	$('.itTeaserLayout-21-cnt').gridHeight({
		"child" : ".itTeaserLayout-21-inner",
		"resize": 0
	});
	$('.itTeaserLayout-22-cnt').gridHeight({
		"child" : ".itTeaserLayout-22-inner",
		"resize": 0
	});
	$('.itTeaserLayout-31-cnt').gridHeight({
		"child" : ".itTeaserLayout-31-inner",
		"resize": 0
	});
	$('.itTeaserLayout-32-cnt').gridHeight({
		"child" : ".itTeaserLayout-32-inner",
		"resize": 0
	});
	$('.itTeaserLayout-41-cnt').gridHeight({
		"child" : ".itTeaserLayout-41-img",
		"resize": 0
	});
	
	$('.itTestimonial-layout-11').gridHeight({
		"child" : ".itTestimonial-rightCnt-11"
	});
	$('.itTestimonial-layout-12').gridHeight({
		"child" : ".itTestimonial-rightCnt-12",
		"altChild" : ".itTestimonial-useCnt-12"
	});
	$('.itTestimonial-layout-21').gridHeight({
		"child" : ".itTestimonial-rightCnt-21"
	});
	$('.itTestimonial-layout-22').gridHeight({
		"child" : ".itTestimonial-rightCnt-22",
		"altChild" : ".itTestimonial-useCnt-22"
	});
	$('.itTestimonial-layout-23').gridHeight({
		"child" : ".itTestimonial-rightCnt-23"
	});


	/*
	$('.itTeaserLayout-2-txt').defaultHeight({
		"corrector" : 1
	});

	$('.itTeaserLayout-3-txt').defaultHeight({
		"corrector" : 0
	});
	$('.itTeaserLayout-12-txt').defaultHeight({
		"corrector" : 1
	});
	$('.itTestimonial-rightCnt-1').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-rightCnt-11').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-rightCnt-12').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-useCnt-12').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-rightCnt-21').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-rightCnt-22').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-useCnt-22').defaultHeight({
		"corrector" : 22
	});
	$('.itTestimonial-rightCnt-23').defaultHeight({
		"corrector" : 22
	});
	$('.itTeaser-link a').defaultHeight({
		"corrector" : 3,
		"height_correction" : -3
	});
	$('.itTeaser-header').defaultHeight({
		"corrector" : 3
	});
	*/

	$('.tx-itcustomers-item').itFader({
		'fadeOut': '.tx-itcustomers-item-img',
		'fadeIn': '.tx-itcustomers-item-text',
		'duration': 400
	});
	
	$('.tx-itindustries-singleitem').itFader({
		'fadeOut': '.tx-itindustries-singleitem-img',
		'fadeIn': '.tx-itindustries-singleitem-text',
		'duration': 400
	});

// Hover for teaser items
	$('.itTeaserLayout-1-cnt').itFader({
		'fadeOut': '.itTeaserLayout-1-img',
		'fadeIn': '.itTeaserLayout-1-txt',
		'duration': 400
	});

	$('.itTeaserLayout-11-cnt').itFader({
		'fadeOut': '.itTeaserLayout-11-img',
		'fadeIn': '.itTeaserLayout-11-txt',
		'duration': 400
	});
	
// Hover for Filter Elements with hoverIntent
	$('.tx-itnews-filterlist').itFilter({
		'filterShow': '.tx-itnews-filter'
	});
	$('.tx-itevents-filterlist').itFilter({
		'filterShow': '.tx-itevents-filter'
	});
	$('.tx-itmessages-filterlist').itFilter({
		'filterShow': '.tx-itmessages-filter'
	});
	$('.tx-itpressmessages-filterlist').itFilter({
		'filterShow': '.tx-itpressmessages-filter'
	});	
	$('.tx-itpressreviews-filterlist').itFilter({
		'filterShow': '.tx-itpressreviews-filter'
	});	
	$('.menuType56-filterlist').itFilter({
		'filterShow': '.menuType56Ul1'
	});	
	$('.tx-itdownloads-filterlist').itFilter({
		'filterShow': '.tx-itdownloads-filter'
	});
	$('.tx-itjobs-filterlist').itFilter({
		'filterShow': '.tx-itjobs-filter'
	});	
	$('.tx-itfaq-filterlist').itFilter({
		'filterShow': '.tx-itfaq-filter'
	});
	$('.tx-itcustomers-filterlist').itFilter({
		'filterShow': '.tx-itcustomers-filter'
	});						

// Set Nutzenbox in Testimonials to 100%
	
	$('.itTestimonial-useUl-1').nutzen({
		'referenz' : '.itTestimonial-layout-1'
	});
	
	$('.itTestimonial-useUl-11').nutzen({
		'referenz' : '.itTestimonial-layout-11'
	});
	
	$('.itTestimonial-useUl-12').nutzen({
		'referenz' : '.itTestimonial-layout-12'
	});
	
	$('.itTestimonial-useUl-21').nutzen({
		'referenz' : '.itTestimonial-layout-21'
	});
	
	$('.itTestimonial-useUl-22').nutzen({
		'referenz' : '.itTestimonial-layout-22'
	});
	$('.itTestimonial-useUl-23').nutzen({
		'referenz' : '.itTestimonial-layout-23'
	});
	
	
	// foldout fce
	$('.foldoutHeader').each(function() {
		$('.foldoutContent').width($('.foldoutContent').width());
		$(this).css({'cursor':'pointer'});
			if ($(this).hasClass('jqTogglerHidden')) {
				$(this).next().hide();
			}
	});

	$('.foldoutHeader').bind('click',function() {

		$(this).next().slideToggle();
		$(this).toggleClass('jqTogglerVisible');
		$(this).toggleClass('jqTogglerHidden');
	});

	$(".foldoutHeader").mouseover(function() {
		$(this).toggleClass('jqTogglerHover');
	}).mouseout(function(){
		$(this).toggleClass('jqTogglerHover');
	});

	$('.sitemapTrigger').click(function (a) {
			 a.preventDefault();
			 if ($(this).next().is(":hidden")) {
					$(this).next().next().slideDown();
					$(this).next().show();
					$(this).hide();
					$.scrollTo('#sitemap',400);
				}
				else {
					$(this).next().slideUp();
					$(this).prev().show();
					$(this).hide();
					var hoehe=0;
					$('#pageDefault').animate({
						marginBottom: hoehe
					});
					$.scrollTo('-=530',400);
				}
	});
	
$('.infobox').each(function() {
	$(this).qtip({
		content: $(this).find('.tooltip-wrap'),
		position: {
      corner: {
      	target: 'topLeft',
        tooltip: 'bottomLeft'
      },
	    adjust: {
	      x: -10,
	      y: 0
	    }
    },
		style: { 
      width: 236,
      padding: 0,
      background: 'none',
      color: 'black',
      textAlign: 'left',
      border: {
         width: 0,
         radius: 0,
         color: ''
      }
    }
	}); 
});

$('.infobox-right').each(function() {
	$(this).qtip({
		content: $(this).find('.tooltip-wrap-right'),
		position: {
      corner: {
      	target: 'topRight',
        tooltip: 'bottomRight'
      },
	    adjust: {
	      x: 3,
	      y: 0
	    }
    },
		style: { 
      width: 236,
      padding: 0,
      background: 'none',
      color: 'black',
      textAlign: 'left',
      border: {
         width: 0,
         radius: 0,
         color: ''
      }
    }
	}); 
});		
	
	

});    

