 
$(document).ready(function() { 
	
		
			if($("#client_list").size()>0) {
			
			
			var cl = $("#client_list");
			var showcase = $("#cs_carousel");
			
			cl.hide();
			cl.addClass('clients');
			
			$("#showcase_btn").click(function(e) {
					e.preventDefault(); 
					if(!$(this).hasClass('active')) {showcase.fadeIn();
					cl.fadeOut();
					$('.tabs a').removeClass('active');
					$(this).toggleClass('active');}
			});
			
			$("#clientList_btn").click(function(e) {
					if(!$(this).hasClass('active')) {	
					$('.tabs a').removeClass('active');
					e.preventDefault(); 
					showcase.fadeOut();
					cl.fadeIn();
					$('.tabs a').removeClass('active');
					$(this).toggleClass('active');}
			});
	
	}	
		//If inside the chart section?
		if($("#chart_wrapper").size() > 0) {
			
		 $("#chart_wrapper").append("<div class='tooltip hide'></div>");
		var curr = "";
		
		// hover effects for each circle. add tool tip as well.
		$("#approach-chart li").hover(function() {
			var currCircle= $(this).attr('id');
				if ($(currCircle).not('.active')) {
				$("#approach-chart").removeClass().addClass(currCircle);
				$(this).siblings().removeClass('active').end().addClass('active');
				$(".tooltip").removeClass().addClass(currCircle).addClass('tooltip');
				
				$(".tooltip").html("<div class='tip'></div><h1>"+$(this).find('.tt-content .title').text()+"</h1>"+"<p>"+$(this).find('.tt-content .content').text()+"</p>");			
			}
			var curr = currCircle ;

		}, function() { 
		// hide tooltip
			var currCircle= $(this).attr('id');
			$(".tooltip").toggleClass('hide') ;
	
		});
		 
			 DD_roundies.addRule('.tooltip', '10px');
	 
		}
		navigationPrimary(); 
 		 $("#client_login a").click(function() { 
			$("#signin_menu").toggle();
			$("#client_login a").toggleClass("menu-open"); 
			
		});
		
		$("#signin_menu").mouseup(function() {
				return false
		});
		
		$(document).mouseup(function(e) {
				if($(e.target).parent("a.signin").length==0) {
						$("#client_login a").removeClass("menu-open");
						$("#signin_menu").hide();
					}
		});			
		
		if ($('#slides').length >0 ){ 
			var timeout = 0;
			$('#slides').before("<div id='cnav'></div>").cycle({ 
				fx: 'custom', 
				cleartype:true,
				cleartypeNoBg:true,
				cssBefore:{   
					display:'block',
					zIndex:1,
					top:444
				}, 
				animIn:{  
					top:0
				}, 
				animOut:{  
					top:444
				},  
				cssAfter:{
					zIndex:0
				},
				pager:'#cnav',
				easeout:'easeout',
				timeout:timeout,
				speedIn:900,   
				speedOut:1000,
				prev:'#previous',
				next:'#next'
				
		}); //end cycle
			
		} //end if 
			
			
		if ($('#cs_carousel'.length >0)){
					var timeout = 0;
			 var fadeSpeed =200;
	  
 		function onAfter (curr, next, opts){
			if ((opts.currSlide + 1) == opts.slideCount)
				$('#next').fadeOut(fadeSpeed);
			else
				$('#next').fadeIn(fadeSpeed);
				
			if (opts.currSlide == 0)
					$('#previous').fadeOut(fadeSpeed);
			else
				$('#previous').fadeIn(fadeSpeed);
				
		}

			
			
			$('#cs_carousel #photos').after("<div id='cnav'></div>").cycle({ 
        fx: 'scrollHorz',
				cleartype:true,
				cleartypeNoBg:true,
				pager:'#cnav',
				easeout:'easeout',
				timeout:timeout,
				prev:'#previous',
				next:'#next',
				speed:500,
				nowrap: 1,
				after: onAfter
	    }); 
 		 
		 $('#cs_carousel #previous').fadeOut(fadeSpeed);
				
		} //end cs_carousel 
	}); //end function

			
	function navigationPrimary() {
		$('#nav_global li a.current').click(function(e) {
    e.preventDefault();
    //do other stuff when a click happens
		return false;
		});

		$('#nav_global li').removeClass('hover');
		$('#nav_global li a:not(.current)')
			.css({opacity: 1})
			.mouseover(function() {
				$(this).stop().animate({opacity: 0.0}, 600);
			})
			.mouseout(function() {
				$(this).stop().animate({opacity: 1}, 600);
			});
	} 
			
	$(window).load(function() {
	      $('.loading').hide();
	});
	
