function bdelete(id)
{
	url = "bdelete.php?id=" + id;
	did = "d" + id;
	
	if(confirm("Delete this post?"))
		window.location = url;
	else
		document.getElementById(did).checked = false;
}

function pdelete(id)
{
	url = "pdelete.php?id=" + id;
	did = "d" + id;
	
	if(confirm("Delete this post?"))
		window.location = url;
	else
		document.getElementById(did).checked = false;
}

function registerVal(thisform)
{
	with(thisform)
	{
		if(user.value.length < 4)
		{
			alert("Your username must be atleast 4 characters long.");
			return false;
		}
		if(pass.value.length < 4)
		{
			alert("Your password must be atleast 4 characters long");
			return false;
		}
		if(repass.value != pass.value)
		{
			alert("Your passwords do not match.");
			return false;
		}
		
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	    var address = email.value;
	    if(reg.test(address) == false) 
		{
	      alert('Invalid Email Address');
	      return false;
		}
	}
	return true;
}

function loginVal(thisform)
{
	with(thisform)
	{
		if(user.value.length < 4)
		{
			alert("Please enter your username.");
			user.focus();
			return false;
		}
		if(pass.value.length < 4)
		{
			alert("Please enter your password.");
			pass.focus();
			return false;
		}
	}
	return true;
}
