// JavaScript Document

$(document).ready(function(){
	
	// This makes sure we display only 3 of the recent success stories
	var t = $('#testimonialsRotate p');
	var show = 3;
	var total = t.length;
	var start =Math.floor(Math.random()*(total-show));
	//alert(start);
	if(t.length>1){
		for(i=0; i<show; i++){
			//alert(t[start+i].id);
			$("#"+t[start+i].id).css('display','block');
		}
	}
	// This focuses input on form
	//$("input.focus:first").focus();
});

/*
$(document).ready(function(){
  $('a[href*=#]').click(function() {
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 && location.hostname == this.hostname) {
   var $target = $(this.hash);
   $target = $target.length && $target
   || $('[name=' + this.hash.slice(1) +']');
   if ($target.length) {
  var targetOffset = $target.offset().top;
  $('html,body')
  .animate({scrollTop: targetOffset}, 1000, 'easeOutBack');
    return false;
   }
 }
  });
});
*/

jQuery(function($){
	
	// TOC, shows how to scroll the whole window
	$('#nav2 a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 1500, {easing:'swing'});
		//$(this.hash).find('span.message').text( this.title );
		return false;
	});
	
});

//console.log('fired');
