/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {
	
	//same as $(document).ready();
	$(function() {

	// used to display random facts
	var randomtip = function(selector){
	  var length = $(selector + " li").length;
	  var ran = Math.floor(Math.random()*length) + 1;
	  $(selector + " li:nth-child(" + ran + ")").show();
	};
	
	randomtip('#facts') // for facts
	randomtip('#testimonials') // for testimonials
		
		// used to show the live chat pop up
		$('.livechat').bind('click',function(e){popwindow(e)});
		function popwindow(e){
			e.preventDefault();
			var href=$(e.target).attr('href');
			window.open(href,'','menubar=0,location=0,toolbar=0,width=400,height=250');
		};		

	});

	$(window).load(function() {
		$('#slider').nivoSlider({
			effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
			animSpeed: 500, // Slide transition speed
			pauseTime: 8000, // How long each slide will show
			directionNav: true, // Next & Prev navigation
			directionNavHide: true, // Only show on hover
			controlNav: false, // 1,2,3... navigation
			pauseOnHover: true, // Stop animation while hovering
			captionOpacity: 1, // Universal caption opacity
			prevText: '<', // Prev directionNav text
			nextText: '>' // Next directionNav text
		});	
	});
	
})(jQuery);
