function totallyRandom(myArray){
	var i = myArray.length;
	if (i==0) return false;
	while (--i) {
		var j = Math.floor(Math.random() * (i+1));
		var tempi = myArray[i];
		var tempj = myArray[j];
		myArray[i]=tempj;
		myArray[j]=tempi;
	}
}

var delay = 1500; // you can change it
var count = 64; // How much items to animate
var showing = 3; //How much items to show at a time
var startOut = -3;

function move(startOut) {
	return function() {
		$('#feed'+startOut).remove().css('display', 'none').prependTo('#appointmentPaneWrap');
	}
}

function shift() {
	var toShow = (startOut + showing) % count;
	
	$('#feed'+toShow).slideDown(1000, move(startOut));
	$('#feed'+startOut).slideUp(1000, move(startOut));
	startOut = (startOut + 1) % count;
	setTimeout('shift()', delay);
	console.log($("#appointmentPaneWrap div").get());
}

$.metadata.setType("attr", "validate");

$(document).ready(function() {
	$("#promoLeftPic").rotate({
		length: 7500,
		speed: 2500
	});
	$("#promoTestimonials").rotate({
		length: 9000
	});
	$("#topnavWrap").menuHover("topnavWrap");
	setTimeout('shift()', 1000);
	/* $("#appointmentPaneWrap").jScrollPane({
		showArrows: true,
		verticalGutter: 6
	}); */
	
	$("#contactForm").validate();
	
	var timeStamp = new Date().getTime();
	$('<input type="hidden" name="timestamp" value="'+ timeStamp +'" />').appendTo('form#contactForm fieldset');

	
	

});



/*

	jQuery(function() {
		// show a simple loading indicator
		var loader = jQuery('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
			.css({position: "relative", top: "1em", left: "25em"})
			.appendTo("body")
			.hide();
		jQuery().ajaxStart(function() {
			loader.show();
		}).ajaxStop(function() {
			loader.hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});
		
		var v = jQuery("#form").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#result"
				});
			}
		});
		
		jQuery("#reset").click(function() {
			v.resetForm();
		});
	});


*/
