$(document).ready(function() {
	//Inner image sliders
	$('#images ul').cycle({
		fx: 'fade',
		pager: '#switcher1',
		timeout: 3000
	});
	
	$('#images2 ul').cycle({
		fx: 'fade',
		pager: '#switcher2',
		timeout: 3000
	});
	
	$('#images3 ul').cycle({
		fx: 'fade',
		pager: '#switcher3',
		timeout: 3000
	});
        
        $('#images4 ul').cycle({
		fx: 'fade',
		pager: '#switcher4',
		timeout: 3000
	});
        $('#images5 ul').cycle({
		fx: 'fade',
		pager: '#switcher5',
		timeout: 3000
	});
        $('#images6 ul').cycle({
		fx: 'fade',
		pager: '#switcher6',
		timeout: 3000
	});
        $('#images7 ul').cycle({
		fx: 'fade',
		pager: '#switcher7',
		timeout: 3000
	});
        $('#images8 ul').cycle({
		fx: 'fade',
		pager: '#switcher8',
		timeout: 3000
	});
        $('#images9 ul').cycle({
		fx: 'fade',
		pager: '#switcher9',
		timeout: 3000
	});
        $('#images10 ul').cycle({
		fx: 'fade',
		pager: '#switcher10',
		timeout: 3000
	});
        $('#images11 ul').cycle({
		fx: 'fade',
		pager: '#switcher11',
		timeout: 3000
	});
        $('#images12 ul').cycle({
		fx: 'fade',
		pager: '#switcher12',
		timeout: 3000
	});
        $('#images13 ul').cycle({
		fx: 'fade',
		pager: '#switcher13',
		timeout: 3000
	});
        $('#images14 ul').cycle({
		fx: 'fade',
		pager: '#switcher14',
		timeout: 3000
	});
        $('#images15 ul').cycle({
		fx: 'fade',
		pager: '#switcher15',
		timeout: 3000
	});
	
	//Main Slider
	$('div.slideshow').fadeGallery({
		slideElements:'ul.slideset .slideset-item',
		pagerLinks:'ul.switcher li',
		btnNext:'a.next-box',
		btnPrev:'a.prev-box',
		pauseOnHover:true,
		autoRotation:true,
		autoHeight:false,
		switchTime:500000000,
		duration:5000,
		onAfterFade: function () {
			getSlideName()
		}
	});
	
	$('.gallery ul').cycle({
		fx: 'fade',
		timeout: 5000
	});
	
	//Inner carusel (collection and pressa)
	$('.slider').tinycarousel();
	
	getSlideName()
	
});

function getSlideName(){
	var slideHolder = $('#slideset');
	var nextTxt = $('#next-box').find('span:first');
	var prevTxt = $('#prev-box').find('span:first');
	slideHolder.find('li').each(function(){
		if($(this).hasClass('active')){
			if($(this).next().length){
				nextTxt.text($(this).next().find('.info-holder h2').text())
			}
			else{nextTxt.text('')}
			
			if($(this).prev().length){
				prevTxt.text($(this).prev().find('.info-holder h2').text())
			}
			else{prevTxt.text('')}
		}
	})
}
