var current = 1
  	
	$(document).ready(function(){
		
		$('#frame img').mouseover(function() {
			$('#frame img').css({'cursor':'pointer'});
		});
		
		
		
		$('#text2').click(function () { 
			window.location.href = "strona/15/nie_plac_za_serwis_wydluz_sobie_gwarancje/"
		});
		$('#image2').click(function () { 
			window.location.href = "strona/15/nie_plac_za_serwis_wydluz_sobie_gwarancje/"
		});
		$('#image2_1').click(function () { 
			window.location.href = "strona/15/nie_plac_za_serwis_wydluz_sobie_gwarancje/"
		});
		
		$('#text3').click(function () { 
			window.location.href = "green/"
		});
		$('#image3').click(function () { 
			window.location.href = "green/"
		});
		$('#image3-1').click(function () { 
			window.location.href = "green/"
		});
		$('#image3-2').click(function () { 
			window.location.href = "green/"
		});
		$('#image3-3').click(function () { 
			window.location.href = "green/"
		});
		$('#image3-4').click(function () { 
			window.location.href = "green/"
		});
		
		$('#text4').click(function () { 
			window.location.href = "strona/17/najwiekszy_fitness_klub_w_polsce/"
		});
		$('#image4').click(function () { 
			window.location.href = "strona/17/najwiekszy_fitness_klub_w_polsce/"
		});	
		
		$('#text5').click(function () { 
			window.location.href = "strona/24/losowanie_nagrod_vip_prestige_gold_euro_2012/"
		});
		$('#image5').click(function () { 
			window.location.href = "strona/24/losowanie_nagrod_vip_prestige_gold_euro_2012/"
		});	
		
		
		$('#text6').click(function () { 
			window.location.href = "strona/28/indoor_cycle_c510/"
		});
		$('#image6-1').click(function () { 
			window.location.href = "strona/28/indoor_cycle_c510/"
		});
		$('#image6-2').click(function () { 
			window.location.href = "strona/28/indoor_cycle_c510/"
		});
		$('#image6-3').click(function () { 
			window.location.href = "strona/28/indoor_cycle_c510/"
		});
		
		$('#text7').click(function () { 
			window.location.href = "strona/40/bieznia_t_652_prestige_edition/"
		});
		$('#image7').click(function () { 
			window.location.href = "strona/40/bieznia_t_652_prestige_edition/"
		});
		$('#image7-2').click(function () { 
			window.location.href = "strona/40/bieznia_t_652_prestige_edition/"
		});
		
		
		
		
		
		interwal = setInterval( nextAnim, 7000 );
   
		promo1();
		
		
		$("a#zero").click(function(event){
			clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo0();
        	interwal = setInterval( nextAnim, 7000 );
    	});
		
    	
		$("a#one").click(function(event){
			clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo1();
        	interwal = setInterval( nextAnim, 7000 );
    	});
    	
		$("a#two").click(function(event){
        	clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo2();
        	interwal = setInterval( nextAnim, 7000 );
    	});
    	
    	$("a#three").click(function(event){
        	clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo3();
        	interwal = setInterval( nextAnim, 7000 );
        	
    	});
    	
    	$("a#four").click(function(event){
        	clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo4();
        	interwal = setInterval( nextAnim, 7000 );
        	
    	});
    	$("a#five").click(function(event){
        	clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo5();
        	interwal = setInterval( nextAnim, 7000 );
        	
    	});
    	$("a#six").click(function(event){
        	clearInterval(interwal);
        	event.preventDefault();
        	resetAnim();
        	promo6();
        	interwal = setInterval( nextAnim, 7000 );
        	
    	});
    	
	});
	
	function nextAnim(){
		//event.preventDefault();
        resetAnim();
        
        if (current == 1){
        	promo2()
        	current = 2
        }
        else if (current == 2){
        	promo3()
        	current = 3
        }
        else if (current == 3){
        	promo4()
        	current = 4
        }
        else if (current == 4){
        	promo5()
        	current = 5
        }
        else if (current == 5){
        	promo6()
        	current = 6
        }
        else if (current == 6){
        	promo1()
        	current = 1
        }
	}
	
	
	
	
	
	function promo1(){
		current = 1
		$('a.promonavi').removeClass('selected')
		$('a#one').addClass('selected')
		
		$('#text7').delay(700).animate({ left: '100', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image7').delay(700).animate({ left: '550', top: '10'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image7-2').delay(900).animate({ left: '420', top: '180'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
	}
	
	
	function promo2(){
		current = 2
		$('a.promonavi').removeClass('selected')
		$('a#two').addClass('selected')
		
		$('#text6').delay(700).animate({ left: '500', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-1').delay(900).animate({ left: '500', top: '210'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-2').delay(300).animate({ left: '200', top: '50'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-3').delay(500).animate({ left: '50', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
		
	}
	
	function promo3(){
		current = 3
		$('a.promonavi').removeClass('selected')
		$('a#three').addClass('selected')
		
		$('#text3').delay(700).animate({ left: '100', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3').delay(300).animate({ left: '40', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-1').delay(100).animate({ left: '500', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-2').delay(300).animate({ left: '650', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-3').delay(500).animate({ left: '800', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-4').delay(500).animate({ left: '-100', top: '220'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
		
	}
	
	function promo4(){
		current = 4
		$('a.promonavi').removeClass('selected')
		$('a#four').addClass('selected')
		
		$('#text5').delay(400).animate({ left: '550', top: '160'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image5').delay(100).animate({ left: '-50', top: '0'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
		

	}
	
	function promo5(){
		current = 5
		$('a.promonavi').removeClass('selected')
		$('a#five').addClass('selected')
		
		$('#text2').delay(500).animate({ left: '600', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image2').delay(100).animate({ left: '780', top: '210'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image2_1').delay(100).animate({ left: '00', top: '20'}, {duration: 1000, easing: 'easeInOutCirc'});
		
	}
	
	function promo6(){
		current = 6
		$('a.promonavi').removeClass('selected')
		$('a#six').addClass('selected')
		
		$('#text4').delay(700).animate({ left: '550', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image4').delay(100).animate({ left: '90', top: '135'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image4_2').delay(100).animate({ left: '420', top: '80'}, {duration: 1000, easing: 'easeInOutCirc'});

		
	}
	
	

	function resetAnim(){
	
		
		$('#text6').delay(100).animate({ left: '1200', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-1').delay(100).animate({ left: '500', top: '900'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-2').delay(300).animate({ left: '-400', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image6-3').delay(500).animate({ left: '-400', top: '-440'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		$('#text7').delay(100).animate({ left: '-500', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image7').delay(100).animate({ left: '1400', top: '0'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image7-2').delay(100).animate({ left: '1320', top: '180'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		$('#text8').delay(100).animate({ left: '-500', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image8').delay(100).animate({ left: '1400', top: '0'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		$('#text2').delay(100).animate({ left: '1000', top: '150'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image2').delay(100).animate({ left: '-70', top: '430'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image2_1').delay(100).animate({ left: '-600', top: '10'}, {duration: 1000, easing: 'easeInOutExpo'});
		
		$('#text3').delay(100).animate({ left: '-450', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3').delay(100).animate({ left: '-300', top: '220'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-1').delay(300).animate({ left: '1200', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-2').delay(200).animate({ left: '1200', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-3').delay(100).animate({ left: '1200', top: '40'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image3-4').delay(100).animate({ left: '-100', top: '-1220'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
		$('#text4').delay(100).animate({ left: '1000', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image4').delay(100).animate({ left: '-640', top: '0'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image4_2').delay(100).animate({ left: '220', top: '400'}, {duration: 1000, easing: 'easeInOutCirc'});
		
		
		$('#text5').delay(100).animate({ left: '1200', top: '155'}, {duration: 1000, easing: 'easeInOutCirc'});
		$('#image5').delay(100).animate({ left: '-700', top: '0'}, {duration: 1000, easing: 'easeInOutCirc'});
	
	}
