
$(document).ready(function(){
	
	// WORK PAGE DROPDOWNS 
	
	$('#LeftSidebar ul li').each(function() { 
		if($(this).children('ul.work_subnav').length) { 
			$(this).addClass('has_child'); 
		}
	}); 
	
	$('#LeftMenu li.has_child a').not('#LeftMenu ul.work_subnav li a').click(function() { 
		
			if($(this).parent('li').hasClass('activeChild')) { 
				$('.work_subnav').slideUp(400, 'linear', function() { 
					$(this).parent('li').removeClass('activeChild');
					$(this).parent('li').css('background-position', '0 0'); 
					return false; 
				});
			} 
			
			else { 
				$('#LeftMenu').find('.active').not('#LeftMenu ul.work_subnav li.active').removeClass('active'); 
				
				$(this).parent('li.has_child').css('background-position', '0 -30px'); 
				
				$('#LeftMenu li.activeChild ul.work_subnav').slideUp(400, 'linear', function() {
						$('#LeftMenu').find('.activeChild').css('background-position', '0 0').removeClass('activeChild');	
				});
					 
				$(this).parent('li').children('.work_subnav').slideDown(400, 'linear', function() { 
					$(this).parent('li.has_child').addClass('activeChild'); 
				});
				return false; 
			}
	}); 

	// HOMEPAGE FANCY FADES
	
	var deviceAgent = navigator.userAgent.toLowerCase();
	var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
	if(!agentID) {
	$('#Featured').hoverIntent(function() { 
		$(this).children('img').fadeIn(300); 
		$(this).children('a').children('h3, h4').animate({ 
			color: '#ffffff'
		}, 300, function() { 
			//done
		});
	}, function() { 
		$(this).children('img').fadeOut(150); 
		$(this).children('a').children('h3, h4').animate({ 
			color: '#081130'
		}, 150, function() { 
			//done
		});
	}); 
	
	$('#ShootReel, #ClipReel').hoverIntent(function() { 
		$(this).children('img').fadeIn(300); 
		$(this).children('a').animate({ 
			color: '#ffffff'
		}, 300, function() { 
			//done
		});
	}, function() { 
		$(this).children('img').fadeOut(150); 
		$(this).children('a').animate({ 
			color: '#7AA04A'
		}, 150, function() { 
			//done
		});
	});
	
	}	
	
	$('#Featured a').each(function() { 
		var thishght = parseInt($(this).height()); 
		var newtop = parseInt((170 - thishght)/2) + 2; 
		$(this).css('margin-top', newtop + 'px'); 
	}); 
	
	$('#Featured img, #ShootReel img, #ClipReel img').click(function() { 
		window.location = $(this).parent('div').children('a').attr('href'); 
	}); 
	
	$('#CreativeTeam ul li:nth-child(3n)').css('width', '240px'); 
	$('#CreativeTeam ul').css('width', '850px'); 
	
	// ABOUT PAGE - VERTICAL ALIGN
	
	if ($.browser.msie && $.browser.version.substr(0,1) < 8) {	
		var contentHeight = $('#AboutHeader .content').height(); 
		var newContentMargin = parseInt((245 - contentHeight - 60)/2); 
		$('#AboutHeader .content').css('margin-top', newContentMargin + 'px'); 
	}
	
	$('.social_media').each(function() { 
		var thisHeight = $(this).height(); 
		var blurbHeight = $('.blurb').height(); 
		var socialMarg = parseInt((blurbHeight - thisHeight)/2); 
		$(this).css('margin-top', socialMarg); 
	}); 
	
	if(!agentID) {
	
	$('#BioThumbs li').not('.active').children('a').hoverIntent(function() { 
		if ($.browser.msie) {		
			$(this).children('.bio_name').show(); 
		}
		else { 
			$(this).children('.bio_name').fadeIn(150); 
		}
	}, function() { 
		if ($.browser.msie) {		
			$(this).children('.bio_name').hide(); 
		}
		else { 
			$(this).children('.bio_name').fadeOut(75); 
		}
	}); 
	
	}
	
	$('#BioThumbs li').click(function() { 
		window.location = $(this).children('a').attr('href'); 
	});
	
	// IMAGE LOAD SHOW
	
		$('#IndividualBio #MainPhotoOuter img').css('display', 'block'); 
		$('#IndividualBio #MainPhotoOuter img.illustration').delay(500).fadeOut(1000); 
		
	// WORK PAGE
	
	$('object.wd-video-player').hide().fadeIn(5000).addClass('this_obj'); 
	
});

