//
// comments stuff
//

function comment_validate( commentsForm )
{
	if(document.form_comments.username.value.length <= 0)
	{
		alert("Please enter a username");
		document.form_comments.username.focus();
		return false;
	}
	
	
	if(document.form_comments.comments.value.length <= 0)
	{
		alert("Please enter a comment");
		document.form_comments.comments.focus();
		return false;
	}

	divObj = document.getElementById("pass");
	if( divObj.style.display != "none" )
	{
		if( document.form_comments.password.value.length <= 0 )
		{
			alert("Please enter your password");
			document.form_comments.password.focus();
			return false;
		}
	}

	return true;
}


function check_username()
{
	username = new String(document.form_comments.username.value);
	username = username.toLowerCase();
	if( username == "sikander" || username == "lunato" )
	{
		divObj = document.getElementById("pass");
		divObj.style.display = "";
		
		if( username == "lunato" )
		{	document.form_comments.website.value = "http://www.lunato.org/";	}
		else
		{	document.form_comments.website.value = "http://www.sikander.org/";	}
		
		document.form_comments.comments.focus();
	}
	else
	{
		divObj = document.getElementById("pass");
		divObj.style.display = "none";
		document.form_comments.website.value = 'http://';
	}
	
	if( username == "calidhuux" )
	{
		if( document.form_comments.website.value.length == 7 )
		{
			document.form_comments.website.value = "http://calidhuux.blogspot.com/";
			document.form_comments.comments.focus();
		}
	}
}


var commentsPopupWindow = null;
function comments_popup(urlToOpen)
{
	if( commentsPopupWindow != null && !commentsPopupWindow.closed )
		commentsPopupWindow.location.href = urlToOpen.toString();
	else
	{
		commentsPopupWindow = open( urlToOpen.toString(), "CommentsWindow","resizable=yes,scrollbars=yes,width=400,height=500,status=no,toolbar=no,menubar=no,location=no,fullscreen=no", true );
		
		if( commentsPopupWindow.opener == null )
			commentsPopupWindow.opener = self;
	}
	commentsPopupWindow.focus();
}


