function submenu(id) 
{
	if (document.getElementById('submenu'+id).style.visibility == "hidden")
	{
		document.getElementById('submenu'+id).style.visibility='visible';
		document.getElementById('submenu'+id).style.display='block';
		document.getElementById('mais'+id).innerHTML='-';
	} 
	else 
	{
	  document.getElementById('submenu'+id).style.visibility='hidden';
	  document.getElementById('submenu'+id).style.display='none';
	  document.getElementById('mais'+id).innerHTML='+';
	}
}

function Print(state){
   if (state == "p"){
        window.print();
   }
   window.close();
}

function OnlyNumbers() 
{
	if (event.keyCode < 48 || event.keyCode > 57)
	{ 
	  if (event.keyCode != 8)
	  {
	    event.returnValue = false;
	  }
	}
}


/*
 * Validando o cadastro da pre-inscricao dos cursos abertos
 *
*/
function ValidateRegistration (text, label, langId) {

  
   var texts  = text.split(';');
   var labels = label.split(';');
   
    
   
    for(i=0; i<=texts.length; i++){
        
        var ctl = document.getElementById(texts[i]);
         
         if (ctl.type == 'text'){
            var vl = ctl.value;
            if (vl.length == 0 && langId == "1"){
                alert("Campo obrigatorio: " + labels[i] + ".");
                ctl.focus();
                return false;
            }
            else {
            
                if (vl.length == 0 && langId == "2"){
                    alert("Required field: " + labels[i] + ".");
                    ctl.focus();
                    return false;    
                }
                else {
                    if (vl.length == 0){
                        alert("Campo requerido: " + labels[i] + ".");
                        ctl.focus();
                        return false;    
                    }
                }
            }
         
         }
            
         if (ctl.type == 'select-one'){
            var vl = ctl.options[ctl.selectedIndex].value;
            if (vl == "-1" && langId == "1"){
                alert("Campo obrigatorio: " + labels[i] + ".");
                ctl.focus();
                return false;
            }
            else {
            
                if (vl == "-1" && langId == "2"){
                    alert("Required field: " + labels[i] + ".");
                    ctl.focus();
                    return false;    
                }
                else {
                    if (vl == "-1"){
                        alert("Campo requerido: " + labels[i] + ".");
                        ctl.focus();
                        return false;    
                    }
                }
            }
         }
         
         if (ctl.type == 'textarea'){
            var vl = ctl.value;
            if (vl.length == 0 && langId == "1"){
                alert("Campo obrigatorio: " + labels[i] + ".");
                ctl.focus();
                return false;
            }
            else {
            
                if (vl.length == 0 && langId == "2"){
                    alert("Required field: " + labels[i] + ".");
                    ctl.focus();
                    return false;    
                }
                else {
                    if (vl.length == 0){
                        alert("Campo requerido: " + labels[i] + ".");
                        ctl.focus();
                        return false;    
                    }
                }
            }
         
         }
         
    
    }

    return false;
}

/*
 * Metodo que apresenta as apresentacoes para cursos E-Learning
*/
function WindowOpen(endereco,janela,altura,largura)
	{
		var x = ((screen.width-largura)/2);
		var y = ((screen.height-altura)/2);
		window.open(endereco,janela,'resizable=no,toolbar=no,scrollbars=yes,menubar=no,height='+altura+',width='+largura+',top='+y+',left='+x);
	}
	
	
function alterPhoto(PhotoImage, Title, Description) 
{
	document.getElementById('dvpnlPhotoMain').innerHTML = Title + "<img src=\"Images/Photos/" + PhotoImage + " \">" + Description;
}	

function openExternalPage(urlPage)
{
    window.open('http://'+urlPage,"_blank");
}