





$(document).ready(function(){
		
		$(".testimonial_full").hide();
		$(".testimonial_intro").show();
		$('a.toggleLink').click(function() {

			
			$(this).parent().prevAll('.testimonial_intro').toggle('fast');
			$(this).parent().prev('.testimonial_full').toggle('fast');
			$(this).toggleClass( 'selected' );
			// return false so any link destination is not followed
			return false;
			
			});	



$('.hybridnote').live('mouseover',function() {
   $(".hybridnote").tipTip({maxWidth: "300px", edgeOffset: 0,defaultPosition: "top"});
});	
		
		
		$(".hs").css("display","none");	
		$('#hs_region option:first').attr('selected', 'selected');
		$("#hs_div_region").css("display","block");	
		
		
		
		$("#hs_reset_form").click(function() {
		$("#hs_div_harvest").fadeOut();
		$("#hs_div_planting").fadeOut();
		$("#hs_results").fadeOut();	
		$('#hs_region option:first').attr('selected', 'selected');
		$('#hs_planting option:first').attr('selected', 'selected');
		$('#hs_harvest option:first').attr('selected', 'selected');					  
						  
		});	
		
		
		
		$("select#hs_region").change(function(){
				$("#hs_results").fadeOut();
				$.getJSON("/hybrid_selector/select_planting.php",{region:$(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$("#hs_planting").html(options);
					$('#hs_planting option:first').attr('selected', 'selected');
					$("#hs_div_planting").fadeIn('slow');
				})
				
			});
			
			
			$("select#hs_planting").change(function(){
				$("#hs_results").fadeOut();
				$.getJSON("/hybrid_selector/select_harvest.php",{plantingref:$(this).val(),region:$("#hs_region").val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$("#hs_harvest").html(options);
					$('#hs_harvest option:first').attr('selected', 'selected');
					$("#hs_div_harvest").fadeIn('slow');
					
				})
			});
		
		$("select#hs_harvest").change(function(){
				$.get("/hybrid_selector/select_results.php", {region:$("#hs_region").val(),plantingref:$("#hs_planting").val(),harvestref:$(this).val(),selectortype:$("#selector_type").val()},
				   function(data){
					 //alert("Data Loaded: " + data);					
					$("#hs_results").html(data);
					$("#hs_results").fadeIn('slow');
					$('#accordion .head').click(function() {
						$(this).next().toggle('fast');
						return false;
					})
					
				})
			});
			
			
			
		$("select#hs_region2").change(function(){
				$.get("/hybrid_selector/select_results.php", {region:$("#hs_region2").val(),selectortype:$("#selector_type").val()},
				  
				   	
				   function(data){
					//alert("Data Loaded: " + data);					
					$("#hs_results").html(data);
					$("#hs_results").fadeIn('slow');
					$('#accordion .head').click(function() {
						$(this).next().toggle('fast');
						return false;
					})
					
					
				})
			});
			
		
		
		


$('.hybridnote').live('mouseover',function() {
   $(".hybridnote").tipTip({maxWidth: "300px", edgeOffset: 0,defaultPosition: "top"});
});					

		
 });







