$(document).ready(function() {
	/* General: Sub-Nav Textbox Candy */
	$('input#newsletter_signup').click(function(){
		if (this.value == 'Email Address')
		{
			this.value = '';
			this.style.color = '#000';
		}
	});
	
	/* Homepage: Rotator Button Controls */
	var active_banner = 0;
	var button_over   = false;
	$('div#rotator').scrollLeft(0);
	$('img.rotator-button').each(function(){
		$(this).click(function(){
			current_banner     = document.getElementById('rotator-button-'+ active_banner);
			current_banner.src = current_banner.src.replace('active', 'inactive');		
			banner_id          = this.id.substr(15);
			active_banner      = banner_id;
			$(this).attr('src', this.src.replace('inactive', 'active'));
			$('div#rotator').animate({scrollLeft: (674*banner_id)}, 700);
		});
		$(this).mouseenter(function(){
			$(this).click(function(){
				clearInterval(rotator_interval);
				current_banner     = document.getElementById('rotator-button-'+ active_banner);
				current_banner.src = current_banner.src.replace('active', 'inactive');		
				banner_id          = this.id.substr(15);
				active_banner      = banner_id;
				$(this).attr('src', this.src.replace('inactive', 'active'));
				$('div#rotator').animate({scrollLeft: (674*banner_id)}, 700);
			});
		});
	});

	/* Homepage: Rotator Autoplay */
	var total_slides = $('img.rotator-button').length;
	var rotator_interval = setInterval(function(){
		if (active_banner == (total_slides - 1))
		{
			target_slide = 0
		}
		else 
		{
			target_slide = (parseInt(active_banner) + 1);
		}
		$('img#rotator-button-'+ target_slide).trigger('click');
	}, 4500);
	$('a#banner-right-arrow').mouseenter(function(){
		$(this).animate({ opacity: 1 });
	});
	$('a#banner-right-arrow').mouseleave(function(){
		$(this).animate({ opacity: 0.7 });
	});
	$('a#banner-left-arrow').mouseenter(function(){
		$(this).animate({ opacity: 1 });
	});
	$('a#banner-left-arrow').mouseleave(function(){
		$(this).animate({ opacity: 0.7 });
	});
	$('a#banner-right-arrow').click(function(){
		clearInterval(rotator_interval);
		if (active_banner == (total_slides - 1))
		{
			target_slide = 0
		}
		else 
		{
			target_slide = (parseInt(active_banner) + 1);
		}
		$('img#rotator-button-'+ target_slide).trigger('click');
		this.blur();
		return false;
	});
	$('a#banner-left-arrow').click(function(){
		clearInterval(rotator_interval);
		if (active_banner == 0)
		{
			target_slide = (total_slides - 1)
		}
		else 
		{
			target_slide = (parseInt(active_banner) - 1);
		}
		$('img#rotator-button-'+ target_slide).trigger('click');
		this.blur();
		return false;
	});	
	$('div.news-column').css({ height: $('div.full-column').height() })
	setTimeout(function (){
		$('div.news-column').css({ height: $('div.full-column').height() })
	}, 5500);
	
	$('ul.client-list li').mouseover(function(){
		$('ul.client-list li').each(function(){
			this.className = '';
		})
		this.className = 'active';
	});
	$('div.news-column div.news-bite').mouseover(function(){
		$('div.news-column div.news-bite').each(function(){
			this.className = 'news-bite';
		})
		this.className = 'news-bite highlight';
	});
	$('div.news-column div.news-bite').click(function(){
		window.location = $(this).find('a')[0].href;
	});
});

