nn=(document.layers)?true:false;
ie=(document.all)?true:false;
var shift = false;
var spanToggle = -1;

function keyDown(e)
{
	var evt=(e)?e:(window.event)?window.event:null;
	if(evt)
	{
		var key=(evt.charCode)?evt.charCode: ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
		window.status = key;
		if(key == 16)
		{
			shift = true;
		}
		if(shift && (key == 76))
		{
			showLogin();
		}
	}
}

function keyUp(e)
{
	shift = false;
}

function showLogin()
{
	document.getElementById('login').style['display'] = 'block';
}

document.onkeydown=keyDown;
document.onkeyup=keyUp;
if(nn)
{
	document.captureEvents(Event.KEYDOWN);
}

window.onload = function()
{
	if(document.getElementById('submitComment'))
	{
		commentForm = '		<form id="submitCommentForm" action="comment.php" method="post">\n';
		if(myUser == '')
		{
			commentForm+= '			<b>Name:</b><br/>\n';
			commentForm+= '			<input type="text" name="name"/><br/>\n';
			commentForm+= '			<b>Email:</b> (optional)<br/>\n';
			commentForm+= '			<input type="text" name="email"/><br/>';
		}
		
		commentForm+= '			<b>Comment:</b>\n';
		commentForm+= '			<textarea name="comment"></textarea><br/>\n';
		commentForm+= '			<input type="hidden" name="post" value="'+myEntry+'"/>\n';
		commentForm+= '			<input type="submit" name="submit" class="submit" value="Submit Comment"/>\n';
		commentForm+= '		</form>\n';
		
		commentText = '<h3>Submit a Comment</h3>\n';
		commentText+= commentForm;
		
		document.getElementById('submitComment').innerHTML = commentText;
		
		myDate = new Date();
		myTime = myDate.getTime();
		myKeyBase = myTime+'';
		
		newInput = document.createElement('input');
		newInput.type = 'hidden';
		newInput.name = 'postTime';
		newInput.value = myKeyBase;
		
		newInput2 = document.createElement('input');
		newInput2.type = 'hidden';
		newInput2.name = 'postKey';
		newInput2.value = hex_md5(myKeyBase);
		
		document.getElementById('submitCommentForm').appendChild(newInput);
		document.getElementById('submitCommentForm').appendChild(newInput2);
	}
}