/* .................................................. */
/* .................................................. */
/* rights reserved by FINAL IMAGE GmbH Germany - 2011 */
/* .................................................. */
/* .................................................. */
/* .................................................. */

$(function() {

	$('#dropdownCorner').click(function(e){
		
		e.preventDefault();
		
		var dropDown = $('#dropdownFahrzeug');
		if(dropDown.hasClass('empty') == false)		
			dropDown.toggleClass('akiv_dropdownFahrzeug');
		
	});
	
	if($('#dropdownFahrzeug')) {
		var pos = $('#dropdownFahrzeug').find('a.aktiv').position();
		$('#dropdownFahrzeug').scrollTo('a.aktiv');
	}

});

$(function() {



});

$(function() {

	
	//$('a[@rel*=lightbox]').lightBox();
	$('#fahrzeugPreviewCarusel').find('a.lightbox').lightBox();

});


$(function() {

    $('.fahrzeugCarsusel').jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });
	
});



$(function() {

	$('.engineeringBTN').click(function(e) {
	
		e.preventDefault();
		
		if($(this).attr('id') == "engineeringBack")
			stepEngineering('back');
		else
			stepEngineering('next');
		
	
	});

});
		





var stepEngineering = (function(direction) {
	
	var engingBoxes 	= $('.partnerBox');
	var aktivElement 	= 0;
	
	$.each(engingBoxes, function(index) {
		
		if($(this).hasClass('aktiv'))
			aktivElement = index;
		
		$(this).hide();
		$('#engineeringPicture_' + index).hide();
		$(this).removeClass('aktiv');
	
	});
	
	if(direction == "next" && (aktivElement >= 0 && aktivElement <= 2)) {
		var eStart 	= (aktivElement + 1);
		var eEnd	= (aktivElement + 3);
	}
	
	if(direction == "back" && (aktivElement >= 1 && aktivElement <= 3)) {
		var eStart 	= (aktivElement - 1);
		var eEnd	= (aktivElement + 1);
	}
	
	
	for(e = eStart; e <= eEnd; e++) {
			
		$('#engineeringBox_' + e).show();
		$('#engineeringPicture_' + e).show();
			
		if(e == eStart)
			$('#engineeringBox_' + e).addClass('aktiv');
			
	}

	
	if((aktivElement >= 0 && direction == "next") || (aktivElement > 1 && direction == "back"))
		$('#engineeringBack').show();
	else
		$('#engineeringBack').hide();
		
	if((aktivElement == 2 && direction == "next"))
		$('#engineeringNext').hide();
	else
		$('#engineeringNext').show();

});



