// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

/* Public array of table elements */
var tbody = new Array(12);

tbody[0] = "tbdEnero";
tbody[1] = "tbdFebrero";
tbody[2] = "tbdMarzo";
tbody[3] = "tbdAbril";
tbody[4] = "tbdMayo";
tbody[5] = "tbdJunio";
tbody[6] = "tbdJulio";
tbody[7] = "tbdAgosto";
tbody[8] = "tbdSetiembre";
tbody[9] = "tbdOctubre";
tbody[10] = "tbdNoviembre";
tbody[11] = "tbdDiciembre";

function switchTableBody (dropDownList)
{
	
	var indexSelected;
	var tbody_selected;
	
	indexSelected = dropDownList.selectedIndex;
	
	if (indexSelected < 12)
	{
		for (i=0; i < 12; i++)
		{
			tbody_selected = document.getElementById(tbody[i]);
			tbody_selected.style.display = "none";	
		}
		
		tbody_selected = document.getElementById(tbody[indexSelected]);
		tbody_selected.style.display = "table-header-group";
	}
	else
	{
		for (i=0; i < 12; i++)
		{
			tbody_selected = document.getElementById(tbody[i]);
			tbody_selected.style.display = "table-header-group";	
		}
	}
}

function displayElementChosen(dropListID) 
{
	var indexSelected;
	var tbody_selected;
	
	indexSelected = document.getElementById(dropListID).selectedIndex;
	tbody_selected = document.getElementById(tbody[indexSelected]);
	tbody_selected.style.display = "table-header-group";
}

var nav4 = window.Event ? true : false;
function acceptNum(evt){ 
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57 
	var key = nav4 ? evt.which : evt.keyCode; 
	return (key <= 13 || (key >= 48 && key <= 57));
}

function validarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
		return (true)
	} else {
		return (false);
	}
}

function valida_enviaCapacitacion(){ 

    if (document.frm_CapacitacionPrivada.txtInstitucion.value.length==0){ 
       alert("Por favor introduzca el nombre de la Empresa o Instituci\u00F3n") 
       document.frm_CapacitacionPrivada.txtInstitucion.focus() 
       return 0; 
    } 
	
	if (document.frm_CapacitacionPrivada.txtContacto.value.length==0){ 
       alert("Por favor introduzca el nombre de la persona a contactar") 
       document.frm_CapacitacionPrivada.txtContacto.focus() 
       return 0; 
    } 
	
	if (document.frm_CapacitacionPrivada.txtTelefono.value.length==0){ 
       alert("Por favor introduzca un n\u00FAmero de tel\u00E9fono para localizarlo") 
       document.frm_CapacitacionPrivada.txtTelefono.focus() 
       return 0; 
    } 
	
	if (document.frm_CapacitacionPrivada.txtTelefono.value.length < 8){ 
       alert("Por favor introduzca un n\u00FAmero de tel\u00E9fono v\u00E1lido, de 8 digitos") 
       document.frm_CapacitacionPrivada.txtTelefono.focus() 
       return 0; 
    } 
	
    if (document.frm_CapacitacionPrivada.txtEmail.value.length==0){ 
       alert("Por favor introduzca una direcci\u00F3n de correo electr\u00F3nico") 
       document.frm_CapacitacionPrivada.txtEmail.focus() 
       return 0; 
    } 	
	
	if (!validarEmail(document.frm_CapacitacionPrivada.txtEmail.value)){ 
		alert("Direcci\u00F3n de e-mail inv\u00E1lida"); 
		document.frm_CapacitacionPrivada.txtEmail.focus(); 
		return 0; 
	}	
	
    if (document.frm_CapacitacionPrivada.txtAreasReq.value.length==0){ 
       alert("Por favor introduzca las \u00E1reas en las que requiere informaci\u00F3n") 
       document.frm_CapacitacionPrivada.txtAreasReq.focus() 
       return 0; 
    } 	
	
    //el formulario se envia 
    alert("Gracias por enviar sus datos"); 
	document.frm_CapacitacionPrivada.action = 'CapacitacionPrivada_Form.asp';
    document.frm_CapacitacionPrivada.submit(); 
} 

function valida_enviaInscripcion(){ 

    if (document.frm_Inscripcion.txtCapacitacion.value.length==0){ 
       alert("Por favor introduzca el nombre de la Capacitaci\u00F3n") 
       document.frm_Inscripcion.txtCapacitacion.focus() 
       return 0; 
    } 
	
	if (document.frm_Inscripcion.txtParticipante.value.length==0){ 
       alert("Por favor introduzca el nombre de la persona participante") 
       document.frm_Inscripcion.txtParticipante.focus() 
       return 0; 
    } 
	
	if (document.frm_Inscripcion.txtInstitucion.value.length==0){ 
       alert("Por favor introduzca el nombre de la Instituci\u00F3n") 
       document.frm_Inscripcion.txtInstitucion.focus() 
       return 0; 
    } 
	
	if (document.frm_Inscripcion.txtTelefono.value.length==0){ 
       alert("Por favor introduzca el n\u00FAmero de tel\u00E9fono para localizarlo") 
       document.frm_Inscripcion.txtTelefono.focus() 
       return 0; 
    } 
	
	if (document.frm_Inscripcion.txtTelefono.value.length < 8){ 
       alert("Por favor introduzca un n\u00FAmero de tel\u00E9fono v\u00E1lido, de 8 digitos") 
       document.frm_Inscripcion.txtTelefono.focus() 
       return 0; 
    } 
	
    if (document.frm_Inscripcion.txtEmail.value.length==0){ 
       alert("Por favor introduzca una direcci\u00F3n de correo electr\u00F3nico") 
       document.frm_Inscripcion.txtEmail.focus() 
       return 0; 
    } 	
	
	if (!validarEmail(document.frm_Inscripcion.txtEmail.value)){ 
		alert("Direcci\u00F3n de e-mail inv\u00E1lida"); 
		document.frm_Inscripcion.txtEmail.focus(); 
		return 0; 
	}	
	
    //el formulario se envia 
    alert("Gracias por enviar sus datos de inscripci\u00F3n"); 
	document.frm_Inscripcion.action = 'FormularioInscripcion.asp';
    document.frm_Inscripcion.submit(); 
} 
