/* 

Author: Roi Kingon - Active Ingredients

*/



//Cufon

Cufon.replace('h2,h3', { fontFamily: 'Helvetica Neue LT Std' });

Cufon.replace('h5, .hero-quote, .snapshot', { fontFamily: 'Proxima Nova Lt' });

Cufon.replace('.hero-cite', { fontFamily: 'Proxima Nova Rg' });



//Jquery

$(function() {

	//Forms
	$("#phone").msk("(999) 999-9999");
	$("#zip").msk("99999")

	
	// Homepage

	$("#hero-homepage").cycle({

		fx:     'fade',

		speed:  1500,

		timeout: 10000,

		pause: true,

		pager:  '#hero-nav',

		pauseOnPagerHover: 1,

		cleartype: true,

		cleartypeNoBg: true

	});

	

	$(".homepage-pathway").jCarouselLite({

        btnNext: ".pathway-controls-right",

        btnPrev: ".pathway-controls-left",

		visible: 4

    });

	

	$(".newswrapper").jCarouselLite({

		vertical: true,

		visible: 1,

		auto: 5000,

		speed:1000

	});

	// Side bar
	
	$("#sidebar-rotator").cycle({

		fx:     'fade',
		
		sync: true,

		speed:  1000,

		timeout: 8000,

		pause: true,

		pager:  '#sidebar-nav',

		pauseOnPagerHover: 1

	});
	

	//Explore

	$(".readmore").click(function() {

			

		var scrollstatus = $(window).scrollTop();

		var offsetTop = $(this).offset().top;

		var height = $(this).parent().find("div.hidden").outerHeight();

		var windowHeight = $(window).height();

		var y = offsetTop - (windowHeight-height)+7;

		

		$(this).hide().parent().find(".hidden").animate({

			opacity: 'toggle',

			height: 'toggle'

		}, 900);

	

		if(scrollstatus < y) {$.scrollTo(y,900, {axis:'y'});}

				

		return false;

	});

	$(".hide").click(function() {

		$(this).parent().animate({

			opacity: 'toggle',

			height: 'toggle'

		}, 800, function() {

			$(this).parent().find(".readmore").fadeIn('fast');

		});

		

		return false;

	});
	
	//'Customers
	
	$("li", ".customer-list").has(".casestudy").hover(function() {
		
		$(this).find("a.casestudy").stop(true,true).css("display", "block").hide().animate({
			opacity: 'toggle'
		}, 250, function() {
			$(this).find("a.casestudy").show();
		});
		
		
	}, function() {
		
		$(this).find("a.casestudy").stop(true,true).animate({
			opacity: 'toggle'
		}, 250);
	
	});
	
	$(".casestudy").overlay({
		mask: { color: '#000000', loadSpeed: 200, opacity: 0.8 },
		target: '#casestudy-overlay',
		close: '.overlay-close',
		top: '15%',
		onBeforeLoad: function(t) {
			$("#casestudy-overlay").find(".overlay-details").empty().html('<center><img src="/overlays/loader.gif"></center>').load(this.getTrigger().attr('href'));
		}
	});

});
















































