// Ding Communications, Inc.
// js framework 2009

$(document).ready(function(){
	
	// fade in large bell on agency page
	$('img#bellFadeIn').fadeIn('slow');

	// fade out social networking icons
	// NOTE: still need to figure out how to stop auto animate when scrolling over numerously
	$('li.social_icons img').fadeTo('fast',0.4);
	$('li.social_icons img').hover(function(){
		$(this).fadeTo('fast',1);
	}, function(){
		$(this).fadeTo('fast',0.4);
	});
	
	
	
	/*
	// filtered portfolio navigation
	// "focus" class does not have any styling yet
	$('ul#workNav a').click(function(){
		// add/remove "current" class whenever a medium is clicked
		$(this).css('outline','none');
		$('ul#workNav .current').removeClass('current');
		$(this).parent().addClass('current');
		
		// when a medium is clicked, assign a variable by making the text of the link all lowercase and replace blank spaces with hyphens
		var filterVal = $(this).text().toLowerCase().replace(' ','-').replace('/','-');
		
		if(filterVal == 'all'){
			$('ul#workThumb li').fadeTo('fast',1).removeClass('focus');
		} else {
			$('ul#workThumb li').each(function(){
				if(!$(this).hasClass(filterVal)){
					$(this).fadeTo('fast',0.2).removeClass('focus');
				} else {
					$(this).fadeTo('fast',1).addClass('focus');	
				}
			});
		}
	
		return false;
	});
	*/
	
	
	
	// load footer "bell" flash movie
	$('#bell').flash(
        { src: 'images/ding_bell_ring.swf',
          width: 900,
          height: 30 },
        { version: 8 }
    );

	// rotating front page banner

	$(function() { 
    $('#featImg').cycle({ 
        speed: '700', 
        pause: 1,
        delay: -3000,
        startingSlide: 1,
    		timeoutFn: calculateTimeout 
    }); 
	});  
	// timeouts per slide (in seconds) 
	var timeouts = [0,0,1,2,2,4,4,1,4]; 
	function calculateTimeout(currElement, nextElement, opts, isForward) { 
   var index = opts.currSlide; 
   return timeouts[index] * 1200; 
	} 
    

});

	
	
	

	