$(document).ready(function() {
				// set the default options for all scrollpanes on this page
				$.extend($.fn.jScrollPane.defaults, {showArrows:true});

				// Lightbox
				$('.lightBox_close').click(function() {
					$('.transWhite').fadeOut(500);
				});

//				$('.lightBox_close2').click(function() {
//					$('.transWhite2').fadeOut(500);
//				});

				$('#interview').click(function() {
					$('.transWhiteVideo').fadeIn(700);
					$('#scroll-pane-xy').jScrollPane();
				});

				$('.lightBox_close4').click(function() {
					$('.transWhiteVideo').fadeOut(500);
				});


				$('.youtubevideo1').click(function(el) {
					$('.transWhiteVideoYT1').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo2').click(function(el) {
					$('.transWhiteVideoYT2').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo3').click(function(el) {
					$('.transWhiteVideoYT3').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo4').click(function(el) {
					$('.transWhiteVideoYT4').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo5').click(function(el) {
					$('.transWhiteVideoYT5').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo6').click(function(el) {
					$('.transWhiteVideoYT6').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo7').click(function(el) {
					$('.transWhiteVideoYT7').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo8').click(function(el) {
					$('.transWhiteVideoYT8').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo9').click(function(el) {
					$('.transWhiteVideoYT9').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
                $('.youtubevideo10').click(function(el) {
					$('.transWhiteVideoYT10').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});
				$('.youtubevideo11').click(function(el) {
					$('.transWhiteVideoYT11').fadeIn(500);
					$('.transWhiteVideo').fadeOut(10);
				});

try {
                // Close video overlay
				$('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT1').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT2').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT3').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});


                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT4').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT5').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT6').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT7').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});

                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT8').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});
                
                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT9').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});
                
                $('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT10').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});
				$('.lightBox_close5').click(function() {
                    stopPlay();
					$('.transWhiteVideoYT11').fadeOut(500);
					$('.transWhiteVideo').fadeIn(10);
				});
                // EOF Close video overlay



} catch(e) {}


				$('#upToDate').click(function() {
					var uri;
					if(prefixUrl != undefined) {
						uri = prefixUrl + "/index/newsletter-form-ajax";
					}

					$('.transWhite2').fadeIn(700);
					var query = '';
					$.ajax({
				        type: 'POST',
				        data: query,
				        url: uri,
				        success: function(data)
				        {
				    		if( typeof data != 'string') {
//					    		try {
//					    			javascript:dcsMultiTrack('WT.ti', 'Thank You GS: search results', 'DCS.dcsuri', '/search_results', 'WT.oss', ''+query+'', 'WT.oss_r', ''+data[2]+'');
//					    		}
//					    		catch (e) {
//									// TODO: handle exception
//								}
					    		$('.transWhite2').html(data[1]);
				    		} else {
				    			$('.transWhite2').html(data);
				    		}
				        }
				    });

					//$('.transWhite2').html('hallo');

				});

    $('#nav li').hover(
        function () {
            //show its submenu
			var newHeight = $('ul', this).height() + 12;
			$('ul', this).css('marginTop', -newHeight);
            $('ul', this).fadeIn(300);

        },
        function () {
            //hide its submenu
            $('ul', this).fadeOut(300);
        }
    );





});
/*
var player;
function onYouTubePlayerReady(playerId) {
    // No need to do any of this stuff if the function was called
    // because the user customized the player parameters for the embedded
    // player.

    if (playerId && playerId != 'undefined') {
      player = document.getElementById(playerId);

        player.playVideo();
      // This ensures that there's a video cued if using chromeless player
    }
}
*/
function stopPlay(){
    //alert(location.href);
    var prm = '?nlfb=y';
    var T = location.href;
    
    if(T.indexOf(prm) != -1) {
        window.location.href = T;
    } else {
        if(T.indexOf('?') != -1) {
	        T = T.replace(/\?{2,}/, "?").replace(/\?/, prm + "&");
        } else T += prm;
        window.location.href = T;
    }
}

function switchContent(container) {
		//var scrollPane = container + '-scroll-pane';
		$('.contentSwitch').fadeOut(500, function() {
			$('#contentSwitchTitle').empty().append($(container + '_title').html());
			$('#contentSwitchText').empty().append($(container + '_content').html());
			$('.contentSwitch').fadeIn(5, function() {

				$('.close').bind('click', function() { $('.contentSwitch').fadeOut(); });
				$('#scroll-pane').jScrollPane();
			});
		});
}

function switchContent2(container) {
    //var scrollPane = container + '-scroll-pane';
	$('.contentSwitch2').fadeOut(500, function() {
	$('#contentSwitchTitle2').empty().append($(container + '_title2').html());
	$('#contentSwitchText2').empty().append($(container + '_content2').html());
	$('.contentSwitch2').fadeIn(5, function() {
	$('.close').bind('click', function() { $('.contentSwitch2').fadeOut(); });
	$('#scroll-pane-2').jScrollPane();
	});
	});
}

function switchContent3(container) {
	//alert("was called");
    //var scrollPane = container + '-scroll-pane';
	$('.contentSwitch3').fadeOut(500, function() {
	
	if($('#contentSwitchText4').html() != '') $('#contentSwitchText4').empty();
	
	$('#contentSwitchTitle3').empty().append($(container + '_title3').html());
	$('#contentSwitchText3').empty().append($(container + '_content3').html());
	$('.contentSwitch3').fadeIn(5, function() {
	$('.close').bind('click', function() { $('.contentSwitch3').fadeOut(); });
	$('#scroll-pane-3').jScrollPane();
	});
	});
}

function switchContent4(container) {
    //var scrollPane = container + '-scroll-pane';
    $('.contentSwitch4').fadeOut(500, function() {
        $('#contentSwitchTitle4').empty().append($(container + '_title4').html());
        $('#contentSwitchText4').empty().append($(container + '_content4').html());
        $('.contentSwitch4').fadeIn(5, function() {
            $('.close').bind('click', function() { $('.contentSwitch4').fadeOut(); });
        });
    });
}


function openIntro() {
    //var scrollPane = container + '-scroll-pane';
	$('.contentSwitch5').fadeOut(500, function() {
	$('#contentSwitchText5').empty().append($('#introFilm').html());
	});
	
	/*etTimeout(function() {
			   tmPlayIntro(lang);
						}, 4000);
	*/
	$('.contentSwitch5').fadeIn(5);

}

function changeString(param) {
		if(param == 'vulkan')
		{
			$('#vulkan').addClass('movieArrow');
			$('#sterne').removeClass('movieArrow');
		} else {
			$('#sterne').addClass('movieArrow');
			$('#vulkan').removeClass('movieArrow');
		}
}

function closeintro() {
	if($('#contentSwitchText5').html() != '') $('#contentSwitchText5').empty();
}


function submitNewsletterForm(el) {
	var form = $(el).parents('form');
	var query = form.serialize();
	var uri;
	if(prefixUrl != undefined) {
		uri = prefixUrl + "/index/newsletter-form-ajax";
	}
	form.submit(function(e){
		//alert("hallo");
		e.preventDefault();
		e.stopPropagation();
		$('#preloader').html(getPreloadImage());
		$.ajax({
	        type: 'POST',
	        data: query,
	        url: uri,
	        success: function(data)
	        {
	    		if( typeof data != 'string') {
//		    		try {
//		    			javascript:dcsMultiTrack('WT.ti', 'Thank You GS: search results', 'DCS.dcsuri', '/search_results', 'WT.oss', ''+query+'', 'WT.oss_r', ''+data[2]+'');
//		    		}
//		    		catch (e) {
//						// TODO: handle exception
//					}
		    		$('.transWhite2').html(data[1]);
	    		} else {
	    			$('.transWhite2').html(data);
	    		}
	    		$('#preloader').html();
	        }
	    });
	});
}

/**
 *
 * @return string
 */
function getPreloadImage() {
	return '<img  src=\"/img/loading.gif\" />';
}


function changeImageOnHover(el, event, onOverDir)
{
    var e = event || window.event;
    if (e.type == 'mouseout')
    {
        el.src = el.getAttribute('src').replace(onOverDir + '/', '');
    } else if (e.type == 'mouseover')
    {
        var p = el.getAttribute('src').split('/');
        var f = '/' + p.pop();
        p.push(onOverDir);
        el.src = p.join('/') + f;
    }
}


