//a funcao isEmpty() encontra-se num arquivo externo
//msg_vnull: verifica se valor do campo é nulo e retorna mensagem 
//cv = nome do campo
//vv = valor do campo
//tp =  text | textarea | radio | select
function msg_vnull(cv,vv,tp)
{
/*
	switch (tp){		
		case 'text':
			if (isEmpty(vv.value))
				return "\n" + "O campo '" + cv + "' é obrigatório.";
				return " ";
		break;		
		case 'radio':
			var cont = 0;
			for(i=0;i<cv.length;i++){
				if(cv.checked == false) cont++;
			}
			if(cont == cv.length) return "\n" + "O campo '" + cv + "' é obrigatório.";
		break;		 

		case 'text':
			if (isEmpty(vv.value))
				return "\n" + "O campo '" + cv + "' é obrigatório.";
				return " ";
		break;
	}
//alert(vv.type);
*/

	args = msg_vnull.arguments;
	if(args[2] != null){
		switch(args[2]){		
			case 'text' :
				if (isEmpty(vv.value) || vv.value=='')
					return "\n- " + cv;
				return "";
				
			break;
			case 'textarea' :
				if (isEmpty(vv.value) || vv.value=='')
					return "\n- " + cv;
				return "";
			break;			
			case 'radio' :
				var cont = 0;
				for(i=0;i<vv.length;i++){
					if(vv[i].checked == false) cont++;
				}
				if(cont == vv.length) return "\n- " + cv;
					return "" ;
			break;
			case 'select' :
				if((vv.options.selectedIndex==0)||(vv.options[vv.options.selectedIndex].value==-1))
					return "\n- " + cv;
				return "";				
			break;
			default : return false;				
		}		
	}		
}