
 var TextArea;
    var SubmitButton;
        
    function ChangeEnter(submit_button_id)
    {
        if(submit_button_id)
        {
            SubmitButton = document.getElementById(submit_button_id)
        }
        
        
        if(event.keyCode==13) 
        {
            if(event.srcElement && event.srcElement.type && event.srcElement.type=="textarea")
            {
                return event.keyCode;
            }
            
            if(SubmitButton)
            {
               mustValidate=true;
               SubmitButton.focus();
               return false;         
            }

            else
            {
                try
                {
                    event.keyCode = 9;            
                }
                catch(e)
                {
                    event.srcElement.disabled = true;
                    event.srcElement.disabled = false;
                    event.srcElement.focus();
                    
                }
                return event.keyCode;
            }
        }
    }
    
   
    
    function setMyValue(obj, objContainerName)
    {
        objContainer = document.getElementById(objContainerName)
        objContainer.value = obj.value
    }

/*
  -------------------------------------------------------------------------
	                    JavaScript Form Validator 
                                Version 2.0.2
	Copyright 2003 JavaScript-coder.com. All rights reserved.
	You use this script in your Web pages, provided these opening credit
    lines are kept intact.
	The Form validation script is distributed free from JavaScript-Coder.com

	You may please add a link to JavaScript-Coder.com, 
	making it easy for others to find this script.
	Checkout the Give a link and Get a link page:
	http://www.javascript-coder.com/links/how-to-link.php

    You may not reprint or redistribute this code without permission from 
    JavaScript-Coder.com.
	
	JavaScript Coder
	It precisely codes what you imagine!
	Grab your copy here:
		http://www.javascript-coder.com/
    -------------------------------------------------------------------------  
*/

var errorMsgContainer;
var objBgColor = "#fffff0";
var messageType = "baloon";
var frName;
var pxWidth ="";
var mustValidate = true;

/* 
	This function is a Hack for the IE problem with the select element z-index
	wich is allways "on top of (almost) everything" even if you define the z-index of the
	element you want to keep over it with a higher value.
	
	The solution i found is to use the iframe element, the only one that select element can´t
	override, dinamically writing an iframe over the select, with the same position and dimensions,
	and defined as transparent.
	
	Remember to define the css property 'position' as 'relative' for the select element
	you want to hack, so the script can find the real position of it inside the page

*/


function validateCEP(cep)
{
    
    var CEPpattern = "^[0-9]{5}\-[0-9]{3}$";
    if(cep.match(CEPpattern))
    {
        
        return true;
    }
    else
    {
        return false;
    }
}


function ShowHackComboVisibility(obj)
{


	if(document.all)
	{
		correctIframe = document.getElementById("ifr_correct");
		correctIframe.style.display = "block";
		correctIframe.style.top = obj.style.top;
		correctIframe.style.left = (obj.offsetLeft+13)+"px";
		correctIframe.style.width = (obj.offsetWidth-13)+"px";
		correctIframe.style.height = obj.offsetHeight;

	}
	
}

function HideHackComboVisibility()
{
	if(document.all)
	{
		correctIframe = document.getElementById("ifr_correct");
		correctIframe.style.display = "none";
	}
}

function writeHackIframe()
{

		strIframe = "<iframe ";
		strIframe += "id='ifr_correct' ";
		strIframe += "style='";
		strIframe += "z-index: 1000; ";
		strIframe += "position:absolute; ";
		strIframe += "top:0px; ";
		strIframe += "left:0px; ";
		strIframe += "width:0px; ";
		strIframe += "height: 20px; ' ";
		strIframe += "frameborder='0' scrolling='no'></iframe>";
		
		
		document.write(strIframe);
		correctIframe = document.getElementById("ifr_correct");
		iframeDoc = correctIframe.contentWindow.document;
		iframeDoc.open();
		iframeDoc.write("<body style='background-color: transparent'></body>");
		iframeDoc.close();

}

function CountWords(obj)
{
    var y=obj.value;
    var r = 0;
    a=y.replace('\n',' ');
    a=a.split(' ');
    for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
    
    return r;
}

function verificaCheck(radio) {
	
	marcado = false;
	for (i=0; i<radio.length; i++) {
		if (radio[i].checked) {
			marcado = true;
		}
	}

	return marcado;
}

function Validator(frmname, customObjBgColor, customMessageType)
{
    
	if (customObjBgColor)
	{
		objBgColor = customObjBgColor;
	}
	
	
	

	if(!document.getElementById('errorMsgContainer'))
	{
	    strContainer = "";
	    strContainer +="<div align='center' id='errorMsgContainer' style='position:absolute; display: none; z-index: 1001; text-align: left'>";
        strContainer +="<table cellpadding='0' cellspacing='0' border='0'>";
        strContainer +="<tr>";
        strContainer +="<td width='14' class='box_balao_aba_bg' valign='top'><img src='_img/box_balao_aba.gif' alt='' width='14' height='14' vspace='13' border='0'></td>";
        strContainer +="<td class='box_balao_miolo'>";
        strContainer +="<table cellpadding='0' cellspacing='0' border='0'>";
        strContainer +="<tr>";
        strContainer +="<td width='35' valign='top'><img src='_img/box_balao_ico.gif' width='35' height='35' alt=''></td>";
        strContainer +="<td class='box_balao_cont' nowrap>";
        strContainer +="<span class='box_balao_cont_tit' id='containerTitulo'>Título</span>";
        strContainer +="<br />";
        strContainer +="<span id='containerTexto'></span>";
        strContainer +="</td>";
        strContainer +="<td width='9' valign='top'><a href='#' onClick='closeErrorMsgContainer(); return false'><img src='_img/box_balao_fecha.gif' width='9' height='8' alt='' align='right' border='0'></a></td>";
        strContainer +="</tr>";
        strContainer +="</table>";
        strContainer +="</td>";
        strContainer +="</tr>";
        strContainer +="</table>";
        strContainer +="</div>";
        
        document.write(strContainer);

	}

  	errorMsgContainer = document.getElementById('errorMsgContainer');
	
	if(customMessageType && customMessageType=='alert')	
	{
		messageType = "alert";
	}
	else
	{
	    writeHackIframe();
	}
	

	this.formobj=document.forms[frmname];
	if(!this.formobj)
	{
	  alert("BUG: O formulário "+frmname+" não foi encontrado!");
		return;
	}
	
	frName = this.formobj.name;
	
	if(this.formobj.onsubmit)
	{
	 this.formobj.old_onsubmit = this.formobj.onsubmit;
	 this.formobj.onsubmit=null;
	}
	else
	{
	 this.formobj.old_onsubmit = null;
	}
	this.formobj.onsubmit= form_submit_handler;
	this.addValidation = add_validation;
	this.clearValidation = clear_validation;
	this.clearValidations = clear_validations;
	this.setAddnlValidationFunction=set_addnl_vfunction;
	this.clearAllValidations = clear_all_validations;
}


function set_addnl_vfunction(functionname)
{
  this.formobj.addnlvalidation = functionname;
}


function clear_all_validations()
{
	for(var itr=0;itr < this.formobj.elements.length;itr++)
	{
		this.formobj.elements[itr].validationset = null;
	}
}

function clear_validation(itemname)
{
		this.formobj[itemname].validationset = null;
		releaseError(this.formobj[itemname])
		if(this.formobj[itemname].type == "text")
	    {
	        this.formobj[itemname].value = ""
	    }
	    if(this.formobj[itemname].tagName == "SELECT")
	    {
	        this.formobj[itemname].selectedIndex = 0
	    }
		
}

function clear_validations(itemnames)
{
    var arrayItens = itemnames.split("|");
     
    
    for(i=0; i<arrayItens.length; i++)
    {
        if(this.formobj[arrayItens[i]])
        {
		    this.formobj[arrayItens[i]].validationset = null;
		    releaseError(this.formobj[arrayItens[i]])
		    if(this.formobj[arrayItens[i]].type == "text")
		    {
		        this.formobj[arrayItens[i]].value = ""
		    }
		    if(this.formobj[arrayItens[i]].tagName == "SELECT")
		    {
		        this.formobj[arrayItens[i]].selectedIndex = 0
		    }
		}
    }
    
}

function resetEventTarget()
{
    
    form = document.getElementById(frName);
    form.__EVENTTARGET.value = ""
    mustValidate = true
    
}

function form_submit_handler()
{
    
    pxWidth ="";
    form = document.getElementById(frName);
    
    if(form.__EVENTTARGET && form.__EVENTTARGET.value.indexOf("ddl") > -1)
    {
        setTimeout("resetEventTarget()",3)
        return true;
    }
   
    if(mustValidate)
    {  
        mustValidate = false;
        
        for(var itr=0;itr < form.elements.length;itr++)
        {

	        if(form.elements[itr].validationset &&
           !form.elements[itr].validationset.validate())
	        {
	          return false;
	        }
        }
        if(form.addnlvalidation)
        {
    	
    	    
          str =" var ret = "+form.addnlvalidation+"()";
          eval(str);
        
            if(!ret)
            {
                return false;
            }
        }
        
        if(form.old_onsubmit)
        {
            str =" var ret2 = "+form.old_onsubmit+"()";
            eval(str);
        
            if(!ret2)
            {
                return false;
            }
        }
        
        window.scrollTo(0,0);
    }
    return true;
	
}


function add_validation(itemname,descriptor,errstr,itemLabel)
{
    
	//added a new param called itemLabel, for the cases where the name of your obj isn't the name u want to prompt
	// to your form users. You can set the param for ex.: itemname is 'txtFirstName' / itemLabel is 'First Name'
	// Added by Sandro Salles  - salles.contato@gmail.com
	// 02-14-2007 - Brasil

	if(!this.formobj)
	{
	  alert("BUG: O nome do formulário informado está incorreto!");
		return;
	}
	
	var itemobj = this.formobj[itemname];
    
    if(!itemobj.name)
    {
        itemobj = document.getElementsByName(itemname)
        alert(document.getElementsByName("rbCategoria").checked)
    }

    if(!itemobj)
	{
	  alert("BUG: O objeto "+itemname+" não existe!");
		return;
	}
	
	if(itemLabel)
	{
		itemobj.itemLabel = itemLabel;
	}
	else
	{
		itemobj.itemLabel = itemobj.name;

	}

	
	
	
	if(!itemobj.validationset)
	{
	  itemobj.validationset = new ValidationSet(itemobj);
	}

	itemobj.validationset.add(descriptor,errstr);
}


function ValidationDesc(inputitem,desc,error)
{
  this.desc=desc;
	this.error=error;
	this.itemobj = inputitem;
	this.validate=vdesc_validate;
}


function vdesc_validate()
{
               
 if(!V2validateData(this.desc,this.itemobj,this.error))
 {
    if(!this.itemobj.disabled && this.itemobj.style.visibility!="hidden" && this.itemobj.style.display!="none")
    {
        this.itemobj.focus();
    }
    	return false;
 }
 return true;
}


function ValidationSet(inputitem)
{

    this.vSet=new Array();
	this.add= add_validationdesc;
	this.validate= vset_validate;
	this.itemobj = inputitem;
}


function add_validationdesc(desc,error)
{
  this.vSet[this.vSet.length]= 
	  new ValidationDesc(this.itemobj,desc,error);
}


function vset_validate()
{
   for(var itr=0;itr<this.vSet.length;itr++)
	 {
	   if(!this.vSet[itr].validate())
		 {
		   return false;
		 }
	 }
	 return true;
}

function FormataCampo(Campo,teclapres,mascara){ 
//pegando o tamanho do texto da caixa de texto com delay de -1 no event 
//ou seja o caractere que foi digitado não será contado. 
strtext = Campo.value 
tamtext = strtext.length 
//pegando o tamanho da mascara 
tammask = mascara.length 
//criando um array para guardar cada caractere da máscara 
arrmask = new Array(tammask) 
//jogando os caracteres para o vetor 
for (var i = 0 ; i < tammask; i++){ 
arrmask[i] = mascara.slice(i,i+1) 
} 
//alert (teclapres.keyCode) 
//começando o trabalho sujo 
if (((((arrmask[tamtext] == "#") || (arrmask[tamtext] == "9"))) || (((arrmask[tamtext+1] != "#") || (arrmask[tamtext+1] != "9"))))){ 
if ((teclapres.keyCode >= 37 && teclapres.keyCode <= 40)||(teclapres.keyCode >= 48 && teclapres.keyCode <= 57)||(teclapres.keyCode >= 96 && teclapres.keyCode <= 105)||(teclapres.keyCode == 8)||(teclapres.keyCode == 9) ||(teclapres.keyCode == 46) ||(teclapres.keyCode == 13)){ 
Organiza_Casa(Campo,arrmask[tamtext],teclapres.keyCode,strtext) 
} 
else{ 
Detona_Event(Campo,strtext) 
} 
} 
else{//Aqui funcionaria a mascara para números mas eu ainda não implementei 
if ((arrmask[tamtext] == "A")) { 
charupper = event.valueOf() 
//charupper = charupper.toUpperCase() 
Detona_Event(Campo,strtext) 
masktext = strtext + charupper 
Campo.value = masktext 
} 
} 
} 
function Organiza_Casa(Campo,arrpos,teclapres_key,strtext){ 
if (((arrpos == "/") || (arrpos == ".") || (arrpos == ",") || (arrpos == ":") || (arrpos == " ") || (arrpos == "-")) && !(teclapres_key == 8)){ 
separador = arrpos 
masktext = strtext + separador 
Campo.value = masktext 
} 
} 
function Detona_Event(Campo,strtext){ 
event.returnValue = false 
if (strtext != "") { 
Campo.value = strtext 
} 
}  

function validateEmailv2(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    

    var splitted = email.match("^(.+)@(.+)$");

    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}


var objToValidate = null;

function raiseMessage(obj, strError)
{

    closeErrorMsgContainer();
    
    objToValidate = obj;
    
    if(messageType=='alert')	
	{
		alert(obj.itemLabel + "\n" + strError);
		obj.parentNode.style.backgroundColor = objBgColor;
		obj.parentNode.style.borderStyle = "solid";
		obj.parentNode.style.borderWidth = "1px";
		obj.parentNode.style.padding = "4px";
		obj.parentNode.style.paddingTop = "0px";
		window.scroll(0,obj.offsetTop-10);
		
	}
	else	
	{	
		strError = strError.replace("\n","<br />");
        obj.style.backgroundColor = objBgColor;
		errorMsgContainer.style.display = 'block';
		document.getElementById('containerTitulo').innerHTML = obj.itemLabel;
		document.getElementById('containerTexto').innerHTML = "<span style='font-style: italic; font-weight: normal'>" + strError + "</span>";
        
        
        pxFromTop = (obj.offsetTop + obj.offsetHeight) - (obj.offsetHeight) - 4;
        
        pxFromLeft = (obj.offsetLeft + obj.offsetWidth);
        
        if(pxWidth=="")
        {
            pxWidth = errorMsgContainer.offsetWidth;
        }

        if(navigator.appName.indexOf("Microsoft")!=-1)
        {
            pxClientWidth = (document.body.offsetWidth - 32);
        }
        else
        {
            pxClientWidth = (document.body.offsetWidth +5);
        }
        
        if((pxFromLeft + errorMsgContainer.offsetWidth)>pxClientWidth+2)
        {
            while((pxFromLeft + errorMsgContainer.offsetWidth)>pxClientWidth)
            {
                pxFromLeft--;
            }
        }
        
      
		errorMsgContainer.style.top = pxFromTop+"px";
		errorMsgContainer.style.left = pxFromLeft+"px";
		errorMsgContainer.style.width = pxWidth+"px";
		ShowHackComboVisibility(errorMsgContainer);
		window.scroll(0,errorMsgContainer.offsetTop-10);
	}

}

function releaseError(obj)
{
    if(messageType=='alert')	
	{
		obj.parentNode.style.backgroundColor = "";
		obj.parentNode.style.borderStyle = "";
		obj.parentNode.style.borderWidth = "";
		obj.parentNode.style.padding = "";
		obj.parentNode.style.paddingTop = "";
	}
	else
	{
        if(obj.style.backgroundColor = objBgColor)
        {
            obj.style.backgroundColor = "";
        }
        
        errorMsgContainer.style.width = "";
        
        if(errorMsgContainer.style.display =='block')
        {
            closeErrorMsgContainer();
        }   
        
        objToValidate = null;
    }
}

function closeErrorMsgContainer()
{
    HideHackComboVisibility();
    errorMsgContainer.style.width = "";
    errorMsgContainer.style.display = "none";
    pxWidth =""; 

    if(objToValidate && !objToValidate.disabled && objToValidate.style.visibility!="hidden" && objToValidate.style.display!="none")
    {
        objToValidate.focus();
    }
    
}

function V2validateData(strValidateStr,objValue,strError) 
{ 
    var epos = strValidateStr.search("="); 
    var  command  = ""; 
    var  cmdvalue = ""; 
    if(epos >= 0) 
    { 
     command  = strValidateStr.substring(0,epos); 
     cmdvalue = strValidateStr.substr(epos+1);
    } 
    else 
    { 
     command = strValidateStr; 
    } 
    switch(command) 
    { 
        case "req": 
        case "required": 
         { 
           valor =  objValue.value.replace(/\s/gi,"")
           
           if((eval(valor.length) == 0) || (valor == cmdvalue))
           { 
              objValue.value = "";
              
              if(!strError || strError.length ==0) 
              { 
                strError = "Preenchimento obrigatório"; 
              }//if 

	          raiseMessage(objValue, strError);
              return false; 

           }//if 
           
           releaseError(objValue);
           break;             

         }//case required 

        case "maxlength": 
        case "maxlen": 
          { 
             if(eval(objValue.value.length) >  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = "Este campo aceita no máximo "+cmdvalue+" caracteres";
  		 strError += "\n[Nº caracteres atual = " + objValue.value.length + " ]";
               }//if 
         
	           raiseMessage(objValue, strError);
               return false; 
             }//if 
             
             releaseError(objValue);
             break; 
          }//case maxlen 
        case "minlength": 
        case "minlen": 
           { 
             if(eval(objValue.value.length) <  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = "Este campo exige no mínimo " + cmdvalue + " caracteres"; 
		 strError += "\n[Nº caracteres atual = " + objValue.value.length + " ]";
               }//if               

    	       raiseMessage(objValue, strError);
               return false;                 
             }//if 
             break; 
            }//case minlen 
        case "alnum": 
        case "alphanumeric": 
           { 
              var charpos = objValue.value.search("[^A-Za-z0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = "Este campo permite apenas caracteres alfa-numéricos"; 
                }//if 
                
		//alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
		raiseMessage(objValue, strError);
                return false; 

              }//if 
              break; 
           }//case alphanumeric 
        case "num": 
        case "numeric": 
           { 
              var charpos = objValue.value.search("[^0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = "Este campo permite apenas números"; 
                }//if               
                
		//alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
		raiseMessage(objValue, strError);
                return false; 
              }//if 
              break;               
           }//numeric 
        case "alphabetic": 
        case "alpha": 
           { 
              var charpos = objValue.value.search("[^A-Za-z]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = "Este campo permite apenas letras"; 
                }//if                             
                
		//alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
		
		raiseMessage(objValue, strError);
                return false; 

              }//if 
              break; 
           }//alpha 
		case "alnumhyphen":
			{
              var charpos = objValue.value.search("[^A-Za-z0-9\-_()]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = "Os caracteres permitidos são: letras, números, hífens (-) e underscores (_)"; 
                }//if                             

                //alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 

		raiseMessage(objValue, strError);

                return false; 

              }//if 			
			break;
			}
        case "email": 
          { 
               if(!validateEmailv2(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = "O e-mail digitado está em um formato inválido"; 

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false; 

               }//if 
           break; 
          }//case email 
        case "lt": 
        case "lessthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+": O valor deve ser um número"); 
              return false; 
            }//if 
            if(eval(objValue.value) >=  eval(cmdvalue)) 
            { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : O valor deve ser menor que "+ cmdvalue; 
              }//if               
              alert(strError); 
              return false;                 
             }//if             
            break; 
         }//case lessthan 
        case "gt": 
        case "greaterthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+": O valor deve ser um número"); 
              return false; 
            }//if 
             if(eval(objValue.value) <=  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : O valor deve ser maior que "+ cmdvalue; 
               }//if               
               alert(strError); 
               return false;                 
             }//if             
            break; 
         }//case greaterthan 
        case "regexp": 
         { 
		 	if(objValue.value.length > 0)
			{
	            if(!objValue.value.match(cmdvalue)) 
	            { 
	              if(!strError || strError.length ==0) 
	              { 
	                strError = "Existem caracteres inválidos no valor informado"; 
	              }//if                                                               
	              raiseMessage(objValue, strError);
	              return false;                   
	            }//if 
			}
           break; 
         }//case regexp 
        case "dontselect": 
         { 
            if(objValue.selectedIndex == null) 
            { 
              alert("BUG: Defina o valor do elemento não selecionável"); 
              return false; 
            } 
            
            if(objValue.selectedIndex == eval(cmdvalue)) 
            { 
             if(!strError || strError.length ==0) 
              { 
                strError = "Por favor selecione uma opção"; 
              }//if                                                               
              
              raiseMessage(objValue, strError);
              return false;                                   
             } 
             break; 
         }//case dontselect
         
         case "compareTo": 
         { 
            objValueToCompare = document.getElementById(cmdvalue);
            
            if(objValue.value!=objValueToCompare.value)
            {
                if(!strError || strError.length ==0) 
                 { 
                    strError = "Este campo deve ser igual ao campo " + objValueToCompare.itemLabel; 

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }           
            
             break; 
         }//case compareTo
         
         case "validdate": 
         { 
            validDate ="^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$"
            
            if(!validDate.test(objValue.value))
            {
                if(!strError || strError.length ==0) 
                 { 
                    strError = "Este campo precisa conter uma data válida!";

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }           
            
             break; 
         }//case validdate
         
         case "checkbox":
         {
             if(!objValue.checked)
            {
                if(!strError || strError.length ==0) 
                 { 
                    strError = "Este campo precisa ser marcado";

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }           
            
             break; 
         }// case checkbox
         
         case "radio":
         {
            
            if(!verificaCheck(objValue))
            {
                if(!strError || strError.length ==0) 
                 { 
                    strError = "Por favor marque uma das opções";

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }
            
            break;
         }// case radio
         
         case "maxwords":
         {
            if(CountWords(objValue)>cmdvalue)
            {
                 if(!strError || strError.length ==0) 
                 { 
                    strError = "Este campo aceita no máximo " + cmdvalue + " palavras"; 
		            strError += "\n[Nº palavras atual = " + CountWords(objValue) + " ]";

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }
            
            break;
         }//case maxwords
         
         case "minwords":
         {
             if(CountWords(objValue)<cmdvalue)
            {
                 if(!strError || strError.length ==0) 
                 { 
                    strError = "Este campo exige no mínimo " + cmdvalue + " palavras"; 
		            strError += "\n[Nº palavras atual = " + CountWords(objValue) + " ]";

                 }//if    
                                           
                 raiseMessage(objValue, strError);
                 return false;
            }
            
            break;
         }// case minwords
         
         
         //
    }//switch 
    return true; 
}


/*
	Copyright 2003 JavaScript-coder.com. All rights reserved.
*/