jQuery.noConflict();     
jQuery(document).ready(function($){
	
// Testimonies feed

	var indicatorImg = '/Websites/nambmit/templates/mit/styles/images/loading.gif';// /Websites/nambmit/templates/mit/

	$('#testimonies').append('<img src="'+ indicatorImg +'" alt="loading..." class="indicatorIcon" />');

	$.getJSON("/utilities/httpsproxy.aspx?url=http://stories.mostimportantthing.com/TestimonyDeck", function(deck){
	
			$('#testimonies').html('<ul id="testimonies-feed"></ul>');
	
	          $.each(deck, function(i,item){
	            	$('#testimonies-feed').append('<li><p class="itemImage"><a href="http://stories.mostimportantthing.com'+ item.Url + '"><img src="http://stories.mostimportantthing.com/'+ item.Pic +'" alt="'+ item.Name +'"/></a></p><h3 class="itemName"><a href="http://stories.mostimportantthing.com'+ item.Url + '">'+ item.Name +'</a></h3><p class="itemDescription">'+ item.SampleText +'</p></li>');
					      if ( i == 19 ) return false;
	          		});
	        });
	
//Slider
	
	$("#testimoniesSlider").slider({
	  animate: true,
	  change: handleSliderChange,
	  slide: handleSliderSlide,
	  orientation: 'vertical',
	  value: 100
	});
	
	function handleSliderChange(e, ui)
	{  
	  var maxScroll = $("#testimonies").attr("scrollHeight") - $("#testimonies").height();
	  $("#testimonies").animate({scrollTop: (100-ui.value) * (maxScroll / 100) }, 1000);
	}
	function handleSliderSlide(e, ui)
	{
	  var maxScroll = $("#testimonies").attr("scrollHeight") - $("#testimonies").height();
	  $("#testimonies").attr({scrollTop: (100-ui.value) * (maxScroll / 100) });
	}
	
//replace any missing images with a transparent png
	
	$("img").error(function () {
		$(this).unbind("error").attr("src", "/Websites/nambmit/templates/mit/styles/images/blank.png");
	});

});// Doc Ready

function DoSearch(){
window.location = "http://nambmit.publishpath.com/?Key=Search&q=" + document.getElementById("searchTerms").value;
}
