$(document).ready(function(){
	
	$("#innovation_network_tout").click(function(){
		$(this).hide();
		$("#innovation_network_fields").fadeIn();
		return false;
	});

	$("#innovation_network_tout_container form").submit(function(){
		var first_name = $.trim($("#tout_first_name").val());
		var last_name = $.trim($("#tout_last_name").val());
		if(first_name != "" && last_name !="")
		{
			$("#innovation_network_fields").hide();
			$("#innovation_network_thinking").show();
			$("#innovation_network_tout_container").load("/innovation_network/network_size/?side=true&first_name=" + first_name + "&last_name=" + last_name, function() {
				$(this).css("white-space", "normal");
				if (pageTracker) {
					pageTracker._trackEvent("Search", "Details Page Innovation Network Search", "Name", first_name + " " + last_name);
				}
				$("#innovation_network_tout_container").animate( { backgroundColor: 'yellow' }, 200).animate({backgroundColor: "#deecd9"}, 800);
			});
		}
		else
		{
			$("#tout_first_name, #tout_last_name").css("border", "solid red 1px");
		}
		return false;
	});
	
	if($("table.innovator_table tr").size() > 7)
	{
		//hide some contacts and give user ability to click to view more
		var inn_counter = 0;	
		$("table.innovator_table tr").each(function(){
			inn_counter++;
			if(inn_counter > 5)
			{
				$(this).css("display", "none");
			}
		});
		if(inn_counter > 5)
		{
			$("#view_more_container").show();
		}
	}
	
	$("#view_more_link").click(function(){
		$("table.innovator_table tr").each(function(){
			if($(this).is(":hidden")){$(this).show();}
		});
		$("#view_more_container").hide();		
		return false;		
	});
		

});