/************************************
*	Custom Script for Cat and Mouse
*	Relation: Home
*************************************/

$(function(){	
	callProjectsCarousel();
	callMainProjectCarousel();
});
	
/*****************************************************
* PROJECT CAROUSEL
* Desc: The project carousel, this carousel navigates
		the main carousel, depending on which is
		clicked it will slide to the specific content
		in the main	carousel.
*****************************************************/	

function callProjectsCarousel() {

	$("ul#projects li .project_desc h4 a").each(function(n) {
		$(this).attr("href", "#project"+n);
	});
				
	var carousel = $("#projects").carouFredSel({
		width : 904,
		items : {
			visible : 5
		},
		padding     : "0 0 0 0",
		auto : {
			play			: false
			/* pauseDuration	: 3000, */
			/* pauseOnHover	: true */
		},
		scroll	: {
			easing : "easeInOutQuint",
			duration: 500,			
			items: 1,
			onAfter	: function(oldItems, newItems) {
				/*
				newItems.each(function(i) {
					if(i == 0){
												
						$(this).css('background-color', '#DF6F16').css('color', 'white');
						$(this).find('p').css('color', 'white');
													
					}
				});
				oldItems.each(function(i){
					if(i == 0){
						//console.log($(this))
						$(this).css('background-color', '#333').css('color', '#999');
						$(this).find('p').css('color', '#666');
					}
				});
				*/

			}
		},
		prev	: {
			button	: "#project_prev",
			onBefore: function(oldItems) {
				oldItems.each(function() {
					/*
					$(this).css('background-color', '#333');
					$(this).css('color', '#999');
					$(this).find('p').css('color', '#666');
					*/
				});
			}
		},
		next	: {
			button	: "#project_next",
			onBefore: function(oldItems) {
				oldItems.each(function() {
					/*
					$(this).css('background-color', '#333');
					$(this).css('color', '#999');
					$(this).find('p').css('color', '#666');
					*/
				});
			}
		}
		
		
	});
		
	//carousel.configuration( "width", $(window).width() );
}


/*****************************************************
* MAIN PROJECT CAROUSEL
* Desc: The main carousel, content which is displayed
		depending on the project carousel
*****************************************************/	

function callMainProjectCarousel() {

	$("ul#mainproject li").each(function(n) {
		$(this).attr("id", "project"+n);
	});
						
	var carousel = $("#mainproject").carouFredSel({
		items : {
			visible : 1
		},
		padding     : "0 0 0 0",
		auto : {
			play			: false
			/* pauseDuration	: 3000, */
			/* pauseOnHover	: true */
		},			
		scroll	: {
			easing : "easeInOutQuint",
			duration: 500,			
			items: 1,
			onAfter	: function(oldItems, newItems) {
				/*
				newItems.each(function(i) {
					if(i == 0){
												
						$(this).css('background-color', '#DF6F16').css('color', 'white');
						$(this).find('p').css('color', 'white');
													
					}
				});
				oldItems.each(function(i){
					if(i == 0){
						//console.log($(this))
						$(this).css('background-color', '#333').css('color', '#999');
						$(this).find('p').css('color', '#666');
					}
				});
				*/

			}
		},
		prev	: {
			button	: "#heritage_prev",
			onBefore: function(oldItems) {
				oldItems.each(function() {
					/*
					$(this).css('background-color', '#333');
					$(this).css('color', '#999');
					$(this).find('p').css('color', '#666');
					*/
				});
			}
		},
		next	: {
			button	: "#heritage_next",
			onBefore: function(oldItems) {
				oldItems.each(function() {
					/*
					$(this).css('background-color', '#333');
					$(this).css('color', '#999');
					$(this).find('p').css('color', '#666');
					*/
				});
			}
		}
		
	});
	
	carousel.link_anchors("#projects_listing");
}



