absPath = '/';
setTimeout (hideIntro, 10000);

$(document).ready(function(){		
	teaserLeftPosition();
	
	$(window).resize(function() {
		teaserLeftPosition();
	});
	
	$('#imageAnimation').hide().fadeIn('slow');
	
	$('.tableListDescriptionLink').click(function(){
		elem = $(this).attr('id');
		if ($('#' + elem).hasClass('visible')) {
			$('#' + elem).removeClass('visible');
			id = elem.replace('tableListDescriptionLink', 'desc');
			$('#' + id).fadeOut();			
			if ($('#' + elem).hasClass('de'))
				$('#'+ elem +' span').html('einblenden');			
			if ($('#' + elem).hasClass('zh'))
				$('#'+ elem +' span').html('显示');			
		}
		else {
			$('#' + elem).addClass('visible');
			id = elem.replace('tableListDescriptionLink', 'desc');
			$('#' + id).fadeIn();
			if ($('#' + elem).hasClass('de'))
				$('#'+ elem +' span').html('ausblenden');
			if ($('#' + elem).hasClass('zh'))
				$('#'+ elem +' span').html('隐藏');			
		}
	});	
	
    // Lightbox
    $(".lb").lightBox({
    	overlayBgColor: '#cdd4d8',
    	imageBtnClose: absPath + 'images/lightbox-btn-close.gif',
		imageBlank: absPath + 'images/lightbox-blank.gif',
		imageLoading: absPath + 'images/lightbox-ico-loading.gif',
		imageBtnPrev: absPath + 'images/lightbox-btn-prev.gif',
		imageBtnNext: absPath + 'images/lightbox-btn-next.gif'
    });    
    
    // Intro
    $('#introClose').click(function(){
    	hideIntro();
    });
    
    $('#introContent').fadeIn(500);
    $('#introAdler').fadeIn(700);
    
    // Forms
    $('input[type=text], textarea').focus(function(){
    	$(this).attr('class', 'contact_o');
    });
    
    $('input[type=text], textarea').blur(function(){
    	$(this).attr('class', 'contact');
    });

    $('input[type=password], textarea').focus(function(){
    	$(this).attr('class', 'contact_o');
    });
    
    $('input[type=password], textarea').blur(function(){
    	$(this).attr('class', 'contact');
    });
});

function hideIntro()
{
	$('#introContent').fadeOut(100);
	$('#intro').fadeOut(500);	
}

function teaserLeftPosition()
{
	width = $(document).width();
	
	if (width > 1390 && !$('body').hasClass('dark') && !$('#teaserLeft').hasClass('customerService'))
		$('#teaserLeft').addClass('flying');
	else 
		$('#teaserLeft').removeClass('flying');
}
