$(function(){
	$("div.tab, div#tab").each(function(i){
		$(this).hide();
	});
	$("#tab-btn").click(function(){
		$("#tab").slideToggle(100, function(){
			swapTabBtn();
		});
		return false;
	});
	if($('.home').length){
		$("#tab-btn").click(function(){
			$("#featured-partners li:visible .tab").slideToggle(100, function(){
				swapTabBtn();
			});
			return false;
		});
		$("#tab-btn").hover(function () {
				$("#featured-partners ul").cycle('pause');
		},function () {
				$("#featured-partners ul").cycle('resume');
		});
		$("#featured-partners ul").cycle({
	    fx: 'fade',
	    timeout: 3500,
			speed: 500,
			fit: 1,
			height: 'auto',
			after: onAfter,
			before: onBefore,
			pause: 1,
			pager: '#pager',			
		});
	}
	if ($(".scroll").length){
		$('.scroll').jScrollPane(
			{
				showArrows: true,
				scrollbarWidth: 13,
				dragMaxHeight: 17
			}
		);
	}
});
function onAfter(curr, next, opts) {
	var index = opts.currSlide;
	 $(curr).find(".tab").hide();
}
function onBefore(curr, next, opts) {
	if($("#featured-partners li .tab").is(":visible")){
		swapTabBtn();
	}
}
function swapTabBtn(){
	if($("#tab-btn").attr("class") == "open"){
		$("#tab-btn").attr("class","close");
	}else{
		$("#tab-btn").attr("class","open");
	}
}
