// o hai
function toggleTranscript ()
{
	window.location.hash = (window.location.hash != '#transcript' ? '#' : window.location.hash);
	window.location.hash = (window.location.hash == '#transcript' ? '' : '#transcript');
	updateDisplay();
}
function updateDisplay ()
{
	window.location.hash = (window.location.hash != '#transcript' ? '#' : window.location.hash);
	document.getElementById('transcriptToggle').innerHTML = (window.location.hash != '#transcript' ? 'Transcript' : 'Comic');
	document.getElementById('viewport').innerHTML = document.getElementById(window.location.hash == '#transcript' ? 'viewportTranscript' : 'viewportImage').innerHTML;
}
function ace ()
{
	updateDisplay();

	function wasRated(element, memo)
	{
		new Ajax.Request(ratingUrl,
			{
				method: "get",
				parameters: memo,
				onComplete: function ()
				{
					//var indicator = event.element().down('.indicator');
					//var restore = indicator.innerHTML;
					//indicator.update('Thanks for voting');
					//window.setTimeout(function() { indicator.update(restore) }, 2000);
				},
				onFailure: function() { alert("bawww2"); }
				// onFailure: function() {alert(
				// onComplete: function() {;}
			}
		);
	}
	new Ajax.Request(ratingUrl,
		{
			method: "get",
			parameters: "",
			onComplete: function (transport)
			{
				transport.responseText.match(/^([0-9\.]+)\/([0-9\.]+)/);
				var average_rating = parseFloat(RegExp.$1);
				var rating_total = parseFloat(RegExp.$2);
				if (isNaN(average_rating))
				{
					average_rating = rating_total = 0;
				}
				new Starbox('rate', average_rating, { indicator: '#{average} rating from #{total} votes', total: rating_total, onRate: wasRated});
			},
			onFailure: function() { alert("bawww1"); }
			// onComplete: function() {;}
		}
	);
}
function random_ace ()
{
	var sl = document.getElementById('striplist');
	var randomComic = sl.options[sl.selectedIndex].value
	while (randomComic == sl.options[sl.selectedIndex].value)
	{
		var lastComic = sl.options[sl.options.length-1].value;
		var rand = Math.random();
		randomComic = Math.floor(rand * (lastComic))+1;
	}
	window.location = 'ace-'+randomComic+'.html';
}

var blinker = false;
function ace_blink ()
{
	blinker = clearInterval(blinker);
	blinker = setInterval(function ()
	{
		d = document.getElementById('alldiv');
		d.style.visibility = (d.style.visibility == 'hidden') ? 'visible' : 'hidden';
	}, 1000);
}
function ace_endpain ()
{
	blinker = clearInterval(blinker);
}

// kthxbai

