	/* **************************************************************************************************** */
	/* Navigation-Slide-Effect */
	
var slideOpen 		= false;
var classNameOpen	= '';
var slideIsRun 		= false;

dojo.addOnLoad( function()	{
	initNavigationSlideEffect();
} );
	// Initialize Slide
function initNavigationSlideEffect()	{
	dojo.query( 'ul.header_navigation_lvl1 > li' ).connect( 'onclick', function()	{
		var nodes = dojo.query( this ).children( 'div' );
		if( nodes.length > 0 )	{
			var set = false;
			
			if( dojo.hasClass( this, 'act' ) )	 {
				dojo.removeClass( this, 'act' );
				set = true;
			}
			
			var className 	= dojo.query( this ).attr( 'class' );
			var slideID		= 'navi';
			var height 		= parseInt( dojo.query( this ).style( 'height' ) );
			
			if( set )	{
				dojo.addClass( this, 'act' );
			}
				
			if( ! slideIsRun )	{
				slideIn( slideID, className, height );
			}
		}
	} );
}
	// Open Slide
function slideIn( slideID, className, defaultHeight )	{
	var slideAnim		= '';
	var slideAnimations = new Array();
	
	if( slideOpen && className.toString() != classNameOpen.toString() )	{
		slideAnim = slideOut( slideID, classNameOpen, defaultHeight );
		
		slideAnimations.push( slideAnim );
		slideOpen 		= false;
		classNameOpen	= '';
	}
	
	
	if( ! slideOpen )	{
		slideOpen 			= true;
		classNameOpen		= className;
		
		var domNode			= dojo.query( '#' + slideID );
		var domNodeItem 	= dojo.query( '.' + className + ' .header_navigation_lvl2_wrap' );
		
		domNodeItem.style( 'display', 'block' );
		
		var itemHeight 		= parseInt( domNodeItem.style( 'height' ) );
		var itemTolerance	= parseInt( domNodeItem.style( 'top' ) ) - defaultHeight;
		
		var start 	= defaultHeight;
		var end		= start + itemHeight + itemTolerance;
		
		//dojo.query( '.' + className ).addClass( 'act' );
		dojo.query( 'div#footer' ).style( 'zIndex', '0' );
		slideAnim = animateSlideProperty( slideID, start, end, domNodeItem, 'block' );
		slideAnimations.push( slideAnim );
	}
	
	dojo.fx.chain( slideAnimations ).play();
}
	// Close Slide
function slideOut( slideID, className, defaultHeight )	{
	var domNode			= dojo.query( '#' + slideID );
	var domNodeItem 	= dojo.query( '.' + className + ' .header_navigation_lvl2_wrap' );
	
	var naviHeight 		= parseInt( domNode.style( 'height' ) );
	var itemHeight 		= parseInt( domNodeItem.style( 'height' ) );
	var itemTolerance	= parseInt( domNodeItem.style( 'top' ) ) - defaultHeight;
	
	domNodeItem.style( 'display', 'none' );
	
	var start 	= naviHeight;
	var end		= defaultHeight;
	
	return animateSlideProperty( slideID, start, end, domNodeItem, 'hidden' );
}
	// Animate Slide
function animateSlideProperty( slideID, start, end, domNodeItem, display )	{
	switch( display )	{
		case 'hidden':
			display = '';
			break;
	}
	
	var slideCurrent = dojo.animateProperty( {
		node: dojo.byId( slideID ),
		duration: 400,
		properties: {
			height: {
				start: start,
				end: end
			}
		},
		onBegin: function()	{
			slideIsRun = ( ! display ) ? true : slideIsRun;		
		},
		onEnd: function()	{
			if( display )	{
				slideIsRun = false;
				domNodeItem.style( 'opacity', '1' );
			}
		}
	} );
	
	return slideCurrent;
}
	// Hide Navigation-Elements
function navigationSlideOut()	{
	var slideAnimations = new Array();
	
	dojo.forEach( dojo.query( '.slideable' ), function( item, idx )	{
		if( parseInt( dojo.query( item ).style( 'left' ) ) == 0 )	{
			slideAnimations.push(
				dojo.animateProperty( {
					node: item,
					duration: 1200,
					properties: {
						left: {
							start: "0",
							end: parseInt( dojo.query( item ).style( 'width' ) ) * -1
						}
					}, 
					onEnd: function()	{
						dojo.query( 'div#navigationslide' ).style( 'zIndex', '0' );
						dojo.query( 'div#navigationslide-in' ).style( 'display', 'block' );
						dojo.query('div#footer').style( 'zIndex', '1' );
					}
				} )
			);
		}
	} );
	
	
	if( slideAnimations.length > 0 )	{
		dojo.fx.combine( slideAnimations ).play();
	}
}
	// Show Navigation-Elements
function navigationSlideIn()	{
	var slideAnimations = new Array();
	
	dojo.forEach( dojo.query( '.slideable' ), function( item, idx )	{
		if( parseInt( dojo.query( item ).style( 'left' ) ) < 0 )	{
			slideAnimations.push(
				dojo.animateProperty( {
					node: item,
					duration: 1200,
					properties: {
						left: {
							start: parseInt( dojo.query( item ).style( 'width' ) ) * -1,
							end: "0"
						}
					}, 
					onBegin: function()	{
						dojo.query( 'div#navigationslide' ).style( 'zIndex', '2' );
						dojo.query( 'div#navigationslide-in' ).style( 'display', 'none' );
						dojo.query('div#footer').style( 'zIndex', '9' );
					}
				} )
			);
		}
	} );
	
	
	if( slideAnimations.length > 0 )	{
		dojo.fx.combine( slideAnimations ).play();
	}
}
	/* **************************************************************************************************** */
	
	
	/* **************************************************************************************************** */
	/* Resizing */
	
dojo.addOnLoad(function(){
	resizeWindow();
	resizeFooterNavi();
	resizeHelpTooltip();
	
	dojo.connect( window, 'onresize', function()	{ 
		resizeWindow();
		resizeFooterNavi();
		resizeHelpTooltip();
		resizeCampItems();
		resizeCampVariantItems();
	} );
}); 
	// Resize Window
function resizeWindow()	{
	var w = dojo.isIE ? document.documentElement.clientWidth : window.innerWidth;
	var h = dojo.isIE ? document.documentElement.clientHeight : window.innerHeight;
	
	if( w < 1260 || h < 910 )	{ 
		dojo.query( '#resize' ).attr( 'class', 'low' ); 
	}
	else	{
		dojo.query( '#resize' ).attr( 'class', 'high' );
	}
	
	setBackgroundImage( 'body', 'body' );
}
	// Resize CampItems
function resizeCampItems()	{
	setPositions( '.map-con-camp' );
}
	// Resize CampVariantItems
function resizeCampVariantItems()	{
	setPositions( '.camp-map-con-variant' );
}
	// Background
function setBackgroundImage( from, to )	{
	if( from != to )	{
		dojo.query( to ).attr( 'data-bg-low', dojo.query( from ).attr( 'data-bg-low' ) );
		dojo.query( to ).attr( 'data-bg-high', dojo.query( from ).attr( 'data-bg-high' ) );
	}
	
	
	var size 	= dojo.query( '#resize' ).attr( 'class' );
	var image 	= dojo.query( from ).attr( 'data-bg-' + size );
	if( size != 'low' && image == '' )	{
		image = dojo.query( from ).attr( 'data-bg-low' );
	}
	
	
	if( image != '' )	{
		dojo.query( to ).style( 'backgroundImage', 'url(\'' + image + '\')' );
		dojo.query( to ).style( 'backgroundPosition', 'top center' );
		dojo.query( to ).style( 'backgroundRepeat', 'no-repeat' );
	}
}
	// Positions
function setPositions( queryItem )	{
	if( dojo.query( queryItem ).length > 0 )	{
		var size = dojo.query( '#resize' ).attr( 'class' );
		var unit = 'px';
		
		dojo.query( queryItem ).forEach( function( item ) {
			var top		= dojo.query( item ).attr( 'data-top-' + size );
			var left	= dojo.query( item ).attr( 'data-left-' + size );
			
			dojo.query( item ).style( {
				'top': top + unit,
				'left': left + unit
			} );
		} );
	}
}
	// Resize Footer-Navi
function resizeFooterNavi()	{
	var w_h = dojo.isIE ? document.documentElement.clientHeight : window.innerHeight;
	var f_t = parseInt( dojo.query( '#footer' ).style( 'top' ) );
	var f_h = parseInt( dojo.query( '#footer' ).style( 'height' ) );

	var u 	= 'px';
	if( w_h > ( f_t + f_h ) )	{
		dojo.query( '#footer' ).style( 'top', ( w_h - f_h ) + u );
	}
}
	// Resize Help-Tooltip
function resizeHelpTooltip()	{
	if( dojo.query( '#help-tooltip' ).length == 1 )	{
		var tc_h 	= parseInt( dojo.query( '#help-tooltip-content' ).style( 'height' ) );
		var ts_h 	= parseInt( dojo.query( '#help-tooltip-shadow' ).style( 'height' ) );
		var f_t 	= parseInt( dojo.query( '#footer' ).style( 'top' ) );
		var f_h 	= parseInt( dojo.query( '#footer' ).style( 'height' ) );
		
		var u 		= 'px';
		var h		= f_t + f_h;
		if( ( tc_h < h ) && ( tc_h < h ) )	{
			dojo.query( '#help-tooltip-content' ).style( 'height', h + u );
			dojo.query( '#help-tooltip-shadow' ).style( 'height', h + u );
		}
	}
}
	/* **************************************************************************************************** */

	
	/* **************************************************************************************************** */
	/* Search-Panel */
var controllerID 		= 'search-controller';
var search_conID 		= 'campsearch-event-con';
var search_eventID 		= 'campsearch-event';
var search_handlerID 	= 'campsearch-handler';
var navi_conID 			= 'campnavi-event-con';
var navi_eventID 		= 'campnavi-event';
var navi_handlerID 		= 'campnavi-handler';

dojo.addOnLoad( function() {
		// campsearch
	dojo.query( '#' + search_eventID ).connect( 'onclick', function()	{ 
		if( dojo.query( '#content' ).style( 'display' ) != 'none' )	{
			animate_searchpanel( controllerID, search_conID, search_handlerID, search_eventID );
			getSearchform();								// show search page
			navigationSlideOut();							// hide navigation panel
		}
	} );
		// campnavi
	dojo.query( '#' + navi_eventID ).connect( 'onclick', function()	{ 
		animate_searchpanel( controllerID, navi_conID, navi_handlerID, navi_eventID );
	} );
} );
	// Animate Searchpanel
function animate_searchpanel( controllerID, conID, handlerID, eventID )	{
	var anim 		= '';
	var animArr 	= new Array();
		
	var duration	= 1000;
	var unit		= 'px';
	
	
		// get controller-data
	var controller_top 			= parseInt( dojo.query( '#' + controllerID ).style( 'top' ) );		
	var controller_height 		= parseInt( dojo.query( '#' + controllerID ).style( 'height' ) );
			
		// get con-data
	var con_height 				= parseInt( dojo.query( '#' + conID ).style( 'height' ) );
			
		// get handler-data
	var handler_height 			= parseInt( dojo.query( '#' + handlerID ).style( 'height' ) );
	
	
		// open/close panel
	var controller_top_start 	= controller_top;
	var controller_top_end 		= 0;
	var controller_height_start = controller_height;
	var controller_height_end 	= 0;
	var con_height_start 		= con_height;
	var con_height_end 			= 0;
	if( dojo.hasClass( eventID, 'open' ) )	{
		controller_top_end 		= controller_top + handler_height;
		controller_height_end 	= controller_height - handler_height;
		con_height_end 			= con_height - handler_height;
		
			// set event-data
		dojo.query( '#' + eventID ).removeClass( 'open' );
	}
	else	{
		controller_top_end 		= controller_top - handler_height;
		controller_height_end 	= controller_height + handler_height;
		con_height_end 			= con_height + handler_height;
		
			// set event-data
		dojo.query( '#' + eventID ).addClass( 'open' );
	}
		
		// set controller-data
	animArr.push( dojo.animateProperty( {
		node: controllerID,
		duration: duration,
		properties: {
			top: {
				start: controller_top_start,
				end: controller_top_end,
				unit: unit
			},
			height: {
				start: controller_height_start,
				end: controller_height_end,
				unit: unit
			}
		} 
	} ).play() );
			
		// set con-data
	animArr.push( dojo.animateProperty( {
		node: conID,
		duration: duration,
		properties: {
			height: {
				start: con_height_start,
				end: con_height_end,
				unit: unit
			}
		} 
	} ).play() );
		
		
	dojo.fx.chain( animArr ).play();
}
	// Get Search-Request
function getSearchform()	{
	setBackgroundImage( 'div#map-content', 'body' );
	
	dojo.query( 'body' ).style( 'backgroundColor', '#91b5de' );
	dojo.query( 'body' ).style( 'backgroundRepeat', 'no-repeat' );
	
	dojo.query( '#container-home' ).style( 'display', 'none' );
	dojo.query( '#help-tooltip' ).style( 'display', 'none' );
	dojo.query( '#content' ).style( 'display', 'none' );

	var protocol 	= window.location.protocol;
	var host 		= window.location.host;
	var href 		= protocol + '//' + host + '/index.php?id=138';
	var targetNode 	= dojo.byId( 'map-loader' );
	
	var xhrArgs = {
		url: href,
		handleAs: "text",
		load: function( data )	{
			targetNode.innerHTML = data;
			dojo.query( '#map-loader .tx-quarterscamps-pi1' ).place( '#map-content' );
			dojo.query( '#map-loader' ).empty();
		},
		error: function( error )	{
			targetNode.innerHTML = 'An unexpected error occurred: ' + error;
		}
	};
	
	var deferred = dojo.xhrGet( xhrArgs );
	
	deferred.addCallback( function( data ) {
			// Camps positionieren
		resizeCampItems();
			// Image-Rotator implementieren
		dojo.query( 'div.map-con-camp-con-content-impression-images' ).forEach( function( item ) {
			var nodeid 	= dojo.query( item ).attr( 'id' );
			new dojox.widget.AutoRotator( {
					transition: "dojox.widget.rotator.fade",
					autoStart: false,
					pauseOnManualChange: true
				},
				dojo.byId( nodeid.toString() )
			);
		} );
			// Schift setzen
		Cufon.replace( 'div.map-con-camp-con > a' );
		Cufon.replace( 'div.map-con-camp-con-content-impression-headline' );
	} );
}
	// Get suitable camps
function getSearchformItems( value )	{
		
		// get classname from showing camps
	if( value == '' )	{ classname = 'map-con-camp'; }
	else				{ classname = 'map-con-quarter-' + value; }
	
		// hide all camps
	dojo.query( '.map-con > .map-con-camp' ).style( 'display', 'none' );
		
		// show selected camps
	dojo.query( '.map-con > .' + classname ).style( 'display', 'block' );
}
	/* **************************************************************************************************** */

	
	/* **************************************************************************************************** */
	/* Camp Handling */
	
var opened 		= false;
var opened_id 	= '';
var act_id 	= '';
var def_id 	= 'def-id';

dojo.addOnLoad( function()	{
		// Arial View
	dojo.query( 'div.camp-map-con-toggler' ).connect( 'onclick', function()	{
			// Wenn ein Layer geöffnet ist, soll dieser geschlossen werden
		if( opened )	{
			dojo.query( 'div#variant-' + opened_id + ' div.camp-map-con-variant-con-content' ).toggleClass( 'hide' );
			dojo.query( 'div#variant-' + opened_id + ' div.camp-map-con-variant-con-icon' ).style( 'zIndex', '1' );
			opened		= false;
			opened_id 	= '';
		}
		
		dojo.query( 'div.camp-map-con-toggler' ).toggleClass( 'disabled' );
		dojo.query( 'div.camp-map-con-variant' ).toggleClass( 'disabled' );
	} );
		// Arial View
	dojo.query( 'div.camp-map-con-variant-con-icon' ).connect( 'onclick', function()	{
		dojo.query( 'div.camp-map-con-variant-con-icon' ).style( 'zIndex', '1' );
		
		var curr_id = dojo.query( this ).attr( 'id' );

		if( ! opened )	{
				// Geöffneten Layer merken
			opened		= true;
			opened_id 	= curr_id;
		}
		else	{
				// Wenn ein anderer Layer geöffnet werden soll und bereits einer aktiv ist
			if( opened_id.toString() != curr_id.toString() )	{
				dojo.query( 'div#variant-' + opened_id + ' div.camp-map-con-variant-con-content' ).toggleClass( 'hide' );
				opened		= true;
				opened_id 	= curr_id;
			}
			else	{
				opened		= false;
				opened_id 	= '';
			}
		}
		
		if( opened )	{
			dojo.query( 'div#variant-' + curr_id + ' div.camp-map-con-variant-con-icon' ).style( 'zIndex', '999' );
		}
		
		

		dojo.query( 'div#variant-' + curr_id + ' div.camp-map-con-variant-con-content' ).toggleClass( 'hide' );
		
		var sI = parseInt( dojo.query( 'div.camp-map-con-variant-con-icon' ).style( 'width' ) );
		var sC = parseInt( dojo.query( 'div#variant-' + curr_id + ' div.camp-map-con-variant-con-content div.box' ).style( 'width' ) );
		var s  = ( sI / 2 ) + ( ( sC / 2 ) * -1 ) - 2;
		dojo.query( 'div#variant-' + curr_id + ' div.camp-map-con-variant-con-content' ).style( 'left', s + 'px' );
	} );
		// Type-Changing
	dojo.query( 'select#typ' ).connect( 'onchange', function()	{
		var attr_id = dojo.query( this ).attr( 'value' );
		if( attr_id != '' )	{
			if( act_id != '' )	{
					// Typ ausblenden
				dojo.query( 'div#' + act_id ).addClass( 'hide' );
			}
				
				// Typ einblenden
			act_id = attr_id.toString();
			dojo.query( 'div#' + act_id ).removeClass( 'hide' );
			
				// Default ausblenden
			dojo.query( 'div#' + def_id ).addClass( 'hide' );
		}
		else	{
				// Default einblenden
			dojo.query( 'div#' + def_id ).removeClass( 'hide' );
			dojo.query( 'div#' + act_id ).addClass( 'hide' );
		}
	} );
} );
	/* **************************************************************************************************** */

	
	/* **************************************************************************************************** */
	/* Powermail forms */

dojo.addOnLoad( function()	{
	initPowermailForms();
} );
	// Initialize powermail
function initPowermailForms()	{
	dojo.query( 'div.tx_powermail_pi1_fieldwrap_html_text input' ).connect( 'onfocus', function()	{
		handleLabelField( dojo.query( this ), true );
	} );
	dojo.query( 'div.tx_powermail_pi1_fieldwrap_html_text input' ).connect( 'onblur', function()	{
		handleLabelField( dojo.query( this ), false );
	} );
	dojo.query( 'div.tx_powermail_pi1_fieldwrap_html_textarea textarea' ).connect( 'onfocus', function()	{
		handleLabelField( dojo.query( this ), true );
	} );
	dojo.query( 'div.tx_powermail_pi1_fieldwrap_html_textarea textarea' ).connect( 'onblur', function()	{
		handleLabelField( dojo.query( this ), false );
	} );
}
	// Show/hide labels
function handleLabelField( domNoteField, hide )	{
	var fieldId 		= domNoteField.attr( 'id' );
	var fieldValue 		= domNoteField.attr( 'value' );
	
	var domNoteLabel 	= dojo.query( 'div#powermaildiv_' + fieldId + ' label' );
	
	if( ! hide )	{
			// show label, if no value were inserted
		if( fieldValue == '' )	{
			domNoteLabel.style( 'display', 'inline' );
		}
	}
	else	{
			// hide label
		domNoteLabel.style( 'display', 'none' );
	}
}
	/* **************************************************************************************************** */

	
	/* **************************************************************************************************** */
	/* Footer */
	
dojo.addOnLoad( function() {
	initFooter();
} );
	// Initialize footer
function initFooter()	{
	dojo.query( 'ul.first-nav > li' ).connect( 'onmouseenter', function()	{ toggleFooterNaviClass( dojo.query( this ).attr( 'class' ) ); });
	dojo.query( 'ul.first-nav > li' ).connect( 'onmouseleave', function()	{ toggleFooterNaviClass( dojo.query( this ).attr( 'class' ) ); });
}
	// Toggle footer navi
function toggleFooterNaviClass( classSrc )	{
	dojo.query( 'li.' + classSrc + ' ul' ).toggleClass( 'toogle' );
	dojo.query( 'li.' + classSrc + ' > a' ).toggleClass( 'toogle' );
}
	// Set width to footer navi
function setFooterNaviWidth()	{
	var w = 0;
	var u = 'px';
	dojo.forEach( dojo.query( 'div#naviservice > ul.first-nav > li' ), function( item, idx )	{
		w += parseInt( dojo.query( item ).style( 'width' ) );
	} );
	
	if( w > 0 )	{
		w += 10;
		dojo.query( 'div#naviservice > ul.first-nav' ).style( 'width', w + u );
	}
}
	/* **************************************************************************************************** */

	
	/* **************************************************************************************************** */
	/* Teaser */
var teaser_start 		= 135;
var teaser_end 			= 185;
var teaser_duration 	= 500;
var teaser_unit 		= 'px';
dojo.addOnLoad( function() {
	dojo.query( '.teaser-con-middle' ).connect( 'onmouseenter', function()	{
		animate_teaser( this, 'grow' );
	} );
	dojo.query( '.teaser-con-middle' ).connect( 'onmouseleave', function()	{
		animate_teaser( this, 'close' );
	} );
} );
function animate_teaser( node, mode ) 	{
	var id 				= dojo.query( node ).attr( 'id' );
	var start 			= 0;
	var end 			= 0;
	
	var desc_small_b 	= '';
	var desc_small_e 	= '';
	var desc_long_b 	= '';
	var desc_long_e 	= '';

	switch( mode )	{
		case 'grow':
			dojo.query( 'div#footer' ).style( 'zIndex', '1' );
			
			start 			= teaser_start;
			end 			= teaser_end;
			desc_small_b 	= 'inline';
			desc_small_e 	= 'none';
			desc_long_b 	= 'none';
			desc_long_e 	= 'inline';
			break;
		case 'close':
			dojo.query( 'div#footer' ).style( 'zIndex', '9' );
			
			start 			= teaser_end;
			end 			= teaser_start;
			desc_small_b 	= 'inline';
			desc_small_e 	= 'inline';
			desc_long_b 	= 'none';
			desc_long_e 	= 'none';
			break;
	}
	
	dojo.animateProperty( {
		node: node,
		duration: teaser_duration,
		properties: {
			height: {
				start: start,
				end: end,
				unit: teaser_unit
			}
		},
		onBegin: function()	{
			dojo.query( 'div#' + id + ' div.desc-small' ).style( 'display', desc_small_b );
			dojo.query( 'div#' + id + ' div.desc-long' ).style( 'display', desc_long_b );
		},
		onEnd: function() {
			dojo.query( 'div#' + id + ' div.desc-small' ).style( 'display', desc_small_e );
			dojo.query( 'div#' + id + ' div.desc-long' ).style( 'display', desc_long_e );
		}
	} ).play();
}
maxWidth = 341;
maxHeight = 185;
minWidth = 148;
minHeight = 135;
stdWidth = 197;
stdHeight = 135;

stdWidthImg = 191;
stdHeightImg = 72;
maxWidthImg = 125;
maxHeightImg = 116;
minWidthImg = 143;
minHeightImg = 72;

stdWidthP = 191;
stdHeightP = 30;
maxWidthP = 335;
maxHeightP = 148;
minWidthP = 143;
minHeightP = 30;

dojo.addOnLoad(function() {
	dojo.require("dojo.NodeList-traverse");
	
	dojo.query('.teaser-item-content').connect( 'onmouseenter', function()	{ 
		dojo.query('div#footer').style( 'zIndex', '1' );
		var id = dojo.query( this ).attr( 'data-teaser-id' );
		// growTeaser( id );
	});
	
	dojo.query('.teaser-item-content').connect( 'onmouseleave', function()	{ 
		// closeTeaser();
		dojo.query('div#footer').style( 'zIndex', '9' );
	});
	
});
	// Grow Teaser
function growTeaser( id )	{
	
	// grow TEASER
	dojo.query('div#'+id+' .teaserimg-1').style('display','block');
	dojo.query('div#'+id+' .teaserimg-2').style('visibility','hidden');
	
	dojo.query('div#'+id+' .teasertxt').style('display','none');
	dojo.query('div#'+id+' .teasertxtlong').style('display','inline');

	teaserContent = dojo.query('div#'+id+' .teaser_content');
	
	curHeight = teaserContent.style('height');
	curWidth = teaserContent.style('width');
	
	teaserContent.forEach(function(item){
		
		currentslideTeaser = dojo.animateProperty({
							node: item,
							duration: 500,
							properties: {
								width: {
									start: curWidth,
									end: maxWidth
								},
								height: {
									start: curHeight,
									end: maxHeight
								}
							}
						}).play();
	});
	
	// GROW IMAGE
	
	teaserContentImg = dojo.query('div#'+id+' .teaser_content .teaserimg');
	
	curHeight = teaserContentImg.style('height');
	curWidth = teaserContentImg.style('width');
	
	teaserContentImg.forEach(function(item){
		
		currentslideTeaser = dojo.animateProperty({
							node: item,
							duration: 500,
							properties: {
								width: {
									start: curWidth,
									end: maxWidthImg
								},
								height: {
									start: curHeight,
									end: maxHeightImg
								}
							}
						}).play();
	});
	
	// GROW TEXT
	
	teaserContentP = dojo.query('div#'+id+' .teaser_content .teasertext');
	
	curHeight = teaserContentP.style('height');
	curWidth = teaserContentP.style('width');
	
	teaserContentP.forEach(function(item){
		
		currentslideTeaser = dojo.animateProperty({
							node: item,
							duration: 500,
							properties: {
								width: {
									start: curWidth,
									end: maxWidthP
								},
								height: {
									start: curHeight,
									end: maxHeightP
								}
							}
						}).play();
	});
	
	dojo.query('.teaser-item-content').forEach(function(node){
			
		var curId = dojo.query(node).attr('data-teaser-id');
		
		if (escape(curId) != escape(id)) {
			
			// CLOSE OTHER TEASER
			dojo.query('div#'+curId+' .teaserimg-2').style('visibility','visible');
			dojo.query('div#'+curId+' .teaserimg-1').style('display','none');
			
			dojo.query('div#'+curId+' .teasertxt').style('display','none');
			dojo.query('div#'+curId+' .teasertxtultrashort').style('display','inline');
			
			teaserContentnone = dojo.query('div#' + curId + ' .teaser_content');
			curHeight = teaserContentnone.style('height');
			curWidth = teaserContentnone.style('width');
				
			teaserContentnone.forEach(function(item){
		
				currentslideTeaser = dojo.animateProperty({
									node: item,
									duration: 500,
									properties: {
										width: {
											start: curWidth,
											end: minWidth
										},
										height: {
											start: curHeight,
											end: minHeight
										}
									}
								}).play();
			});
			
			// CLOSE OTHER TEASER IMAGES
			
			teaserContentnoneImg = dojo.query('div#' + curId + ' .teaser_content .teaserimg');
			curHeight = teaserContentnoneImg.style('height');
			curWidth = teaserContentnoneImg.style('width');
				
			teaserContentnoneImg.forEach(function(item){
		
				currentslideTeaser = dojo.animateProperty({
									node: item,
									duration: 500,
									properties: {
										width: {
											start: curWidth,
											end: minWidthImg
										},
										height: {
											start: curHeight,
											end: minHeightImg
										}
									}
								}).play();
			});
			
			// CLOSE OTHER TEXT
			
			teaserContentnoneP = dojo.query('div#' + curId + ' .teaser_content .teasertext');
			curHeight = teaserContentnoneP.style('height');
			curWidth = teaserContentnoneP.style('width');
				
			teaserContentnoneP.forEach(function(item){
		
				currentslideTeaser = dojo.animateProperty({
									node: item,
									duration: 500,
									properties: {
										width: {
											start: curWidth,
											end: minWidthP
										},
										height: {
											start: curHeight,
											end: minHeightP
										}
									}
								}).play();
			});
		}
	});
}
	// Close Teaser
function closeTeaser(){
	
	dojo.query('.teaser_content').forEach(function(node){
			
		curId = dojo.query(node).parent().parent().parent().attr('id');
		
		// CLOSE ALL TEASER
		
		dojo.query('div#'+curId+' .teaserimg-1').style('display','none');
		dojo.query('div#'+curId+' .teaserimg-2').style('visibility','visible');
		dojo.query('div#'+curId+' .teasertxt').style('display','none');
		dojo.query('div#'+curId+' .teasertxtshort').style('display','inline');
		
		teaserContentnone = dojo.query('div#' + curId + ' .teaser_content');
		curHeight = teaserContentnone.style('height');
		curWidth = teaserContentnone.style('width');
			
		teaserContentnone.forEach(function(item){
	
			currentslideTeaser = dojo.animateProperty({
								node: item,
								duration: 500,
								properties: {
									width: {
										start: curWidth,
										end: stdWidth
									},
									height: {
										start: curHeight,
										end: stdHeight
									}
								}
							}).play();
		});
		
		// RESET ALL TEASER IMAGES
		
		teaserContentnoneImg = dojo.query('div#' + curId + ' .teaser_content .teaserimg');
		curHeight = teaserContentnoneImg.style('height');
		curWidth = teaserContentnoneImg.style('width');
			
		teaserContentnoneImg.forEach(function(item){
	
			currentslideTeaser = dojo.animateProperty({
								node: item,
								duration: 500,
								properties: {
									width: {
										start: curWidth,
										end: stdWidthImg
									},
									height: {
										start: curHeight,
										end: stdHeightImg
									}
								}
							}).play();
		});
		
		// RESET ALL TEASER TEXTS
		
		teaserContentnoneP = dojo.query('div#' + curId + ' .teaser_content .teasertext');
		curHeight = teaserContentnoneP.style('height');
		curWidth = teaserContentnoneP.style('width');
			
		teaserContentnoneP.forEach(function(item){
	
			currentslideTeaser = dojo.animateProperty({
								node: item,
								duration: 500,
								properties: {
									width: {
										start: curWidth,
										end: stdWidthP
									},
									height: {
										start: curHeight,
										end: stdHeightP
									}
								},
								onEnd: function()	{
								
								}
							}).play();
		});
		
	});
}
	/* **************************************************************************************************** */
	
	
	/* **************************************************************************************************** */
	/* Miscellaneous */
dojo.addOnLoad( function() {
	addImageRotator();
	addSearchFieldValue();
} );
	// Add Image-Rotator to Content-Element
function addImageRotator()	{
	dojo.require( "dojox.widget.AutoRotator" );
	dojo.require( "dojox.widget.rotator.Fade" );
	
	if( dojo.query( 'div.csc-textpic-border ul' ).length > 0 )	{
		var i = 0;
		
		dojo.query( 'div.csc-textpic-border ul' ).forEach( function( item )	{
			var imgslideID 	= 'textpic-slider-' + i;
			var imgSlider 	= '<div class="imgNav"><div onclick="dojo.publish(\'' + imgslideID + '/rotator/control\', [\'prev\']);" class="prev"></div><div onclick="dojo.publish(\'' + imgslideID + '/rotator/control\', [\'next\']);" class="next"></div></div>';
			dojo.query( item ).attr('id', imgslideID );
			// dojo.query('div.csc-textpic-border').addContent( imgSlider, 'bottom' );
			dojo.query('div.csc-textpic-border div.csc-textpic-imagecolumn').addContent( imgSlider, 'bottom' );
			
			
			new dojox.widget.AutoRotator( {
				transition: "dojox.widget.rotator.fade",
				autoStart: false,
				pauseOnManualChange: true,
			}, dojo.byId( imgslideID ) );
			
			i++;
		} );
	}
}
	// Add Value to Search-Field
function addSearchFieldValue()	{
	if( dojo.query( 'div.search input.tx-solr-q' ).length > 0 )	{
		handleSearchFieldValue();
		
		dojo.query( 'div.search input.tx-solr-q' ).connect( 'onclick', function()	{ handleSearchFieldValue(); } );
		dojo.query( 'div.search input.tx-solr-q' ).connect( 'onblur', function()	{ handleSearchFieldValue(); } );
	}
}
	// Handle Value in Search-Field
function handleSearchFieldValue()	{
	var v 		= '';
	var sf_v 	= dojo.query( 'div.search input.tx-solr-q' ).attr( 'value' );
	var sv_v 	= dojo.query( 'div.search input.tx-solr-q-value' ).attr( 'value' );
	
	sf_v = sf_v.toString();
	sv_v = sv_v.toString();
	
	if( sf_v == '' )	{
		v = sv_v;
	}
	else if( sf_v != sv_v )	{
		v = sf_v;
	}
	
	
	dojo.query( 'div.search input.tx-solr-q' ).attr( 'value', v );
}
	// Maximal Words
function stripWords( queryItem, chars_max )	{
	dojo.forEach( dojo.query( queryItem ), function( item, idx )	{
		var chars_node = item.innerHTML.length;
		if( chars_node > chars_max )	{
			var parent_class 	= dojo.query( item ).parent( 'div' ).attr( 'class' );
			var parent_href		= dojo.query( item ).parent( 'div' ).children( 'h2' ).children( 'a' ).attr( 'href' );
			
			item.innerHTML = item.innerHTML.substring( 0, chars_max ) + '...<span class="more"><a href="' + parent_href + '"></a></span>';
		}
	} );
}
	// Add jQuery-Scroller
$( window ).load( function() 	{
	mCustomScrollbars();
} );
function mCustomScrollbars(){
	$('#mcs_container').mCustomScrollbar( 'vertical', 300, 'easeOutCirc', 1.05, 'auto', 'yes', 'yes', 15 ); 
}
$.fx.prototype.cur = function() 	{
	if( this.elem[ this.prop ] != null && ( ! this.elem.style || this.elem.style[ this.prop ] == null ) ) 	{
		return this.elem[ this.prop ];
	}
	var r = parseFloat( jQuery.css( this.elem, this.prop ) );
	return typeof r == 'undefined' ? 0 : r;
}
	/* **************************************************************************************************** */

