$(document).ready(function () {

	$('.accordion h2').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
	
	$('#firma-check').click(function() {
		$('#li-firma').toggle('slow');
		$('#li-nip').toggle('slow');
		$(this).toggleClass("highlight");
		return false;
	}).next().hide();
	
	$('.info-box').equalHeights();
	
	jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

};

	
	$('a.link').click(function() {
		$('.table').fadeOut('slow');
		var el = $(this).parent().find('.table:first'); 
		el.css('top',$(this).parent().position().top);
		el.fadeToggle('slow');
	//	$('html, body').animate({scrollTop:0}, 'slow');
	});

	$('a.link2').click(function() {
		$('.table').fadeOut('slow');
		var el = $(this).parent().find('.table:first'); 
		el.css('top',$(this).parent().position().top);
		el.fadeToggle('slow');
//		$(this).parent().find('.table:first').fadeToggle('slow');
	//	$('html, body').animate({scrollTop:0}, 'slow');
	});


   $('a.close ').click(function() {
		$('.table').fadeOut('medium');
		$('.table').removeClass('top bottom')
		return false; 
	});

	$('a.cenrozw').click(function() {
		// $('html, body').animate({scrollTop:0}, 'slow');

		var el = $('#tabela_'+$(this).attr("id")); 
		el.css('top',$(this).position().top);
		el.fadeToggle('slow');

		$('.table').removeClass('top bottom')
		// $('.table').addClass('top');
		return false;
	});
	
	$('a#venga-a').click(function() {
		$('#tabela2').fadeToggle('slow');
		$('.table').removeClass('top bottom')
		$('.table').addClass('top');
		return false;
	});
	$('a#corsa-a').click(function() {
		$('.table').removeClass('top bottom')
		$('#tabela3').fadeToggle('slow'); 
		$('.table').addClass('top');
		return false;
	});
	$('a#astra-a').click(function() {
	 	$('.table').removeClass('top bottom')
		$('#tabela4').fadeToggle('slow');  
		$('.table').addClass('top');
			return false;
	});
	$('a#focuss-a').click(function() {$('.table').removeClass('top bottom')
		$('#tabela5').fadeToggle('slow');  
			$('.table').addClass('top');
			return false;
	});
	$('a#octavia-a').click(function() {;$('.table').removeClass('top bottom')
		$('#tabela1').fadeToggle('slow');  
			$('.table').addClass('top');
			return false;
	});
	
	$('a#venga-b').click(function() {$('.table').removeClass('top bottom')
		$('#tabela2').fadeToggle('slow');  
			$('.table').addClass('bottom');
			return false;
	});
	$('a#corsa-b').click(function() {$('.table').removeClass('top bottom')
		$('#tabela3').fadeToggle('slow');  
			$('.table').addClass('bottom');
			return false;
	});
	$('a#astra-b').click(function() {$('.table').removeClass('top bottom')
		$('#tabela4').fadeToggle('slow');  
		$('.table').addClass('bottom');
		return false;
		
	});
	$('a#focuss-b').click(function() {$('.table').removeClass('top bottom')
		$('#tabela5').fadeToggle('slow');  
			$('.table').addClass('bottom');
			return false;
	});
	$('a#octavia-b').click(function() {
											  $('.table').removeClass('top bottom')
		$('#tabela1').fadeToggle('slow');  
			$('.table').addClass('bottom');
			return false;
	});
	
	
	
	
	
	
	
	$('#slider').cycle({ 
        fx:     'fade', 
        speed:   500, 
        timeout: 0, 
        before: function() {  
            $('#caption').html(this.alt); 
        } 
    }); 

	$('.goto1').click(function() { 
           $('#slider').cycle(0);
		  $('.goto1').addClass('active');
		   $('.goto2').removeClass('active');
        return false; 
    });
 
$('.goto2').click(function() { 
           $('#slider').cycle(1);;
		  $('.goto2').addClass('active');
		   $('.goto1').removeClass('active');
        return false; 
    });




});

