(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(){
	
		$("body.post-type-blog #menu-item-33").addClass("current-page-ancestor");
	
		$("body.post-type-our-work #menu-item-28").addClass("current-page-ancestor");
	
		$("body.post-type-profiles #menu-item-10").addClass("current-page-ancestor");
	
		$("body.post-type-newsroom #menu-item-25").addClass("current-page-ancestor");
		$("body.post-type-profiles div.navigation .page-item-122").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").removeClass("active");
	
					source.parents("div.featured").find("div.panel").hide();
	
					if (source.hasClass("our-work")) {
		
						source.parents("ul").addClass("active");
		
					}
	
					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);
