// JavaScript Document

var quotes = ['Computer science is no more about computers than astronomy is about telescopes.|Edsger Dijkstra',
			   'If debugging is the process of removing software bugs, then programming must be the process of putting them in.|Edsger Dijkstra',
			   'A computer once beat me at chess, but it was no match for me at kick boxing.|Emo Philips',
			   'The Internet?  Is that thing still around?|Homer Simpson',
			   'Man is a slow, sloppy and brilliant thinker; the machine is fast, accurate and stupid.|William Kelly',
			   'On the negative side, I\'ve been getting charged for a ton of stuff I didn\'t order lately. On the positive side, I did win that "Who\'s Got the Best Password" contest on AOL last week.|Spike Donner',
			   'I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.|Bjarne Stroustrup',
			   'If the code and the comments disagree, then both are probably wrong.|Norm Schryer',
			   'Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.|Brian Kernighan',
			   'The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.|Tom Cargill',
			   'Java is to JavaScript what Car is to Carpet.|Chris Heilmann'];

quotes.sort(function() { return (0.5 - Math.random()); });
var fadeSpeed = 800;
var time = 8500;
var count = 0;

$(document).ready(function() {
	$('#quote').hide();
	$('#author').hide();	   
	rotateQuotes();
});

function rotateQuotes() {
	$('#quote').html('"'+quotes[count].split('|')[0]+'"').fadeIn(fadeSpeed);
	$('#author').html('- '+quotes[count].split('|')[1]).fadeIn(fadeSpeed);
	
	setTimeout(function() {
		$('#quote').fadeOut(fadeSpeed);
		$('#author').fadeOut(fadeSpeed,function() {
			count = ((count+1) >= quotes.length) ? 0 : count+1;
			rotateQuotes();
		});
	}, time);
}