function goSite(){
	usedOptQuotes=new Array();
	optQuotes=new Array();
	$('.q').each(function(){ optQuotes.push($(this).html()); });

	$('#sources > a').attr('target', '_blank');

	$('#content').html('<div id="q_text"></div>');
	if(location.hash.match(/#quote[0-9]+$/))
		nextQuote(parseInt(location.hash.substring(6)));
	else
		nextQuote();
}

function nextQuote(next, neighbourgh){
	if(neighbourgh){
		if(location.hash.match(/#quote[0-9]+$/))
			var next=parseInt(location.hash.substring(6));
		else
			return;
		if(neighbourgh==1)
			next=next+1<optQuotes.length?next+1:0;
		else if(neighbourgh==-1)
			next=next>0?next-1:optQuotes.length-1;
	}
	if(!optQuotes[next]){
		if(usedOptQuotes.length==optQuotes.length)
			usedOptQuotes=new Array();
		do{
			var next=Math.floor(Math.random()*optQuotes.length);
//			window.status+=next+' ';
		} while(arraySearch(usedOptQuotes, next)!=-1);
		usedOptQuotes.push(next);
	}
	else{
		if(arraySearch(usedOptQuotes, next)==-1)
			usedOptQuotes[usedOptQuotes.length]=next;
	}

	$('#q_text').fadeOut('fast',
		function(){
			$(this).html(optQuotes[next]);
			$(this).fadeIn('slow');
		}
	);
	location.href='#quote'+next;
}

function arraySearch(haystack, needle){
	for(var i in haystack)
		if(haystack[i]==needle)
			return i;
	return -1;
}