(function($){

	/** AddThis Config */
	var addthis_config = {
		services_compact: 'facebook, linkedin, google, twitter, delicious, email',
		services_expanded: 'facebook, linkedin, google, twitter, delicious, email',
		ui_header_color: "#ffffff",
		ui_header_background: "#EEF1F3",
		ui_cobrand: "",
		data_track_clickback :true
	}

	$(function(){
		
		/** jQuery Pagination */
		var paginate = $("ul.paged");
		if( paginate.length > 0 )
		{
			$.getScript('/wp-content/themes/custom/js/jquery.pagination.js',function(){ 
				paginate.quickPager({
					pageSize: 5,
				});
			});	
		}
	
		$("body.post-type-our-story #menu-item-142").addClass("current-page-ancestor");
		$("body.post-type-your-needs #menu-item-140").addClass("current-page-ancestor");
		$("body.post-type-our-results #menu-item-143").addClass("current-page-ancestor");
		$("body.post-type-services #menu-item-141").addClass("current-page-ancestor");
		$("body.post-type-profiles #menu-item-142").addClass("current_page_item");
		$("body.post-type-profiles div.navigation .page-item-36").addClass("current_page_item");
		$("body.post-type-newsroom #menu-item-142").addClass("current_page_item");
	
		if ($("div.slideshow").length > 0) {
	
			$("div.slideshow ul").cycle({
	
				fx:"fade",
				timeout:"6000"
	
			});
	
		}
	
		if ($("div.featured").length > 0) {
	
			$("div.featured div.tabs a").bind("click", function(){
	
				var source = $(this);
				var target = source.parents("div.featured").find(source.attr("href"));
	
				if (target.length > 0) {
	
					source.parents("ul").removeAttr("class");
	
					source.parents("div.featured").find("div.panel").hide();
	
					if (source.hasClass("your-needs")) {
		
						source.parents("ul").addClass("active2");
		
					}
					
					else if (source.hasClass("our-results")) {
		
						source.parents("ul").addClass("active3");
		
					}
	
					target.show();
					
	
				}
	
				return false;
	
			});
	
		}
	
		if ($("div.profiles-filter").length > 0) {
	
			$("div.profiles-filter ul li a").bind("click", function(){
	
				var source = $(this);
				var filter = source.attr("rel");
	
				$("div.profiles-filter a").removeClass("active");
	
				if (filter == "all") {
	
					$("div.profiles-grid ul li").fadeIn();
	
				} else {
	
					$("div.profiles-grid ul li").hide();
					$("div.profiles-grid ul li." + filter).fadeIn();
	
				};
	
				source.addClass("active");
				
				// Filter address box
				
				if( $(this).parent().parent().hasClass('states') ) {
					
					$('div.address p').hide();
					$('div.address #contact-'+filter).fadeIn();
					
				} else {
					
					$('div.address p').hide();
					$('div.address #contact-headquarters').show();
					
				}
	
				return false;
	
			});
	
		}
	
		if ($("#commentform").length > 0) {
	
			$("#commentform").validate();
	
		}
	
		$("#page div.content div.navigation ul li").not(":last-child").after("<li class='separator'>|</li>")
		$("#footer ul li").not(":last-child").after("<li>&nbsp;|&nbsp;</li>");
		
	});

})(jQuery);
