/*

Hello TheDailyWTF!

Yes this is horribly bad - I'm sorry :(

function checkUpdates() {
	stamp = new Date();
	$.getJSON('/includes/ajax/troll.php?time=' + stamp.getTime(), function(data) {
		updateReceived(data);
	});
}

function updateReceived(data) {
	if ($('div#troll:hidden')) {
		if (data.content != null) {
			$('div#troll a.text').text(data.content);
			$('div#troll div.text').css('display', 'block');
			$('div#troll div.html').css('display', 'none');
			$('div#troll-outer').css('display', 'block');
			$('div#troll').attr('rel', data.id);
			$('div#troll input#troll_reply').attr('value', 'Send a reply...');
			$('div#troll input#troll_reply').css('color', '#bcbcbc');
		} else {
			setTimeout("checkUpdates()", 10000);
		}
	}
}


$(document).ready(function() {
	// Enable troll outer div after everything has been loaded
	//$('body').html($('body').html() + 
	document.body.innerHTML = 
	'	<div id="troll-outer">' +
	'		<div id="troll">' +
	'			<div class="text left">' +
	'				<div class="right">' +
	'					<div class="top">' +
	'						<div class="bottom">' +
	'							<div class="header">' +
	'								<a class="close" href="#">(Close without replying X)</a>' +
	'							</div>' +
	'							<table>' +
	'								<tr>' +
	'									<td>' +
	'										<p class="live">Live Message from Ling</p>' +
	'										<img src="http://images.lingscars.com/images/wait.gif" />' +
	'										<p class="ling">Wah!</p>' +
	'									</td>' +
	'									<td>' +
	'										<div class="overflow">' +
	'										<p class="text"><a class="left speech">"</a><a class="text"></a><a class="right speech">"</a><span>- Ling</span></p>' +
	'										</div>' +
	'										<div class="reply">' +
	'											<form>' +
	'												<input type="text" id="troll_reply" value="Send a reply..." />' +
	'												<input type="submit" class="submit" id="troll_submit" value="Send" />' +
	'											</form>' +
	'										</div>' +
	'									</td>' +
	'								</tr>' +
	'							</table>' +
	'							<div class="footer">' +
	'								I monitor LINGsCARS on a live basis.' +
	'							</div>' +
	'						</div>' +
	'					</div>' +
	'				</div>' +
	'			</div>' +
	'			<div class="html left">' +
	'				<div class="right">' +
	'					<div class="top">' +
	'						<div class="bottom">' +
	'							<div class="header">' +
	'								<a class="close" href="#">(Close X)</a>' +
	'							</div>' +
	'							<div class="inner">' +
	'							' +
	'							</div>' +
	'						</div>' +
	'					</div>' +
	'				</div>' +
	'			</div>' +
	'		</div>' +
	'		<div id="troll_chat">' +
	'			<div id="troll_log">' +
	'				<ul></ul>' +
	'			</div>' +
	'			<form>' +
	'				<input type="text" name="troll_message" />' +
	'				<input type="submit" value="Send" />' +
	'			</form>' +
	'		</div>' +
	'	</div>' + document.body.innerHTML;

	$('#troll .header a.close').click(function() {
		$.getJSON('/includes/ajax/troll.php?read=' + $('#troll').attr('rel'), function(data) {
			$('#troll-outer').css('display', 'none');
			updateReceived(data);
		});
		return false;
	});
	$('#troll input#troll_reply').focus(function() {
		if ($('#troll input#troll_reply').attr('value') == 'Send a reply...') {
			$('#troll input#troll_reply').attr('value', '');
			$('#troll input#troll_reply').css('color', '#000');
		}
	});
	$('#troll input#troll_reply').blur(function() {
		if ($('#troll input#troll_reply').attr('value') == '') {
			$('#troll input#troll_reply').attr('value', 'Send a reply...');
			$('#troll input#troll_reply').css('color', '#bcbcbc');
		}
	});
	$('#troll form').submit(function() {
		$.getJSON('/includes/ajax/troll.php?read=' + $('#troll').attr('rel') + '&' + 'reply=' + escape($('#troll input#troll_reply').attr('value')), function(data) {
			$('#troll-outer').css('display', 'none');
			updateReceived(data);
		});
		return false;
	});
	
	checkUpdates();
});
*/
