function dologin(oForm) 
{
	if (oForm.username.value.length == 0 || oForm.password.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		return false;
	}
	else return true;
}

function doeditadmin(oForm) 
{
    var bReturn = true;
	if (oForm.pass1.value != oForm.pass2.value)
	{
		alert ('Your password and your confirmation do not match');
		bReturn = false;
	}
	if (oForm.name.value.length == 0 || oForm.email.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	
	return bReturn;
}

function doaddadmin(oForm) 
{
    var bReturn = true;
	if (oForm.pass1.value != oForm.pass2.value)
	{
		alert ('Your password and your confirmation do not match');
		bReturn = false;
	}
	if ((oForm.name.value.length == 0) || (oForm.email.value.length == 0) || (oForm.pass1.value.length == 0) || (oForm.pass2.length == 0))
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	
	return bReturn;
}

function doaddfaq(oForm) 
{
	if ((oForm.question.value.length == 0) || (oForm.answer.value.length == 0))
	{
		alert ('You did not fill in all required fields');
		return false;
	}
	else return true;
}

function doeditabout(oForm) 
{
    var bReturn = true;
	if (oForm.text.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	return bReturn;
}

function doaddnews(oForm) 
{
	if ((oForm.title.value.length == 0) || (oForm.message.value.length == 0))
	{
		alert ('You did not fill in all required fields');
		return false;
	}
	else return true;
}

function doeditfile(oForm) 
{
    var bReturn = true;
	if (oForm.title.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	return bReturn;
}

function doaddfile(oForm) 
{
    var bReturn = true;
	if (oForm.title.value.length == 0 || oForm.file.value.length == 0 ||  oForm.category.value == -1)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
    else
	{
		oForm.go.value = "Uploading... plz wait";
		oForm.go.disabled = true;
	}
	return bReturn;
}

function popup(url,target)
{
	w = screen.width*(3/4);
	h = screen.height*(3/4);
	l = (screen.width-w)/2;
	t = (screen.height-h)/2;
	widthHeight = "width="+680+",height="+450+",left="+l+",top="+t+",menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,location=no";
	window.open(url,target,widthHeight);
	return true
}

function openchat(oForm)
{
	if (oForm.nick.value.length == 0)
	{
		alert ('You have to fill in a nickname');
	}
	else
	{
		s = oForm.style.value + '?nick=' + oForm.nick.value;
		popup(s,'chatroom');
	}
	return false;
}


function doaddtrans(oForm) 
{
    var bReturn = true;
	if (oForm.username.value.length == 0 || oForm.file.value.length == 0 || oForm.userpass.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}

	if (oForm.file.value.substr(oForm.file.value.length-4,4) != '.lng' )
	{
		alert ('Your File extension MUST be \'.lng\'');
		bReturn = false;
	}

	if (bReturn)
	{
		oForm.go.value = "Uploading... plz wait";
		oForm.go.disabled = true;
	}
	return bReturn;
}

function doeditconfig(oForm) 
{
    var bReturn = true;
	if (oForm.name.value.length == 0 || oForm.description.value.length == 0 || oForm.example.value.length == 0)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	return bReturn;
}

function doaddconfig(oForm) 
{
    var bReturn = true;
	if (oForm.name.value.length == 0 || oForm.description.value.length == 0 || oForm.example.value.length == 0 ||  oForm.category.value == -1)
	{
		alert ('You did not fill in all required fields');
		bReturn = false;
	}
	return bReturn;
}
