function ValidateTextReq (ptxtText, psName, piLongMin, piLongMax)
{
	if (ptxtText.value.length<=0)
	{
		alert('El camp \'' + psName + '\' és obligatori.');
		ptxtText.focus();
		return(false);
	}
	else if ((ptxtText.value.length<piLongMin) || (ptxtText.value.length>piLongMax))
	{
		alert('El format pel camp \'' + psName + '\' ha de ser una cadena de ' + piLongMin + ' a ' + piLongMax + ' caràcters.');
		ptxtText.focus();
		return(false);
	}
	else
	{
		return(true);
	}	
}


function ValidateNumberReq (ptxtText, psName, piMin, piMax)
{
	if (ptxtText.value.length<=0)
	{
		alert('El camp \'' + psName + '\' és obligatori.');
		ptxtText.focus();
		return(false);
	}
	else if ((isNaN(ptxtText.value)) || (ptxtText.value<piMin) || (ptxtText.value>piMax))
	{
		alert('El format pel camp \'' + psName + '\' ha de ser un número entre ' + piMin + ' i ' + piMax + '.');
		ptxtText.focus();
		return(false);
	}
	else
	{
		return(true);
	}
}


function ValidateEmailReq (ptxtText, psName, piLongMax)
{
	if (ptxtText.value.length<=0)
	{
		alert('El camp \'' + psName + '\' és obligatori.');
		ptxtText.focus();
		return(false);
	}
	else if ((ptxtText.value.length<6) || (ptxtText.value.indexOf('@', 0)<0) || (ptxtText.value.indexOf('.', 0)<0))
	{
		alert('El format pel camp \'' + psName + '\' ha de ser un email debe ser un email vàlid.');
		ptxtText.focus();
		return(false);	
	}
	else
	{
		return(true);
	}
}


function ValidateComboReq (pcboCombo, psName)
{
	if (pcboCombo.selectedIndex<=0)
	{
		alert('El camp \'' + psName + '\' és obligatori.');
		pcboCombo.focus();
		return(false);
	}
	else if (pcboCombo.options[pcboCombo.selectedIndex].value.length<1)
	{
		alert('El camp \'' + psName + '\' és obligatori.');
		pcboCombo.focus();
		return(false);	
	}
	else
	{
		return(true);
	}
}


function ValidateNumber (ptxtTexto, psName, piMin, piMax)
{
	if (((ptxtTexto.value.length>0)) && ((isNaN(ptxtTexto.value) || (ptxtTexto.value<piMin) || (ptxtTexto.value>piMax))))
	{
		alert('El format pel camp \'' + psName + '\' ha de ser un número entre ' + piMin + ' i ' + piMax + '.');
		ptxtTexto.focus();
		return(false);
	}
	else
	{
		return(true);
	}
}

