/* Author: O/B-2010-JR

*/

jQuery('html').addClass('js');

jQuery(document).ready(function() {

	jQuery('nav ul li ul')
		.slideToggle(0);
		
	jQuery('nav ul li:has(ul)')
		.find('a')
		.bind('click',function(){
			jQuery(this)
				.parent()
				.find('ul')
				.slideToggle('fast');
		});
		
	jQuery('#utility #ContactDrawer')
		.bind('click', function(){
			jQuery('#drawer')
				.slideToggle('fast');
			
			jQuery('#utility')
				.toggleClass('draweractive');
				
			if(jQuery('#utility').hasClass('draweractive')){
				jQuery('#utility').css({
					'border-top'	: 'solid 8px black'
				});
			}else{
				jQuery('#utility').css({
					'border-top'	: 'solid 8px #666'
				});
			};
				
			jQuery(this)
				.toggleClass('arrowactive');
		});
	
	jQuery('#l_blogsearch, #l_comment-author, #l_comment-email, #l_fbemail').inFieldLabels();
	
	jQuery.get('ddblogs/recent.txt', function(data) {
	  jQuery('#buckets #blogs').append(data);
	});
	
	jQuery('#bucket2, #creative, #bbquoteslink, #termslink, #worklink').fancyZoom();
	
	jQuery('#drawer')
		.slideToggle(0,function(){
			jQuery('html')
				.removeClass('js');
		});
	
	if(jQuery('#officemap')){
		jQuery('#officemap').maphilight({
			fill: true,
			fillColor: 'ffffff',
			fillOpacity: 0.3,
			stroke: false,
			fade: false
		});
		
		
	}
	
	if(jQuery('#officepeople')){
	
		jQuery('#officepeople .bio').slideUp(0);
		
		jQuery('#officepeople a').bind('click',function(e){
		
			if(jQuery(this).parent().find('.open').length != 0){
			
				jQuery(this)
					.parent()
					.find('.open')
					.slideUp('fast',function(){
						jQuery(this)
							.removeClass('open');
					});
			
			}else{
		
				jQuery('#officepeople .open')
					.slideUp('fast',function(){
						jQuery(this)
							.removeClass('open');
					});
				jQuery(this)
					.parent()
					.find('div.bio')
					.slideDown('fast',function(){
						jQuery(this).addClass('open');
						var offset = jQuery(this)
											.offset();
						
						jQuery('html,body')
							.animate({scrollTop: offset.top - 116},'slow');
					});
				};
		});
	};

});




jQuery(window).load(function(){  

	jQuery("nav ul li.active ul")
		.slideToggle(0);
		
		
}); 













