Cufon.set('fontFamily', "Ocean_Sans_MT_Pro_Book");

Cufon.replace('h2 span.cufonCont', {
	fontSize: '26px'
});

Cufon.replace('.graphicHeader h2 span.cufonCont', {
	fontSize: '24px'
});    

Cufon.replace('.graphicHeader h3 span.cufonCont', {
	fontSize: '16px'
});        

Cufon.replace('.yellowHeader h2 span.cufonCont', {
	fontSize: '14px'
});        

Cufon.replace('#NewsletterSubscription h2 span.cufonCont', {
	fontSize: '16px'
});    

Cufon.replace('.toggleContainer h2 span.cufonCont', {
	fontSize: '26px'
}); 


Cufon.replace('#QuickLinks span.cufonCont', {
	fontSize: '14px'
});
		
Cufon.replace('.alternativeTabs	a span.cufonCont', {
	fontSize: '23px'
});
		
Cufon.replace('.alternativeTabs	span.cufonCont', {
	fontSize: '23px'
});

Cufon.replace('#empfehlung h2 span.cufonCont', {
	fontSize: '16px'
}); 
Cufon.replace('.eintagsfliegen h1', {
	fontSize: '26px'
}); 
Cufon.replace('.eintagsfliegen h2', {
	fontSize: '20px'
}); 
Cufon.replace('.eintagsfliegen ul.checklist li', {
	fontSize: '12px'
});
Cufon.replace('.counter-box ul li p', {
	fontSize: '55px'
}); 
Cufon.replace('.footer-bar .first h3, .footer-bar .second h3, .footer-bar .third h3', {
	fontSize: '14px'
}); 
Cufon.replace('.column h3', {
	fontSize: '25px'
});
Cufon.replace('.column p', {
	fontSize: '14px'
});

// JavaScript Document

var debug = true;

//Init FirebugConsole
if(window.loadFirebugConsole) {
    window.loadFirebugConsole();
}

//DEBUG-function
function DEBUG(string) {
    if(window.loadFirebugConsole && debug) {
        console.log(string);
    }
}

var resetText = {
	init: function () {
		$('.defaultValue').addClass('default');
		$('.defaultValue').bind("focus", function(e){
				if( this.value == this.defaultValue ) {
					this.value = "";
					$(this).addClass('filled');
				}
		});
		$('.defaultValue').bind("blur", function(e){
				if( this.value == "" ) {
					this.value = this.defaultValue;
					$(this).removeClass('filled');
				}
		});
	}
}

$( resetText.init );

var mainNav = {

	init: function () {
	
		if( $.browser.msie && $.browser.version < 7 ){
			
			$('#MainNav').data( 'pasBgPos', parseInt($('#MainNavi ul > li.active').attr('currentStyle').backgroundPositionY) );
			$('#MainNav').data( 'actBgPos', $('#MainNav').data( 'pasBgPos') - 87 );
			
			$('#MainNavi ul > li.active').css( 'background-position' , '0 ' +  $('#MainNav').data( 'actBgPos') + 'px' );
			$('#MainNavi ul > li').not('.active').not('li li').hover( 
				function(){
					$(this).addClass('hover');
					$('#MainNavi ul > li.active').css( 'background-position' , '0 ' +  $('#MainNav').data( 'pasBgPos') + 'px' );
					
				},
				function(){
						$(this).removeClass('hover');
					$('#MainNavi ul > li.active').css( 'background-position' , '0 ' +  $('#MainNav').data( 'actBgPos') + 'px' );
					
				}
			);
		} else {
			$('#MainNavi ul > li').hover( 
				function(){
					$(this).parent().find('li.active').addClass('deactivated').removeClass('active');
				},
				function(){
					$(this).parent().find('li.deactivated').addClass('active').removeClass('deactivated');
				}
			);				
		}
	}
}

//$( mainNav.init );


var allClick = {
	
	init: function () {
		$('.allclick, .photoHeader, .pngMask').each(function(i) {
			var $this = $(this);
                        if( $this.find('a[href]').size() == 1 ) {
                                $this.data( 'goto', $this.find('a').first() );
                                $this.css( 'cursor', 'pointer');
                                $this.bind('click', function() {
                                        target = $this.data('goto').attr('target');
                                        if(target === '_blank') {
                                            open($this.data('goto').attr('href'));
                                        }
                                        else {
                                            location.href = $this.data('goto').attr('href');
                                        }
                                        return false;
                                });
                        }
		});	
	}	
}

$( allClick.init );

var siteMap = {
	init: function () {
		var maxHeight = 0;
		var itemsLength = $('#Sitemap > div > ul > li').length-1;
		$('#Sitemap > div > ul > li').each(function(i) {
			if( i%4 == 0 ) {																					
				maxHeight = 0;
			}
			if( $(this).height() > maxHeight ) {
				maxHeight = $(this).height();	
			}																									
			if( i%4 == 3 ) {
				for ( k = i-3; k <= i; k++ ) {;
					$(this).parents('#Sitemap').find('div > ul > li').eq(k).height( maxHeight );	
				}
			}
			if( i == itemsLength ) {
				for ( k = i - itemsLength%4; k <= i; k++ ) {;
					$(this).parents('#Sitemap').find('div > ul > li').eq(k).height( maxHeight );	
				}
				$(this).css( 'border-right', '0' );
			}
		
		});																			
	}
}

var tripleList = {
	init: function () {
		$('.tripleList').each(function(j) {
			var maxHeight = 0;
			var imgHeight = 0;
			var tlItems = $(this).find('.tripleListItem');
			$(this).find('img').each(function(i) {

					if( $(this).height() > imgHeight ) {
						imgHeight = $(this).height();	
					}
					if( ( i == tlItems.length-1 ) || ( i%3 == 2 ) ) {
						for ( k = i- i%3; k <= i; k++ ) {							
							$(this).parents('.tripleList').eq(0).find('.graphicFooter').eq(k).height( imgHeight +5 );
							$(this).parents('.tripleList').eq(0).find('.tripleListItem').eq(k).css( "padding-bottom", imgHeight +5 );
						}
						imgHeight = 0;
					}			
			});			
			
			tlItems.each(function(i) {

					if( $(this).height() > maxHeight ) {
						maxHeight = $(this).height();	
					}
					
					if( ( i == tlItems.length-1 ) || ( i%3 == 2 ) ) {
						for ( k = i - i%3; k <= i; k++ ) {
							$(this).parent().find('.tripleListItem').eq(k).height( maxHeight );
						}
						maxHeight = 0;
					}					
			});
		});
	}
}

//$( tripleList.init );

var quadroTeaser = {
	init: function () {
		$('.quadroTeaser').each(function(j) {
			var maxHeight = 0;
			var maxHlHeight = 0;
			var qItems = 	$(this).find('.quadroItem');		
			qItems.each(function(i) {
					var myHl = $(this).find('h3');
					if( myHl.height() > maxHlHeight ) {	
						maxHlHeight = myHl.height();	
					}
					if( ( i == qItems.length-1 ) || ( i%4 == 3 ) ) {
						for ( k = i - ( i%4 ); k <= i; k++ ) {
							$(this).parent().find('.quadroItem h3').eq(k).height( maxHlHeight ); 
						}
						maxHlHeight = 0;
					}
			});
			
			qItems.each(function(i) {					
					if( $(this).height() > maxHeight ) {
						maxHeight = $(this).height();	
					}
					if( ( i == qItems.length-1 ) || ( i%4 == 3 ) ) {
						for ( k = i - ( i%4 ); k <= i; k++ ) {
							$(this).parent().find('.quadroItem').eq(k).height( maxHeight );
						}
						$(this).css( 'border-right', '0' );
						maxHeight = 0;
					}
			});
		});
	}
}

//$( quadroTeaser.init );

var toggleContent = {
	init: function () {
		$('.toggleContainer h2').each(function(i) {
			if( $.browser.msie && $.browser.version < 7 ) {
				$(this).hover( 
					function(){
						$(this).addClass('hover');	
					},
					function(){							
						$(this).removeClass('hover');			
					}
				);					
			}																					 
			if( i ) {																	 
				$(this).addClass('closed');	
				$(this).parent().addClass('closed');	

			} else {
				$(this).next().css( 'display', 'block' )
				
			}
			if( $('.toggleContainer').length > 1 ) {
				$(this).parents('.toggleContainer').eq(0).addClass('activeToggle');
				$(this).bind("click", function(e){
					if( $(this).hasClass('closed') ){														 
						$(this).next().slideDown('normal', function() {
							$('html,body').animate({scrollTop: $(this).prev().offset().top }, 500); 																					
							$(this).prev().removeClass('closed');
							$(this).parent().removeClass('closed');
							
						});
					} else {
						$(this).next().slideUp('normal', function() {
							$('html,body').animate({scrollTop: $(this).prev().offset().top }, 500);																				
							$(this).prev().addClass('closed');
							$(this).parent().addClass('closed');
							
						});
					}																			 
				});	
			} else if ( $('.toggleContainer').length == 1 )  {
                            $(this).parents('.toggleContainer').eq(0).addClass('disabledToggle');
                        }
		});
	}
}

$( toggleContent.init );

var altTabs = {
	
	init: function () {
		$('.jsTabControl').each(function() {
			$(this).find('A').live("click", function(e){
					var myList = $(this).parents('UL').eq(0);	
					var visIdx = myList.find('LI').index( $(this).parent() );
					myList.find('H2 > SPAN').unwrap().wrap('<a href="#" onclick="return false" />')
					$(this).parent().find('A > SPAN').unwrap().wrap('<h2 />')
					myList.parent().next('.alternativeContent').children().hide();
					myList.parent().next('.alternativeContent').children().eq( visIdx ).show();
			});															 
		});
	}
	
}

$( altTabs.init );

var selectBar = {
	
	init: function () {
		$('.selectBar .flyout').each(function(j) {
			$(this).find('ul').show();
			$(this).find('h3').width( $(this).find('ul').width() );
			$(this).find('ul').hide();
			$(this).find('h3').html( $(this).find('li.selected').text() ).bind('click', function(event) {
				$(this).next().toggle();
				event.stopPropagation();
			});
			
//			$(this).find('li:odd').css( 'background-color', '#f3f7fc' );
			$(this).find('li').width( $(this).find('h3').attr('offsetWidth')-2 ).bind('click', function(event) {
				$(this).siblings().removeClass('selected');																																												
				$(this).parents('.flyout').find('h3').html( $(this).text() );
				$(this).addClass('selected');	
			});
			$(document).bind('click', function() {
				$('.flyout ul').hide();										 
			});

		});	
									
	}

	
}

$( selectBar.init );

var anchorSections = {
	init: function () {
		$( '.anchorSection ul' ).each(function() {																	 
			if( ( $(this).next().text() == "  " ) && ( $(this).next().find('.anchorSpace').length )  ) {
				$(this).find( 'li:last' ).append( $(this).next().find('.anchorSpace').detach() );
				$(this).next().remove();
			}																		 
		});
	}
}

//--------------------------------------------------------------------------------
// Funktionen für den Tippticker auf der Startseite
//--------------------------------------------------------------------------------

function lade(nummer) {
    if (nummer != satzsammlungs_array.length-1) {
        nummer_follow = nummer+1;
    }
    else {
        nummer_follow = 0;
    }
    document.getElementById('TipSatz').innerHTML = "<strong>" + satzsammlungs_array[nummer][0] + "</strong>"
    document.getElementById('TipUrl').innerHTML = "<strong><a href=" + satzsammlungs_array[nummer][1] + ">" + satzsammlungs_array[nummer][2] + "</a></strong>"
    if (anzahl_seiten != 0) {
        document.getElementById('TipNext').innerHTML = "<strong><a href=\"javascript:lade(" + nummer_follow + ");\">" + document.getElementById('TipNextText').innerHTML + "</a><strong>"

    }
    aktuelle_seite = nummer;
}

var anzahl_seiten = false;

function laderandom() {
    if (anzahl_seiten) {
        var rand_num = Math.round(anzahl_seiten*(Math.random()));
        lade(rand_num);
    }
}


//--------------------------------------------------------------------------------
// Öffnet ein Popup und plaziert dieses in der Bildschirmmitte
//--------------------------------------------------------------------------------

function openCondorPopup(url, w, h, scroll ){
        var scrollbars = 'yes';
        if( $.browser.msie && $.browser.version < 8 ){
            scrollbars = 'no';
        }

	if( scroll ) {
                w = w + 16;
		var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no';
	} else {
                var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=' + scrollbars + ',resizable=no,location=no,menubar=no,toolbar=no';
        }

        var windowName = 'Condor';
        if (window.opener) {
            if (!window.opener.closed) {
                windowName += '_new';
            }
        }
	
	if (self.window.name != "popupOK" ) {
		self.window.name == "popupOK"
		condorWin = window.open(url,windowName,parameter);
		window.condorWin.focus();
	} else {
		if (window.condorWin.closed == true) {
			condorWin = window.open(url,windowName,parameter);
			window.condorWin.focus();
		}	else {
			window.condorWin.location.href=url;
			window.condorWin.resizeTo(w,h);
			window.condorWin.focus();
		}
	}
	return false;
}

/*
function openTCPopupNoScroll(url, w, h){

var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';


if (self.window.name != "popupO" ) {
	self.window.name == "popupO"
	thomascookwin = window.open(url,'thomas_cook',parameter);
	window.thomascookwin.focus();
	}
else {
	if (window.thomascookwin.closed == true) {
		thomascookwin = window.open(url,'thomas_cook',parameter);
		window.thomascookwin.focus();
		}
	else {
		window.thomascookwin.location.href=url;
		window.thomascookwin.resizeTo(w,h);
		window.thomascookwin.focus();
		}
	}
}

*/

function surfto(form) {
    var myindex=form.selectCountry.selectedIndex;
    var url = form.selectCountry.options[myindex].value;
    if (url != '0') {
        location = url;
    }
}

var uploadCount = 2;
function addUploadField ( obj, maxIndex ) {


      $("#ContactFormUploadInput"+uploadCount).attr('style', 'display:block;  margin-top:5px;');

    uploadCount++;

       return false;
}

function goto(form) {
    var myindex=form.topics.selectedIndex;
    var url = form.topics.options[myindex].value;
    if (url != "0") {
        if (url.search(/raining/) != -1) {
            if (url.search(/training-services/) != 1) {
                 window.open(url,"jointtraining","location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
            }
            else {
                location = url;
            }
        }
        else {
            location = url;
        }
    }
}

function surftoOpener(url) {
    window.blur();
    window.opener.location.href = url;
}


//--------------------------------------------------------------------------------
// Öffnet Popup für MarcoPolo-Daten
//--------------------------------------------------------------------------------

function openInfoPopup(inUrl) {
    window.open(inUrl ,"_new", "width=780,height=700,left=0,top=50,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no");
}

//--------------------------------------------------------------------------------
// Öffnet Popup für Länderfliegen-Flash
//--------------------------------------------------------------------------------

function openTeilnahme() {
    window.open('teilnahmebedingungen_laenderfliegen.html',"_laenderfliegen", "width=810,height=600,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no");
}

//--------------------------------------------------------------------------------
// Öffnet den Content Layer mit der aktuellen ID und schließt den zuletzt geöffneten (contentLayerLast)
//--------------------------------------------------------------------------------

var contentLayerLast = null;

function openContentLayer(id) {
    var contentLayer = document.getElementById('contentLayer_' + id);

    if (contentLayer) {
        if (contentLayerLast != null) {
            contentLayerLast.className = 'contentLayer';
        }
        contentLayer.className = 'contentLayerAct';
        contentLayerLast = contentLayer;
    }
}

$(document).ready(function(){
   $('#condor-counter-table').find('tbody tr').each(function(){
       var $this = $(this),
           $index = $this.index();
       if($(this).attr('class') != 'line' && $(this).attr('class') != 'subheadline'){
           if($index % 2 == 0){
               $this.addClass('alternate');
           }else{
               $this.addClass('even');
           }
           
       }
   });
});

//--------------------------------------------------------------------------------
// Schreibt die nötigen Parameter in die clickout.jsp-URL damit im Footer das NL-Formular getrackt werden kann
//--------------------------------------------------------------------------------

function submitNewsletterForm(inForm){
       inForm.ns_url.value = "/de/info-service/newsletter.jsp§nlemail=" + inForm.nlemail.value;
    }

