function loadNavAssets(section){
  var activeSection = section;
  
  // main navigation
  $("#btn_nav_solutions")
    .mouseover(function() { 
      var src = overState($(this).attr("src"),activeSection,3);
      $(this).attr("src", src);
    })
    .mouseout(function() {
      var src = outState($(this).attr("src"),activeSection,3);
      $(this).attr("src", src);
    });

  $("#btn_nav_product_dev")
    .mouseover(function() { 
      var src = overState($(this).attr("src"),activeSection,4);
      $(this).attr("src", src);
    })
    .mouseout(function() {
      var src = outState($(this).attr("src"),activeSection,4);
      $(this).attr("src", src);
    });
  $("#btn_nav_capabilities")
    .mouseover(function() { 
      var src = overState($(this).attr("src"),activeSection,5);
      $(this).attr("src", src);
    })
    .mouseout(function() {
      var src = outState($(this).attr("src"),activeSection,5);
      $(this).attr("src", src);
    });
  $("#btn_nav_commitment")
	.mouseover(function() { 
      var src = overState($(this).attr("src"),activeSection,6);
      $(this).attr("src", src);
    })
    .mouseout(function() {
      var src = outState($(this).attr("src"),activeSection,6);
      $(this).attr("src", src);
    });
  $("#btn_nav_about_us")
	.mouseover(function() { 
      var src = overState($(this).attr("src"),activeSection,7);
      $(this).attr("src", src);
    })
    .mouseout(function() {
      var src = outState($(this).attr("src"),activeSection,7);
      $(this).attr("src", src);
    });

  // product development panels
  $("#pnl_innovation").hide();
  $("#pnl_flavor_profiling").hide();
  $("#pnl_new_products").show();
  $("#pnl_culinary_expertise").hide();

  $("#btn_innovation img")
    .mouseover(function() { 
 	  var src = $(this).attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "");
      src = src + "_active.jpg";
      $(this).attr("src", src);
      showHidePanels('innovation');
      showHideButtons('innovation');
    });

  $("#btn_flavor_profiling img")
    .mouseover(function() { 
 	  var src = $(this).attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "");
  	  src = src + "_active.jpg";
      $(this).attr("src", src);
      showHidePanels('flavor_profiling');
      showHideButtons('flavor_profiling');
    });

  $("#btn_new_products img")
    .mouseover(function() { 
 	  var src = $(this).attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "");
  	  src = src + "_active.jpg";
      $(this).attr("src", src);
      showHidePanels('new_products');
      showHideButtons('new_products');
    });

  $("#btn_culinary_expertise img")
    .mouseover(function() { 
 	  var src = $(this).attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "");
  	  src = src + "_active.jpg";
      $(this).attr("src", src);
      showHidePanels('culinary_expertise');
      showHideButtons('culinary_expertise');
    });

  // our commitment slide show
  $('#commitment_ss').cycle({
	fx: 'scrollHorz',
	speed: 500,
    timeout: 0,
    startingSlide: 0,
    prev:    '.btn_next',
    next:    '.btn_prev'
  });

  //dyk cycle
  $('#dyk_cycle').cycle({
	fx: 'scrollHorz',
	speed: 500,
    timeout: 8000,
    startingSlide: 0
  });
  
  //dyk cycle
  $('#dyk_home_cycle').cycle({
	fx: 'scrollHorz',
	speed: 500,
    timeout: 8000,
    startingSlide: 0
  });
  
  // how can we help
  $("#btn_show_me").click(function(){
	if($("#sel_your_role").val() == 'Choose one') {
	  alert('Please select your role');
	}
	else if($("#sel_your_needs").val() == 'Choose one') {
      alert('Please select your needs');
    }
	else {
      location.href = "/" + $("#sel_your_needs").val();
	}
    return false;
  });
  
  // team panels
  $("#herb").hide();
  $("#liz").hide();
  $("#gary").hide();
  $("#lisa").hide();
  $("#michael").hide();
  $("#josh").hide();
  
  var teamMember = getParam('t');
  if(teamMember != ''){
	mgmtProfile(teamMember);
  }
}

function overState(src,activeSection,section) 
{
  if(activeSection != section) {
    return src.replace("_active.jpg", "").match(/[^\.]+/) + "_over.jpg";
  }
  else {
	return src;
  }
}

function outState(src,activeSection,section)
{
  if(activeSection != section) {
    return src.replace("_over", "");
  }
  else {
	return src;
  }
}

function showHidePanels(pPanel)
{
  $("#pnl_innovation").hide();
  $("#pnl_flavor_profiling").hide();
  $("#pnl_new_products").hide();
  $("#pnl_culinary_expertise").hide();
  $("#pnl_" + pPanel).show();
}

function showHideButtons(pImage)
{
  var btn_src = $("#btn_innovation img").attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "").match(/[^\.]+/) + "_inactive.jpg";
  $("#btn_innovation img").attr("src",btn_src);
  
  var btn_src = $("#btn_flavor_profiling img").attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "").match(/[^\.]+/) + "_inactive.jpg";
  $("#btn_flavor_profiling img").attr("src",btn_src);
  
  var btn_src = $("#btn_new_products img").attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "").match(/[^\.]+/) + "_inactive.jpg";
  $("#btn_new_products img").attr("src",btn_src);
  
  var btn_src = $("#btn_culinary_expertise img").attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "").match(/[^\.]+/) + "_inactive.jpg";
  $("#btn_culinary_expertise img").attr("src",btn_src);
  
  var btn_src = $("#btn_" + pImage + " img").attr("src").replace("_inactive.jpg", "").replace("_active.jpg", "").match(/[^\.]+/) + "_active.jpg";
  $("#btn_" + pImage + " img").attr("src",btn_src);
}

function mgmtProfile(pId)
{
  // hide all
  $("#matt").hide();
  $("#matt_p").removeClass('selected');
  $("#herb").hide();
  $("#herb_p").removeClass('selected');
  $("#gary").hide();
  $("#gary_p").removeClass('selected');
  $("#lisa").hide();
  $("#lisa_p").removeClass('selected');
  $("#liz").hide();
  $("#liz_p").removeClass('selected');
  $("#michael").hide();
  $("#michael_p").removeClass('selected');
  $("#josh").hide();
  $("#josh_p").removeClass('selected');
  
  // show selected
  $("#" + pId).show();
  $("#" + pId + "_p").addClass('selected');
}

function getParam( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null ) {
    return "";
  }
  else {
    return results[1];
  }
}
