var DOM = YAHOO.util.Dom;
var EVT = YAHOO.util.Event;
var debug;

function lstFuncao(id){

var obj = document.getElementById("lst_funcao");

var serverPage ="lst_funcoes.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
  //obj.innerHTML="<img src='./sysimages/ajax-loader.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  
  
  if(xmlhttp.responseText){
    obj.innerHTML =xmlhttp.responseText;
    
  }
  
}
}
xmlhttp.send(null);

}

function lstLojas(id){

var obj = document.getElementById("lst_lojas");

var serverPage ="lst_lojas2.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
  //obj.innerHTML="<img src='./sysimages/ajax-loader.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  obj.innerHTML = xmlhttp.responseText;
  var lbl_lojas=document.getElementById("lbl_lojas");
  if(lbl_lojas.style.opacity=="0"){
     Effect.Appear("lbl_lojas", { duration: 1.0,from:0,to:1,afterFinishInternal:function (){lstFuncao(id);}});
  }else {
    Effect.Fade("lbl_lojas", { duration: 1.0,from:1,to:0,afterFinishInternal:function (){lstFuncao(id);}});
  }
}
}
xmlhttp.send(null);
}

var numbr=1;
var tipo="Appear";
var randBlc;
var blcDest=new Array();
function randomBloc(){


randBlc = self.setInterval(function (){

if(numbr!=blcDest.length-1){
  numbr++;
}else{
  numbr=1;
}





//Effect.BlindDown("not_dest", { duration: 1.0,from:0,to:1,afterFinishInternal:function (){Effect.Appear("not_dest", { duration: 14.0,from:1,to:1});}});
Effect.Appear("blc_img", { duration: 5.0,from:0.5,to:1,afterFinishInternal:function (){Effect.Fade("blc_img", { duration: 5.0,from:1,to:0.5});}});




imgBloco(blcDest[numbr]);
},"10000");
}

function imgBloco(id){


window.clearInterval(randBlc);


var obj = document.getElementById("blc_img");

var serverPage ="imgsBloco.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
  obj.innerHTML="<img src='./sysimages/ajax-loader.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  obj.innerHTML = xmlhttp.responseText;
  randomBloc();
}
}
xmlhttp.send(null);
}



function mostra_guia(id){


var obj = document.getElementById("det_catalogo");

var serverPage ="det_catalogo.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
//obj.innerHTML="<img src='./sysimages/loader2.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  obj.innerHTML = xmlhttp.responseText;
  
  var nr = document.getElementById("sq_cat" + id);
  
  var td = document.getElementsByTagName("td");
  
  for(i = 0; i <td.length; i++){
    	
        	if(td[i].className=="linksSel"){
    				  
              td[i].className="links";
      				td[i].onmouseover=mouseCat[1];
      				td[i].onmouseout=mouseCat[2];
          }
          
    	}
  
  if(nr!=null){
    nr.className='linksSel';
    nr.onmouseout=mouseCat[1];
  }
  
  
}
}
xmlhttp.send(null);
}


var direccao = "right";
var wndo;


//função de navegação no topo da página
function nav_scroll(sentido) {
   direccao= sentido;
   dw_scrollObj.initScroll('wn',sentido);

}
function continua(){
dw_scrollObj.initScroll('wn',direccao);
}

var numbr=1;
var tipo="Appear";
var randDest;
var prodDest=new Array();
function random_dest(){


randDest = self.setInterval(function (){

if(numbr!=prodDest.length-1){
  numbr++;
}else{
  numbr=1;
}
//alert(numbr);



Effect.Appear("td_promo", { duration: 5.0,from:1,to:1,afterFinishInternal:function (){Effect.Fade("td_promo", { duration: 5.0,from:1,to:1});}});



if(!isNaN(numbr)){
  
muda_img(prodDest[numbr],numbr);
  
}
},"10000");
}

function muda_img(id,key){





numbr=key;
if(numbr==1){
id=0;
}
if(debug==1){
alert(id);
}

window.clearInterval(randDest);


var obj = document.getElementById("td_promo");

var serverPage ="promoHome2.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
//obj.innerHTML="<img src='./sysimages/loader2.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  obj.innerHTML = xmlhttp.responseText;
  random_dest();
  var nr = document.getElementById("nr_" + id);
  var seta = document.getElementById("seta" + id);
  var td = document.getElementsByTagName("td");
  
  for(i = 0; i <td.length; i++){
    	
        	if(td[i].className=="nr_sel"){
    				  
              td[i].className="nr";
      				
          }
          if(td[i].className=="seta_sel"){
    				  
              td[i].className="seta";
      				
          }
    	}
  
  if(nr!=null){
    nr.className='nr_sel';
  }
  if(seta!=null){
    seta.className='seta_sel';
  }
  
}
}
xmlhttp.send(null);
}

function detalhe_estrutura(id){


var obj = document.getElementById("popup");
var obj2 = document.getElementById("popup_parent");
obj2.style.left='150px';
obj2.style.top='-450px';
obj.onmouseover=function(){arrastarJanela('popup_parent');return false;};
var serverPage ="popup.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1 ) {
//obj.innerHTML="<img src='./sysimages/loader2.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  obj.style.display='';
  obj.innerHTML = xmlhttp.responseText;
  
  
}
}
xmlhttp.send(null);
}

function arrastarJanela(id_prod) {

var obj = document.getElementById(id_prod);	
var handle = document.getElementById(id_prod).id;	
new Draggable(obj.id, {scroll:window,revert:false,ghosting:false,zindex:999,handle:handle});
document.getElementById(id_prod).style.cursor = "pointer";
	
}
/*var tamanho_total;


 var pos=0;

 $(document).ready(function(){
   tamanho_total=$("#prod").outerWidth();
   //$("div.headline:eq("+current_headline+")").css('top','5px');
  
 
   headline_interval = setInterval(headline_rotate,5000); //time in milliseconds
   $('#scroll').hover(function() {
     clearInterval(headline_interval);
   }, function() {
     headline_interval = setInterval(headline_rotate,5000); //time in milliseconds
     headline_rotate();
   });
  
 });
 
 function headline_rotate() {
   pos+=167;
   $("#prod").show().animate({left:-pos},"slow");  
   
   if(pos==tamanho_total){
   pos=0;
   $("#prod").show().animate({left:0},"slow"); 
   }
   
 }
*/


var OBJ;
var total;
var elem = new Array();
 function formErros(obj)
{
OBJ=obj;
total=obj.length;

var frmObj=OBJ.form;
objID=obj.id;

  
 elem = frmObj.elements;
 
  for(i = 0; i < elem.length; i++){
  
  if(elem[i].id==objID){
    document.getElementById(objID).style.borderColor="#FF0000";
    
    var lbl=document.getElementById("lbl_" + objID);
    
    if(lbl!=null){
       lbl.style.color="#FF0000";
    }
    
  }
  
  }





//for()

}

function showHide(id,id2){

  var obj=document.getElementById(id);
  var obj2=document.getElementById(id2);
  
  if(obj!=null){
  
    if(obj.style.display==''){
       obj.style.display='none';
    }else if(obj.style.display=='none'){
       obj.style.display='';
    }
    
     if(obj2.src== slocation +  '/sysimages/maisFaq.gif'){
       obj2.src=slocation + '/sysimages/menosFaq.gif';
    }else if(obj2.src==slocation + '/sysimages/menosFaq.gif'){
       obj2.src=slocation + '/sysimages/maisFaq.gif';
    }
    
  }

}



function faq_show(key){
  
   //this.className='tituloPergunta'; document.getElementById('imgmais').src='sysimages/menosFaq.jpg';
  
  var trf = document.getElementsByTagName("tr");
    
    	for(i = 0; i <trf.length; i++){
    	
        	if(trf[i].className=="degFaqSel"){
    				  
              trf[i].className="degFaq";
              
               var id2=trf[i].id.split("pergunta");
				       id2=parseInt(id2[1]);
				      
               if(!isNaN(id2)){
              
              trf[i].onmouseover=faqsMouseOver[id2];
					    trf[i].onmouseout=faqsMouseOut[id2];
					    
					    }
      				
          }
          if(trf[i].className=="degFaqHover"){
    				  
              trf[i].className="degFaq";
              
               var id2=trf[i].id.split("pergunta");
				       id2=parseInt(id2[1]);
				      
               if(!isNaN(id2)){
              
              trf[i].onmouseover=faqsMouseOver[id2];
					    trf[i].onmouseout=faqsMouseOut[id2];
					    
					    }
      				
          }
          
        	if(trf[i].className=="respostas_show"){
    				  
              trf[i].className="respostas_hide";
      				
          }
    	}
   var tdf = document.getElementsByTagName("td");
    
    	for(i = 0; i <tdf.length; i++){
    	
        	if(tdf[i].className=="tituloFaqSel"){
    				  
              tdf[i].className="tituloFaq";
      				
          }
        
    	} 	
    	
   var imgsF = document.getElementsByTagName("img"); 	
   
   
   for(i = 0; i <imgsF.length; i++){
    	
        	if(imgsF[i].className=="imgFaqMinus"){
    				  
              imgsF[i].className="imgFaqPlus";
              imgsF[i].src="sysimages/maisFaq.jpg";
      				
          }
    } 	

  var tr_faq1 = document.getElementById("pergunta" + key);
  tr_faq1.className = tr_faq1.className.replace('degFaq','degFaqSel');
	//tr_faq1.style.display="none";
	
	tr_faq1.onmouseover=faqsMouseOver[key];
	tr_faq1.onmouseout=faqsMouseOver[key];
	
	var tr_faq2 = document.getElementById("perguntaEscondida" + key);
	tr_faq2.className = tr_faq2.className.replace('_hide','_show');
	
	var img_faq3 = document.getElementById("imgFaq" + key);
	img_faq3.src="sysimages/menosFaq.jpg";
	img_faq3.className='imgFaqMinus';
	
	var td_faq1 = document.getElementById("titFaq" + key);
	td_faq1.className = "tituloFaqSel";

}

var jpesq;

function verifica_pesq(form) {

var txt=document.getElementById("valor_pesq");
var texto = txt.value;
var error;

  if((txt.value=="") || (txt.value==unescape(jpesq[1]))){
      alert(unescape(jpesq[2]));
      error=1;
  }else if(txt.value!="" &&  texto.length<3){
      alert(unescape(jpesq[3]));
      error=2;
      //return false;
  }

  if((txt.value!=unescape(jpesq[1])) && (texto.value!="") && (texto.length>=3)){
     error=0;
     //document.getElementById(form).submit();
      
  }
  
  if(error>0){
    return false;
  }else {
    return document.getElementById(form).submit();
  }
  
  
}

function findPos(obj) {
	var curleft = curtop = 0;

  if (obj.offsetParent) {

  do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
  } while (obj = obj.offsetParent);
  
  return [curleft,curtop];
  }
}
  
function SubMNP(key,tipo){
  
  var obj = document.getElementById("subp_" + key);
  var mn =document.getElementById('lnk_'+ key);
  
 //alert(obj.id);
  if(obj!=null ){
     if(tipo==1 ){
        obj.style.display='block';
        if(mn.className!=clssHover){
          mn.className=clssHover;
        }else {
          mn.className=clssHover;
        }

var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if ((browser=="Microsoft Internet Explorer")&& (version<=6))
  {
      var shimobject = document.getElementById("iframe_shim");
      var objMN = document.getElementById("tblSP_" + key);
      var pos = findPos(objMN);
      
      if(shimobject!=null){
      shimobject.style.display='block';
      shimobject.style.width=(obj.offsetWidth+350)+"px"
      shimobject.style.height=(objMN.offsetHeight+350)+"px"
      shimobject.style.left=pos[0];
      shimobject.style.top=pos[1];
      }  
  } 
       
       
     }else if(tipo==0 ){
        obj.style.display='none';
        
        if(mn.className!=clssNormal){
          mn.className=clssNormal;
        }
        
  var browser=navigator.appName;
  var b_version=navigator.appVersion;
  var version=parseFloat(b_version);
  if ((browser=="Microsoft Internet Explorer")&& (version<=6))
  {
      var shimobject = document.getElementById("iframe_shim");
      if(shimobject!=null){
        shimobject.style.display='none';
      }  
  }
        
     }else if(tipo==2 ){
        obj.style.display='none';
        
        if(mn.className!=clssSel){
          mn.className=clssSel;
        }
      
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if ((browser=="Microsoft Internet Explorer")&& (version<=6))
  {
      var shimobject = document.getElementById("iframe_shim");
      if(shimobject!=null){
        shimobject.style.display='none';
      }  
  }
        
     }
     
  }
  
}
var sp = new Array();
function subMN (idp,key,tipo){

  
  var middle = document.getElementById("middle_"+ idp + "_" + key );
  var seta = document.getElementById("seta_"+ idp + "_" + key );
  var slnk = document.getElementById("lnk_"+ idp + "_" + key);
  
  
  //middle.style.backgroundColor='#C5D7ED';
  if(tipo==1){
  
    if(middle!=null){
      middle.style.backgroundColor='#C5D7ED';
      middle.style.borderLeft="1px solid #9BBAE1";
      middle.style.borderRight="1px solid #C5D7ED";
      middle.style.borderTop="1px solid #9BBAE1";
      middle.style.borderBottom="1px solid #9BBAE1";
    }
    if(seta!=null){
    seta.src='sysimages/setamenu.gif';
    }
    slnk.style.color='#365F9A';
    slnk.style.textDecoration="underline";
    
    
  }else if(tipo==4){
    
    
    var subp =document.getElementById("subp_" + idp);
    //alert(subp.style.display);
    
    if(middle!=null){
      middle.style.backgroundColor='#C5D7ED';
      middle.style.borderLeft="1px solid #9BBAE1";
      middle.style.borderRight="1px solid #C5D7ED";
      middle.style.borderTop="1px solid #9BBAE1";
      middle.style.borderBottom="1px solid #9BBAE1";
    }
    if(seta!=null){
    seta.src='sysimages/setamenu.gif';
    }
    slnk.style.color='#365F9A';
    slnk.style.textDecoration="underline";
    
    var sp = document.getElementById("sp_"+ idp + "_" + key );
    if(sp!=null){
      sp.style.display='block';
    }
   
     if(idp==206 || idp==205 ){
     
      var objS3=document.getElementById("sp_"+idp+"_"+key);
      if(objS3!=null){
        
        objS3.style.marginLeft="-385px";
      }
    }
    
    
  
  }else if(tipo==5){
    
    
    
    if(middle!=null){
      middle.style.backgroundColor='#C5D7ED';
      middle.style.borderLeft="1px solid #9BBAE1";
      middle.style.borderRight="1px solid #C5D7ED";
      middle.style.borderTop="1px solid #9BBAE1";
      middle.style.borderBottom="1px solid #9BBAE1";
    }
    if(seta!=null){
    seta.src='sysimages/setamenu.gif';
    }
    slnk.style.color='#365F9A';
    slnk.style.textDecoration="underline";
    
    var sp = document.getElementById("sp_"+ idp + "_" + key );
    if(sp!=null){
      sp.style.display='block';
    }
   
     
      
      var objS3=document.getElementById("sp_"+idp+"_"+key);
      if(objS3!=null){
        
        objS3.style.marginLeft="-385px";
      }
    
    
    
  
  }else if(tipo==0){
    
    if(middle!=null){
      middle.style.backgroundColor='';
      middle.style.borderLeft="1px solid #FFFFFF";
      middle.style.borderRight="1px solid #FFFFFF";
    
      if(key!=1){
        middle.style.borderTop="1px solid #FFFFFF";
      }else {
        middle.style.borderTop="none";
      }
    
      if(key!=totalSUBP[idp]){
        middle.style.borderBottom="1px solid #BED2EB";
      }else {
        middle.style.borderBottom="none";
      }
    }
    if(seta!=null){
    seta.src='sysimages/setamenu2.gif';
    }
    slnk.style.color='#6A6A59';
    slnk.style.textDecoration="none";
    
    var sp = document.getElementById("sp_"+ idp + "_" + key );
    if(sp!=null){
      sp.style.display='none';
    }
    
    if(idp==206 || idp==205){
    
      var objS3=document.getElementById("sp_"+idp+"_"+key);
      if(objS3!=null){
        objS3.style.marginLeft="-385px";
      }
    
    }
    
    
  }else if(tipo==3){
  
    if(middle!=null){ 
      middle.style.backgroundColor='#ECF2F9';
      middle.style.borderLeft="1px solid #ECF2F9";
      middle.style.borderRight="1px solid #ECF2F9";
    
      if(key!=1){
        middle.style.borderTop="1px solid #FFFFFF";
      }else {
        middle.style.borderTop="none";
      }
    
      if(key!=totalSUBP[idp]){
        middle.style.borderBottom="1px solid #BED2EB";
      }else {
        middle.style.borderBottom="none";
      }
    }
     slnk.style.color='#6A6A59';
    slnk.style.textDecoration="none";
    
    if(seta!=null){
    seta.src='sysimages/setamenu.gif';
    }
    var sp = document.getElementById("sp_"+ idp + "_" + key );
    if(sp!=null){
      sp.style.display='none';
    }
    
    
  }
}




function mostra_tab (id){

 var divs = document.getElementsByTagName("div");
 var as = document.getElementsByTagName("a");   
    	for(i = 0; i <divs.length; i++){
    	
      	if(divs[i].className=="tabShow"){
  			   divs[i].className="tabHide";
      	}
        
      }
      
      for(i = 0; i <as.length; i++){
    	
        if(as[i].className=="mntab_sel"){
  			   as[i].className="mntab";
      	}  
      }
      
      var objTab1=document.getElementById("tabPrd" + id);
      var objTab2=document.getElementById("mnTab" + id);
      
      if(objTab1!=null){
         objTab1.className='tabShow';
      }
      if(objTab2!=null){
         objTab2.className='mntab_sel';
      }
      
      //document.getElementById("tabPrd" + id).className='tabShow';
      //document.getElementById("mnTab" + id).className='mntab_sel';
}


function validate_form(_obj,lg){
		
		var errors = false;
		if (lg=='pt'){
      var txt_erro = 'Preenchimento obrigatório.';
      var txt_erro2 = 'E-mail incorrecto.';
    } else if (lg=='gb'){
      var txt_erro = 'Mandatory field.';
      var txt_erro2 = 'Invalid E-mail.';
    } else if (lg=='sp'){
      var txt_erro = 'Campo obligatorio.';
      var txt_erro2 = 'E-mail incorrecto.';
    }
    
		DOM.getElementsByClassName(
			'required',
			null,
			_obj,
			function(e){
				
				var formName=_obj.name;
				
				var _tag  = e.tagName;
				var _type = e.getAttribute('type');
				var _emai = e.getAttribute('email');

				if(_tag == 'TEXTAREA' || _type == 'text'){

					if(e.value == '' || e.value == txt_erro){
            
            
            if(formName=="frmCand" && (e.name=='B3' || e.name=='B5' || e.name=='B6' || e.name=='B7' || e.name=='B9' || e.name=='B11' || e.name=='B12' || e.name=='B13' || e.name=='B14' || e.name=='B15' || e.name=='B16' || e.name=='B60[]')){ showOC('submenuIP','btIP');}
					else if (formName=="frmCand" && (e.name=='B1' || e.name=='B2' || e.name=='B70')){ showOC('submenuG','btG');}
          else if (formName=="frmCand" && (e.name=='B32' ||e.name=='B33' || e.name=='B34' || e.name=='B35' || e.name=='B36' || e.name=='B37' || e.name=='B38' || e.name=='B41' || e.name=='B42' || e.name=='B43' || e.name=='B44' || e.name=='B45' || e.name=='B46' || e.name=='B47' || e.name=='B50' || e.name=='B51' || e.name=='B52' || e.name=='B53' || e.name=='B54' || e.name=='B55' || e.name=='B56')){ showOC('submenuEP','btEP');}
          else if (formName=="frmCand" && (e.name=='B22')){ showOC('submenuHA','btHA');} 
            
						e.style.border = '1px solid #FF0000';
						e.style.color  = '#FF0000';
						e.value = txt_erro;
						
						EVT.addListener(e, "focus", function(){ e.value = ''; });
						
						if(errors == false) errors = true;
						
					} else {
						e.style.border = '1px solid #CCCCCC';
						e.style.color  = '#ABAB9C';
					}
					
					if(_emai == 1){
						if(verify_email(e.value) == false){
							if(formName=="frmCand" && (e.name=='B3' || e.name=='B5' || e.name=='B6' || e.name=='B7' || e.name=='B9' || e.name=='B11' || e.name=='B12' || e.name=='B13' || e.name=='B14' || e.name=='B15' || e.name=='B16' || e.name=='B60[]')){ showOC('submenuIP','btIP');}
					else if (formName=="frmCand" && (e.name=='B1' || e.name=='B2' || e.name=='B70')){ showOC('submenuG','btG');}
          else if (formName=="frmCand" && (e.name=='B32' ||e.name=='B33' || e.name=='B34' || e.name=='B35' || e.name=='B36' || e.name=='B37' || e.name=='B38' || e.name=='B41' || e.name=='B42' || e.name=='B43' || e.name=='B44' || e.name=='B45' || e.name=='B46' || e.name=='B47' || e.name=='B50' || e.name=='B51' || e.name=='B52' || e.name=='B53' || e.name=='B54' || e.name=='B55' || e.name=='B56')){ showOC('submenuEP','btEP');}
				  else if (formName=="frmCand" && (e.name=='B22')){ showOC('submenuHA','btHA');}  
							e.style.border = '1px solid #FF0000';
							e.style.color  = '#FF0000';
							e.value = txt_erro2;
							
							EVT.addListener(e, "focus", function(){ e.value = ''; });
							
							if(errors == false) errors = true;
							
						} else {
							e.style.border = '1px solid #CCCCCC';
							e.style.color  = '#ABAB9C';
						}
					}
					
				} else if(_type == 'checkbox') {
					
					if(e.checked == false){
						e.checked = true;
						alert('Existem opções no formulário que foram activas.');
						if(errors == false) errors = true;
					}

				}else if(_type == 'radio') {
					
					if(e.checked == false){
						e.checked = true;
						if (formName=="frmCand" && (e.name=='B21')){ showOC('submenuG','btG');}
						alert('Existem opções no formulário que foram activas .');
						if(errors == false) errors = true;
					}

				} else if(_tag == 'SELECT') {
					
					
					if(e.value == 0 || e.value == ""){
					if(formName=="frmCand" && (e.name=='B3' || e.name=='B5' || e.name=='B6' || e.name=='B7' || e.name=='B9' || e.name=='B11' || e.name=='B12' || e.name=='B13' || e.name=='B14' || e.name=='B15' || e.name=='B16' || e.name=='B60[]')){ showOC('submenuIP','btIP');}
					else if (formName=="frmCand" && (e.name=='B1' || e.name=='B2' || e.name=='B70')){ showOC('submenuG','btG');}
          else if (formName=="frmCand" && (e.name=='B32' ||e.name=='B33' || e.name=='B34' || e.name=='B35' || e.name=='B36' || e.name=='B37' || e.name=='B38' || e.name=='B41' || e.name=='B42' || e.name=='B43' || e.name=='B44' || e.name=='B45' || e.name=='B46' || e.name=='B47' || e.name=='B50' || e.name=='B51' || e.name=='B52' || e.name=='B53' || e.name=='B54' || e.name=='B55' || e.name=='B56')){ showOC('submenuEP','btEP');}
					else if (formName=="frmCand" && (e.name=='B22')){ showOC('submenuHA','btHA');} 
						e.style.border = '1px solid #FF0000';
						e.style.color  = '#FF0000';
						//e.value = txt_erro2;
						if(errors == false) errors = true;
					}else {
            	e.style.border = '1px solid #CCCCCC';
							e.style.color  = '#ABAB9C';
          }

				}
				
			}
		);
		
		if(errors == true){
			return false;
		} else {
			return true;
		}
		
	}
	
	function verify_email(_mail){
		
		var status = false;     
		var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
		
		if (_mail.search(emailRegEx) == -1) {
			status = false;
		} else {
			status = true;
		}
		     
		return status;

	}
	
	function showOC(id,bt) {

  var el = document.getElementById(id);
  var botao = document.getElementById(bt);
  var cclasse =  document.getElementsByTagName("a");
  var xclose = document.getElementsByTagName("div");
  
  for (var i=0; i<cclasse.length; i++) {
    if (cclasse[i].className == "linksOESel"){
      cclasse[i].className = "linksOE";
    }
  }
  
  for (var i=0; i<xclose.length; i++) {
    if (xclose[i].className == "submenuOE"){
      xclose[i].style.display = "none";
    }
  }

  el.style.display = "block";
  botao.className = "linksOESel";
}

