// JavaScript Document

$(document).ready(function() {
	
    $('.home #billboard').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout:         6000,
		autostop:        1,     // true to end slideshow after X transitions (where X == slide count) 
    	autostopCount:   9     // number of transitions (optionally used with autostop to define X) 
	});

	$('#content_secondary .sub_nav a').not('#nav-why_netnography a').each(function(){
		$(this).prepend('&gt;&nbsp;');
	 });

   var path = location.pathname.substring(location.pathname.lastIndexOf("/"), location.pathname.length);
	if ( path.length > 1 ) {
     $('#content_secondary .sub_nav a[href*=' + path + ']').parent().attr('class', 'selected');
	 } else if ( path == "/" ) {
     $('#content_secondary .sub_nav a[href*=index.php]').parent().attr('class', 'selected');
	 }

	$('#main_nav ul a').each(function(){
		$(this).wrapInner('<span></span>');						  
	});
	
	
	$('#billboard_solutions li').hover(function(){
		$(this).find('.category_name').hide();
		$(this).find('.product_name').fadeIn('fast');
		$(this).animate({top:150}, 'normal');
	},
	function(){
		$(this).animate({top:243}, 'normal',function() {
    $(this).find('.category_name').fadeIn('fast');
	$(this).find('.product_name').hide();
  });
		
	});
	
//	equalHeight($('#home_features > li').not('#demo'));
	equalHeight($('.health_base .screenshot'));
	equalHeight($('.science_base .screenshot'));
	
	$('.content #billboard').append('<div class="border"></div>');
	
	$('#home_features #downloads').click(function(){
		window.location=$(this).find('a').attr('href');		
		return false;
	});

	$('#home_features #spotlight').click(function(){
		window.location=$(this).find('a').attr('href');		
		return false;
	});
	
	$('.product_highlight li').each(function(){
		$(this).wrapInner('<span></span>');
	 });


});

function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}



