jQuery(document).ready(function() {
   
//jQuery('ul#carousel-items').jcarousel({
// 	wrap: 'circular', 
//	direction: "up"
//});


/*
$(".pod-seo").hover(function() {
		$(this).attr("src","images/pod-seo-over.png");
			}, function() {
		$(this).attr("src","images/pod-seo.png");
});
*/
	
	
		
	$("ul#carousel-items").carouFredSel({
		width: 1600,
		direction: "up",
		items: {
			visible: 1,
			start: 0
		},
		scroll: {
			items: 1,
			easing: "easeInOutQuad",
			duration: 500,
			pauseOnHover: true,
			mousewheel: true
		},
		auto: {
			pauseDuration: 10000,
			delay: 1000
		},
		prev: {
			button: "#prev_btn",
			key: "left"
		},
		next: {
			button: "#next_btn",
			key: "right"
		},
		pagination: "#pag"
	});
	
	
	// Fancy box
	$('a.fancybox').fancybox({
		'width':700,
		'height':840,
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type':'iframe',
		'overlayColor': '#000',
		'padding':'0',
		'overlayOpacity':'0.8',
		'autoScale':'true'
	});
	
	
	// Fancy box
	$('a.fancywork').fancybox({
		'width':794,
		'height':840,
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type':'iframe',
		'overlayColor': '#000',
		'padding':'0',
		'overlayOpacity':'0.8',
		'autoScale':'true'
	});


// Work page interaction
	var stretch_0_open = false;
	var stretch_1_open = false;
	var stretch_2_open = false;
	var stretch_3_open = false;
	var stretch_4_open = false;
	var stretch_5_open = false;
	var stretch_6_open = false;
	var stretch_7_open = false;
	var stretch_8_open = false;
	var stretch_9_open = false;
	var stretch_10_open = false;
	var stretch_11_open = false;
	
	
// Stretch 0
	$('#stretch-small-0').click(function() {
		if (stretch_0_open == false) { 
		  $('#stretch-large-0').slideDown('fast', function() {
			$('#stretch-large-0').html('<a href="http://m.lightstreaminteractive.com" target="_blank"><img src="../images/stretch-mobileapp.png" /></a>');
		  });
		  stretch_0_open = true;
		} else { 
		  $('#stretch-large-0').slideUp('fast', function() {
			
		  });
		  stretch_0_open = false;
		}
		goToByScroll($(this).attr("id"));  
	});	
	
	
// Stretch 1
	$('#stretch-small-1').click(function() {
		if (stretch_1_open == false) { 
		  $('#stretch-large-1').slideDown('fast', function() {
			$('#stretch-large-1').html('<a href="http://www.aquariusweddings.co.uk" target="_blank"><img src="../images/stretch-aquarius.png" /></a>');
		  });
		  stretch_1_open = true;
		} else { 
		  $('#stretch-large-1').slideUp('fast', function() {
			
		  });
		  stretch_1_open = false;
		}
		goToByScroll($(this).attr("id"));  
	});
	


// Stretch 2
	$('#stretch-small-2').click(function() {
		if (stretch_2_open == false) { 
		  $('#stretch-large-2').slideDown('fast', function() {
			$('#stretch-large-2').html('<a href="http://www.charlotte-designs.com" target="_blank"><img src="../images/stretch-charlotte.png" /></a>');
		  });
		  stretch_2_open = true;
		} else { 
		  $('#stretch-large-2').slideUp('fast', function() {
			
		  });
		  stretch_2_open = false;
		}
		goToByScroll($(this).attr("id"));  
	});
	
	
// Stretch 3
	$('#stretch-small-3').click(function() {
		if (stretch_3_open == false) { 
		  $('#stretch-large-3').slideDown('fast', function() {
			$('#stretch-large-3').html('<a href="http://www.facebook.com/pages/UK-tefl/197825923566526" target="_blank"><img src="../images/stretch-uktefl.png" /></a>');
		  });
		  stretch_3_open = true;
		} else { 
		  $('#stretch-large-3').slideUp('fast', function() {
		  });
		  stretch_3_open = false;
		}
		goToByScroll($(this).attr("id"));  
	});
	

// Stretch 4
	$('#stretch-small-4').click(function() {
		if (stretch_4_open == false) { 
		  $('#stretch-large-4').slideDown('fast', function() {
			$('#stretch-large-4').html('<a href="http://www.relativesearch.co.uk" target="_blank"><img src="../images/stretch-relative.png" /></a>');
		  });
		  stretch_4_open = true;
		} else { 
		  $('#stretch-large-4').slideUp('fast', function() {

		  });
		  stretch_4_open = false;
		}
		goToByScroll($(this).attr("id"));
	});
	
	
// Stretch 5
	$('#stretch-small-5').click(function() {
		if (stretch_5_open == false) { 
		  $('#stretch-large-5').slideDown('fast', function() {
			$('#stretch-large-5').html('<a href="http://www.lightstreammobile.com" target="_blank"><img src="../images/stretch-mobile.png" /></a>');
		  });
		  stretch_5_open = true;
		} else { 
		  $('#stretch-large-5').slideUp('fast', function() {
		  });
		  stretch_5_open = false;
		}
		goToByScroll($(this).attr("id"));  
	});
	
	
// Stretch 6
	$('#stretch-small-6').click(function() { 
		if (stretch_6_open == false) { 
		  $('#stretch-large-6').slideDown('fast', function() {
			$('#stretch-large-6').html('<a href="http://www.startapart.com" target="_blank"><img src="../images/stretch-start.png" /></a>');
		  });
		  stretch_6_open = true;
		} else { 
		  $('#stretch-large-6').slideUp('fast', function() {
		  });
		  stretch_6_open = false;
		}
		goToByScroll($(this).attr("id"));
	});
	
	
// Stretch 7
	$('#stretch-small-7').click(function() { 
		if (stretch_7_open == false) { 
		  $('#stretch-large-7').slideDown('fast', function() {
			$('#stretch-large-7').html('<a href="http://www.viewvenues.com" target="_blank"><img src="../images/stretch-venued.png" /></a>');
		  });
		  stretch_7_open = true;
		} else { 
		  $('#stretch-large-7').slideUp('fast', function() {
			$('#stretch-large-7').html("New Content");
		  });
		  stretch_7_open = false;
		}
		goToByScroll($(this).attr("id"));
	});
	
	
// Stretch 8
	$('#stretch-small-8').click(function() { 
		if (stretch_8_open == false) { 
		  $('#stretch-large-8').slideDown('fast', function() {
			$('#stretch-large-8').html('<img src="../images/stretch-george.png" />');
		  });
		  stretch_8_open = true;
		} else { 
		  $('#stretch-large-8').slideUp('fast', function() {
		  });
		  stretch_8_open = false;
		}
		goToByScroll($(this).attr("id"));
	});
	
	
	
	function goToByScroll(id){
      // Remove "link" from the ID
    id = id.replace("link", "");
      // Scroll
    $('html,body').animate({
        scrollTop: $("#"+id).offset().top},
        'slow');
	}





});

