function sinTilde(evento){
	var key; 
         
    if(window.event){ 
	    key = evento.keyCode;
        if ((key>=48 && key<=57) || (key>=65 && key<=90) || (key>=97 && key<=122 || key ==8 || key ==46)) {
	    }else{
			window.event.keyCode=0; 
            return false; 
        } 
    } else if(evento.which){ 
	    key = evento.which; 
        if ((key>=48 && key<=57) || (key>=65 && key<=90) || (key>=97 && key<=122) || key ==8 || key ==46) { 
		}else{
	        return false; 
        } 
    } 
    return true; 
}

function soloNumeros(evento){
	var key; 
         
    if(window.event){ 
	    key = evento.keyCode; 
        if ((key < 48 || key > 57) && key != 8) { 
	        window.event.keyCode=0; 
            return false; 
        } 
    } else if(evento.which){ 
	    key = evento.which; 
        if ((key < 48 || key >  57) && key != 8){ 
	        return false; 
        } 
    } 
    return true; 
}

function soloNumerosFijo(evento){
	var key; 
         
    if(window.event){ 
	    key = evento.keyCode; 
        if ((key < 48 || key > 57) && key!=8 && key!=45 && key!=65 && key!=88 && key!=97 && key!=120) { 
	        window.event.keyCode=0; 
            return false; 
        } 
    } else if(evento.which){ 
	    key = evento.which; 
        if ((key < 48 || key > 57) && key!=8 && key!=45 && key!=65 && key!=88 && key!=97 && key!=120) { 
	        return false; 
        } 
    } 
    return true; 
}

function soloNumeros22(evento){
	var key; 
         
    if(window.event){ 
	    key = evento.keyCode; 
        if ((key < 48 || key > 57) && key != 8) { 
	        window.event.keyCode=0; 
            return false; 
        } 
    } else if(evento.which){ 
	    key = evento.which; 
        if ((key < 48 || key >  57) && key != 8){ 
	        return false; 
        } 
    } 
    return true; 
}

function eliminarVacios(iden){
	var obj=document.getElementById(iden);
	var cad = obj.value;
	cad=cad.replace(/^\s*|\s*$/g,"");
	var tam=cad.length;
	txt="";
	for(i=0;i<tam;i++){
		newCad=cad.substr(i,1);
		newCad=newCad.replace(/^\s*|\s*$/g,"");
		if(newCad.length>0) txt+= cad.substr(i,1);
	}
	obj.value=txt;
}

// JavaScript Document
function validarTipoArchivo22(control,tipo){
	if(tipo==1) array=new Array(".doc",".docx",".pdf");
	if(tipo==2) array=new Array(".gif",".jpg",".png");
	var texto=control.value;
	var ext = (texto.substring(texto.lastIndexOf("."))).toLowerCase(); 
	
	var permitida = false;
	for (var i = 0; i < array.length; i++) {
		if (array[i] == ext) {
			permitida = true;
			break;
		}
	}
	
	var error=document.getElementById('error');
	error.value=0;
	control.style.backgroundColor="#ffffff";
	if(!permitida){
		alert("Usted solo puede subir archivos con extensiones " + (array.join(" ")) + "\nPor favor seleccione un nuevo archivo");
		error.value=1;
		control.value="";
		control.style.backgroundColor="#ff0000";
		control.focus();
	}
}

//TABS PARA EMPRESA
function mostrar_empresa(tabmuestra,objeto,evento,key) {
    ColocarValorObjeto('TABDE,TABL,TABC,TABU','tab','className');
    ColocarValorObjeto(tabmuestra,'tabsel','className') ;
    ColocarValorObjeto('DATOS_EMPRESA,LOCALIZACION,EMPRESA_CUENTA,EMPRESA_CONTACTO','none','style.display');

switch(tabmuestra){
    case 'TABDE':	ColocarValorObjeto("DATOS_EMPRESA",'block','style.display'); 	break;
    case 'TABL': 	ColocarValorObjeto("LOCALIZACION",'block','style.display');  	break ;
    case 'TABC': 	ColocarValorObjeto("EMPRESA_CUENTA",'block','style.display');  	break ;
    case 'TABU': 	ColocarValorObjeto("EMPRESA_CONTACTO",'block','style.display');  break ;
    }
      
}
function imprimir_cv(id,tipo){
    //abrir_ventana('reportes/cv.php?id='+id+'&tipo='+tipo,'Impresion de CV',700,600) ;
	var dire="Cvista/verCV.php?id="+id+"&tipo="+tipo;
	var result = window.showModalDialog(dire, '', "dialogWidth:800px; dialogHeight:600px; center:yes");
}

function imprimir_cvPDF(id,tipo){
    //abrir_ventana('reportes/cv.php?id='+id+'&tipo='+tipo,'Impresion de CV',700,600) ;
    abrir_ventana('reportes/cv.php?id='+id+'&tipo='+tipo,700,600) ;

}


function imprimirEmpresaOferta(id){ 
	var dire='Cvista/ofertaEmpresaModi.php?id='+id;
	abrir_ventana(dire,'Impresion de oferta',400,300) ;
}


function imprimir_oferta(id){ 
	abrir_ventana('Cvista/oferta.php?id='+id,'Impresion de oferta',400,300) ;
}

function imprimir_empresa(id){
    abrir_ventana('Cvista/empresa.php?id='+id,'Impresion de Empresa',400,300) ;
}


function abrir_ventana(enlace,ancho,alto)
{
   nuevaVentana = window.open (enlace,"newwindow0","height="+alto+",width="+ancho+", resizable=NO,noresize=no,toolbar=0,location=0,directories=0, status=NO, menubar=0,scrollbars=1")
}

function mes_anio($str) //$str debe tener el formato date: yyyy-mm-dd
{
	$anio = substr($str,0,4);
	$mes = substr($str,5,2);
	$newMes = abrevMes($mes);
		
	return $newMes+'-'+$anio;
}

function dia_mes_anio($str) //$str debe tener el formato date: yyyy-mm-dd
{
	$anio = substr($str,0,4);
	$mes = substr($str,5,2);
	$dia = substr($str,8,2);
	$newMes = abrevMes($mes);
		
	return $dia+'-'+$newMes+'-'+$anio;
}

function abrevMes($a)
{
	switch ($a){
		case 1:
			return "Ene";
			break;
		case 2:
			return "Feb";
			break;
		case 3:
			return "Mar";
			break;
		case 4:
			return "Abr";
			break;
		case 5:
			return "May";
			break;
		case 6:
			return "Jun";
			break;
		case 7:
			return "Jul";
			break;
		case 8:
			return "Ago";
			break;
		case 9:
			return "Set";
			break;
		case 10:
			return "Oct";
			break;
		case 11:
			return "Nov";
			break;
		case 12:
			return "Dic";
			break;
	}
}

function buscarControl(control){
	var txt = document.getElementById(control);
	return txt;
}

function mostrarCalendario(txt,btn){
	var txt = buscarControl(txt);
	var btn = buscarControl(btn);
	

	Calendar.setup({
		inputField : txt, // id del campo de texto
		ifFormat : "%Y-%m-%d", // formato de la fecha que se escriba en el campo de texto
		button : btn // el id del botón que lanzará el calendario
	});	

}

function cvAgregar(tipo){
	var dato,ficha,update,nro;
	
	update=0;
	switch(tipo){//1:formacionP, 2:experienciaP, 3:Idioma
		case 1:
		case 11:
		case 111:
			if(tipo!=111){
				var array=new Array("institucion","especialidad","grado","situacion","anioInicio","anioTermino");
				if (validarTexto(array)==true) return;
			}
			ficha=3;
			var a = document.getElementById("institucion").value;
			var b = document.getElementById("especialidad").value;
			var c = document.getElementById("grado").value;
			var d = document.getElementById("situacion").value;
			var e = document.getElementById("anioInicio").value;
			var f = document.getElementById("anioTermino").value;
			var nro = document.getElementById("idEditar").value;
			var z = document.getElementById("resumenEjecutivo").value;		
			
			if(tipo==11) update=1;
			if(tipo==111) update=2;
			//alert(nro+" -- "+update);
			dato = "tab="+ficha+"&tipo=1&dato1="+a+"&dato2="+b+"&dato3="+c+"&dato4="+d+"&dato5="+e+"&dato6="+f+
				"&dato0="+nro+"&update="+update+  "&resumen="+ z +   "&nn="+aleatorio();
			//alert(dato);
			cargarContenido('Cvista/cvAgregar.php?' + dato,'detalle');
			break;
		case 2:
		case 22:
		case 222:
			if(tipo!=222){
				var array=new Array("empresa","cargo","descripcion","funciones","fInicio","fFin");
				if (validarTexto(array)==true) return;
			}	
			ficha=4;
			var a = document.getElementById("empresa").value;
			var b = document.getElementById("cargo").value;
			var c = document.getElementById("descripcion").value;
			var d = document.getElementById("funciones").value;
			var e = document.getElementById("fInicio").value;
			var f = document.getElementById("fFin").value;
			var nro = document.getElementById("idEditar").value;		
			var z = document.getElementById("resumenEjecutivo").value;
			
			if(tipo==22) update=1;
			if(tipo==222) update=2;
			dato = "tab="+ficha+"&tipo=2&dato1="+a+"&dato2="+b+"&dato3="+c+"&dato4="+d+"&dato5="+e+"&dato6="+f+
				"&dato0="+nro+"&update="+update+  "&resumen="+ z +   "&nn="+aleatorio();
			cargarContenido('Cvista/cvAgregar.php?' + dato,'detalle');
			break;
		case 3:
		case 33:
		case 333:
			if(tipo!=333){
				var array=new Array("idioma","institucionIdioma","nivel");
				if (validarTexto(array)==true) return;
			}	
			ficha=5;
			var a = document.getElementById("idioma").value;
			var b = document.getElementById("institucionIdioma").value;
			var c = document.getElementById("nivel").value;
			var d = "0";
			var e = "0";
			var f = "0";
			var nro = document.getElementById("idEditar").value;
			var z = document.getElementById("resumenEjecutivo").value;

			if(tipo==33) update=1;
			if(tipo==333) update=2;
			dato = "tab="+ficha+"&tipo=3&dato1="+a+"&dato2="+b+"&dato3="+c+"&dato4="+d+"&dato5="+e+"&dato6="+f+
				"&dato0="+nro+"&update="+update+  "&resumen="+ z +   "&nn="+aleatorio();
			cargarContenido('Cvista/cvAgregar.php?' + dato,'detalle');			
			break;
		case 10:ficha=3; break;
		case 20:ficha=4; break;
		case 30:ficha=5; break;
	}
	
	dato=getDatoCV1();
	//alert(dato);
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}


function getDatoCV1(){
	var g = document.getElementById("nombre").value;
	var h = document.getElementById("dni").value;
	var i = document.getElementById("fnac").value;
	var j = document.getElementById("estcivil").value;
	var k = document.getElementById("direccion").value;
	var l = document.getElementById("nacionalidad").value;
	var m = document.getElementById("resumenEjecutivo").value;
	var n = document.getElementById("telefono").value;
	var o = document.getElementById("celular").value;
	var p = document.getElementById("email").value;	
	var q = document.getElementById("perfil").value;
	var r = document.getElementById("nuevo").value;
	
	var indice1 = document.tabla3.estcivil.selectedIndex;
	var estCivTexto = document.tabla3.estcivil.options[indice1].text;
	
	var indice2 = document.tabla3.nacionalidad.selectedIndex;
	var nacionTexto = document.tabla3.nacionalidad.options[indice2].text;

	
	dato = "&nombre="+g+"&dni="+h+"&fnac="+i+"&estcivil="+estCivTexto+"&direccion="+k+"&nacionalidad="+nacionTexto+"&resumen="+m+"&telefono="+n+"&celular="+o+"&email="+p+"&perfil="+q+"&nuevo="+r+"&estcivilCOD="+j+"&nacionalidadCOD="+l;
	return dato;
}

function getDatoCV2(){
	var a = document.getElementById("institucion").value;
	var b = document.getElementById("especialidad").value;
	var c = document.getElementById("grado").value;
	var d = document.getElementById("situacion").value;
	var e = document.getElementById("anioInicio").value;
	var f = document.getElementById("anioTermino").value;
	var g = document.getElementById("nuevo").value;
	
	dato = "&institucion="+a+"&especialidad="+b+"&grado="+c+"&situacion="+d+"&anioInicio="+e+"&anioTermino="+f+"&nuevo="+g;
	return dato;
}

function getDatoCV3(){
	var a = document.getElementById("empresa").value;
	var b = document.getElementById("cargo").value;
	var c = document.getElementById("descripcion").value;
	var d = document.getElementById("funciones").value;
	var e = document.getElementById("fInicio").value;
	var f = document.getElementById("fFin").value;
	var g = document.getElementById("nuevo").value;
	
	dato = "&empresa="+a+"&cargo="+b+"&descripcion="+c+"&funciones="+d+"&fInicio="+e+"&fFin="+f+"&nuevo="+g;
	return dato;	
}

function getDatoCV4(){
	var a = document.getElementById("idioma").value;
	var b = document.getElementById("institucionIdioma").value;
	var c = document.getElementById("nivel").value;
	var d = document.getElementById("nuevo").value;
	
	dato = "&idioma="+a+"&institucionIdioma="+b+"&nivel="+c+"&nuevo="+d;
	return dato;	
}

function cvEditarFormacionP(id){
	var ficha=3;
	var dato=getDatoCV2() + getDatoCV1() + "&editar="+ficha+"&idEditar="+id;	
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}

function cvEditarExperienciaP(id){
	var ficha=4;
	var dato=getDatoCV3() + getDatoCV1() + "&editar="+ficha+"&idEditar="+id;
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}

function cvEditarIdioma(id){
	var ficha=5;
	var dato=getDatoCV4() + getDatoCV1() + "&editar="+ficha+"&idEditar="+id;
	//alert(dato);
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}

function cvEliminarFormacionP(id){
	var ficha=3;
	var nro = document.getElementById("idEditar");
	nro.value=id;
	cvAgregar(111);
	
	var dato=getDatoCV1();
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}

function cvEliminarExperienciaP(id){
	var ficha=4;
	var nro = document.getElementById("idEditar");
	nro.value=id;
	cvAgregar(222);
	
	var dato=getDatoCV1();
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}

function cvEliminarIdioma(id){
	var ficha=5;
	var nro = document.getElementById("idEditar");
	nro.value=id;
	cvAgregar(333);
	
	var dato=getDatoCV1();
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab="+ficha+dato,'detalle');
}


function ofertaEmpresaUPD(){
	var array=new Array("cargo","funciones","requisitos","vacantes","expiracion");
	if (validarTexto(array)==true) return;
	
	var a = document.getElementById("especialidad").value;
	var b = document.getElementById("id").value;
	var c = document.getElementById("cargo").value;
	var d = document.getElementById("funciones").value;
	var e = document.getElementById("vacantes").value;
	var f = document.getElementById("sueldo").value;
	var g = document.getElementById("expiracion").value;
	var h = document.getElementById("requisitos").value;
	
	var dato = "especialidad="+a+"&id="+b+"&cargo="+c+"&funciones="+d+"&vacantes="+e+"&sueldo="+f+"&expiracion="+g+"&requisitos="+h+"&opcion=3";
	//alert(dato);
	cargarContenido('Cvista/ofertaEmpresaUPD.php?' + dato,'detalle_colegiado');
	cargarContenido('Cvista/ofertaEmpresa.php?nn='+aleatorio(),'detalle_colegiado');
}

function ofertaEmpresaINS(){
	var array=new Array("cargo","funciones","requisitos","vacantes","expiracion");
	if (validarTexto(array)==true) return;
				
	var a = document.getElementById("especialidad").value;
	var b = document.getElementById("id").value;
	var c = document.getElementById("cargo").value;
	var d = document.getElementById("funciones").value;
	var e = document.getElementById("vacantes").value;
	var f = document.getElementById("sueldo").value;
	var g = document.getElementById("expiracion").value;
	var h = document.getElementById("requisitos").value;
	var i = document.getElementById("idEmpleador").value;
	
	var dato = "especialidad="+a+"&id="+b+"&cargo="+c+"&funciones="+d+"&vacantes="+e+"&sueldo="+f+"&expiracion="+g+"&requisitos="+h+"&idEmpleador="+i+"&opcion=2";
	cargarContenido('Cvista/ofertaEmpresaUPD.php?' + dato,'detalle_colegiado');
	cargarContenido('Cvista/ofertaEmpresa.php?nn='+aleatorio(),'detalle_colegiado');
}

function ofertaEmpresaDEL(id,nom){
	var a="";
	if(confirm('¿Desea eliminar el registro \n'+ nom +'?')){
		var dato = "especialidad=1&id="+id+"&cargo=&funciones=&vacantes=1&sueldo=1&expiracion=&requisitos=&opcion=4";
		cargarContenido('Cvista/ofertaEmpresaUPD.php?' + dato,'detalle_colegiado');
		cargarContenido('Cvista/ofertaEmpresa.php?nn='+aleatorio(),'detalle_colegiado');
	}	
}

function postular(){
	var idCV = document.getElementById("selectCV").value;
	var idBolsa = document.getElementById("idBolsa").value;
	var dato = "idcv="+idCV+"&idBolsa="+idBolsa;
	
	cargarContenido('Cvista/postulacionesINS.php?' + dato,'detalle_colegiado');
	//cargarContenido('Cvista/oferta.php?nn='+aleatorio(),'detalle_colegiado');	
	//alert("Su postulación se agregó con éxito");
}


//TABS PARA ficha de datos
function mostrar_opciones_ficha22(tabmuestra,objeto,evento,key) {
	ColocarValorObjeto('TABRE,TABDP,TABFP,TABEL,TABID','tab','className');
    ColocarValorObjeto(tabmuestra,'tabsel','className') ;
    ColocarValorObjeto('RESUMEN_EJECUTIVO,DATOS_PERSONALES22,FORMACION_PROFESIONAL,EXPERIENCIA_PROFESIONAL,IDIOMAS','none','style.display');
    //mostar_seleccionados(objeto)
    
switch(tabmuestra){
    case 'TABRE':	ColocarValorObjeto("RESUMEN_EJECUTIVO",'block','style.display'); 	break;
    case 'TABDP': 	ColocarValorObjeto("DATOS_PERSONALES22",'block','style.display');  	break ;
    case 'TABFP':  	ColocarValorObjeto("FORMACION_PROFESIONAL",'block','style.display');	break ;
    case 'TABEL':	ColocarValorObjeto("EXPERIENCIA_PROFESIONAL",'block','style.display'); break ;
    case 'TABID': 	ColocarValorObjeto("IDIOMAS",'block','style.display');  	break ;
    }
}

function guardarCV(){	
	var a = document.getElementById("titulo").value;
	var b = document.getElementById("resumenEjecutivo").value;
	var c = document.getElementById("telefono").value;
	var d = document.getElementById("celular").value;
	var e = document.getElementById("email").value;
	var f = document.getElementById("nuevo").value;
	var perfil = document.getElementById("perfil").value;
	
	var g = document.getElementById("dni").value;
	var h = document.getElementById("fnac").value;
	var i = document.getElementById("estcivil").value;
	var j = document.getElementById("direccion").value;
	var k = document.getElementById("nacionalidad").value;

	var dato = "titulo="+a+"&resumen="+b+"&telefono="+c+"&celular="+d+"&email="+e+"&nuevo="+f+"&perfil="+perfil+"&dni="+g+"&fNac="+h+"&estcivilCOD="+i+"&direccion="+j+"&nacionalidadCOD="+k;
	
	//alert(dato);
	cargarContenido('Cvista/cvUPD.php?' + dato,'detalle');
	cargarContenido('Cvista/cv.php?nn='+ aleatorio(),'detalle_colegiado');
	alert("Datos almacenados con éxito");
}

function hdImagen(chk,control1,control2){
	var btn1 = document.getElementById(control1);
	var btn2 = document.getElementById(control2);
	btn1.disabled = !chk.checked;
	btn2.disabled = !chk.checked;
}

function validarEnter(evento,control){
	var key; 
         
    if(window.event){ 
	    key = evento.keyCode; 
        if (key == 13) {
			var btn1 = document.getElementById(control);
	        btn1.focus();
        } 
    } else if(evento.which){ 
	    key = evento.which; 
        if (key == 13){
			var btn1 = document.getElementById(control);
	        btn1.focus();
        } 
    } 
}


function aleatorio(){
	//var nn = Math.random()*999999999999999;
	var nn = Math.random()*999999999;
	var x = (nn+ " ").substr(1,1);
	if(x==0) x = (nn+ " ").substr(1,3);
	if(x>12) x=10;
	var i,h='';
	for(i=1;i<=x*2;i++) h = h + '9';
	nn=nn*(h*1);

	return nn;
}

function cargarSWF(direccion,ancho,alto)
{ 
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">'); 
    document.write('<param name="movie" value="'+direccion+'" /><param name="quality" value="high"><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="'+direccion+'" quality="high" wmode=transparent pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ancho+'" height="'+alto+'"></embed><noembed> <div align="center">Su navegador no dipone de una versión apropiada de flash player. <br> Puede obtenerla gratuitamente <a href="http://www.adobe.com/es/products/flashplayer/">aqui </a> </div> </noembed></object>'); 
} 



//para ver capas
function verCapa(id1,id2,id3,opcion){
if (opcion == 0)
{
 document.getElementById(id1).style.display = "block";
 document.getElementById(id2).style.display = "none";
 document.getElementById(id3).style.display = "none";
 } else {
 document.getElementById(id1).style.display = "block";
 document.getElementById(id2).style.display = "block";
 document.getElementById(id3).style.display = "none";
 }

}

function ver_capa(id){
 document.getElementById(id).style.display = "block";
}


function ocultar_capa(id){
 document.getElementById(id).style.display = "none";
} 

function verArticulo1(id,num){
//cerrar articulo actual
var i = 1;
while(i<num+1){
	document.getElementById(i).style.display = "none";
	i++;
}
 //abrir el articulo
document.getElementById(id).style.display = "block";

}

function verArticulo(id,num){
if (num==1){
 document.getElementById(id).style.display = "block";
}else{
 document.getElementById(id).style.display = "none";
}
}

function validarTexto(array){
	var control,est=false,cad='';
	for(i=0;i<array.length;i++){
		control = document.getElementById(array[i]);
		control.style.backgroundColor="#ffffff";
		cad=control.name + '_span';
		document.getElementById(cad).innerHTML="";
		
		control.value=control.value.replace(/^\s*|\s*$/g,"");
		if(control.value.length==0){
			control.style.backgroundColor="#ff0000";			
			document.getElementById(cad).innerHTML="<font color='#ff0000'>*</font>";
			est=true;
		}
	}
	return est;
}


function validarPASS(){
	document.getElementById("errorPASS").innerHTML="";
	var array=new Array("passActual","passNuevo","passNuevoConf");
	if (validarTexto(array)==true) return false;
	
	var a = document.getElementById("passActual").value;
	var b = document.getElementById("passNuevo").value;
	var c = document.getElementById("passNuevoConf").value;
	
	if(b!=c){
		document.getElementById("errorPASS").innerHTML="<font color='#ff0000'>Escriba correctamente la nueva y la confirmacion de la contrasena</font>";
		return false;
	}
	return true;
}

function cambiarPASS(){
	var a = document.getElementById("passActual").value;
	var b = document.getElementById("passNuevo").value;
	var c = document.getElementById("passNuevoConf").value;
	var dato="&a="+a+"&b="+b+"&c="+c;
	cargarContenido('Cvista/cambiarPASS.php?nn='+aleatorio()+dato,'detalle_colegiado');	
}

function validarContactame(){
	var array=new Array("nombre","email","asunto","mensaje");
	if (validarTexto(array)==true) return false;
	if (validarEMail('email')==false) return false;
	return true;	
}

function grabarContactame(){
	var a = document.getElementById("nombre").value;
	var b = document.getElementById("email").value;
	var c = document.getElementById("asunto").value;
	var d = document.getElementById("mensaje").value;
	var dato="&a="+a+"&b="+b+"&c="+c+"&d="+d;
	cargarContenido('Cvista/contactenosUPD.php?nn='+aleatorio()+dato,'contenido');			
}

function validarEMail(txt){
	var control=document.getElementById(txt);
	var est=true;
	var s = control.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) est=false;
	if (!filter.test(s)) est=false;
	if(est==false){
		cad=control.name + '_span';
		document.getElementById(cad).innerHTML="<font color='#ff0000'>*</font>";
	}
	return est;
}

function imprimir_contactenosPDF(){
	var inicio = document.getElementById("inicio").value;
	var fin = document.getElementById("fin").value;
    abrir_ventana('reportes/contactenos.php?inicio='+inicio+'&fin='+fin,'Impresion de CV',700,600) ;
}

//$anio1 y $anio2 debe tener el formato date: yyyy-mm-dd
function compararFecha(fecha1,fecha2){
     var xYear=fecha1.substr(0,4);  
     var xMonth=fecha1.substr(5,2);  
     var xDay=fecha1.substr(8,2);  

     var yYear=fecha2.substr(0,4);  
     var yMonth=fecha2.substr(5,2);  
     var yDay=fecha2.substr(8,2);  

//alert(fecha1+'**'+fecha2)
//alert(xYear + '**' + xMonth + '**' + xDay);
//alert(yYear + '**' + yMonth + '**' + yDay);


     if (xYear > yYear){  
         return(true)  
     }else{  
       if (xYear == yYear){   
         if (xMonth > yMonth){
             return(true)  
         }else{   
           if (xMonth == yMonth){  
             if (xDay > yDay)  
               return(true);  
             else  
               return(false);  
           }else{  
             return(false);  
	    }
         }  
       }else{
         return(false);  
	}
     } 
}

function validarFecha(btn1, btn2){
	var control = document.getElementById(btn1);
	var fecha1 = control.value;
	var fecha2 = document.getElementById(btn2).value;
	
	var est=compararFecha(fecha1,fecha2);	
	if(est) control.value='';	

}

function cargarHistorico(tipo,idEmpr){
	//cargarContenido('Cvista/mostrarHistorico.php?nn=' + aleatorio() + '&tipo='+tipo+'&idEmpr='+idEmpr,'detalle_colegiado');
	//cargarContenido('Cvista/ofertaEmpresa.php?nn=' + aleatorio() + '&tipo='+tipo,'detalle_colegiado');

	cargarContenido('Cvista/mostrarHistorico.php?tipo='+tipo+'&idEmpr='+idEmpr,'detalle_colegiado');
	cargarContenido('Cvista/ofertaEmpresa.php?tipo='+tipo,'detalle_colegiado');
}

function buscarHistorialEmpresa(){
	var tipo = document.getElementById('tipo').value;
	var dato = document.getElementById('registro').value;
	cargarContenido('Cvista/ofertaEmpresaHistorial.php?nn=' + aleatorio() + '&tipo='+tipo+'&dato='+dato,'inferior');
}

function probarEmpresa(id,estado){
	var est=false;
	if (estado==1){	
		if(confirm('¿Seguro que desea aprobar la Solicitud de la Empresa?')){
			est=true;
		};
	}else{
		if(confirm('¿Seguro que desea Rechazar la Solicitud de la Empresa?')){
			est=true;
		};
	}
	if (est==true){
		cargarContenido('Cvista/bc_empresaAD.php?id='+id+"&estado="+estado,'detalle2');
		cargarContenido('Cvista/bc_bolsaTrabajo.php','contenido');
	}
}
function IsNumeric(sText){
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function validarCadena(tipo,cadena){
	var est=false;
	switch(tipo){
		case 1: //Numeros
			if(IsNumeric(cadena)) est=true;
			break;
	}
	return est;
}

function empresafind(){
	var array=new Array("txtFind");
	if (validarTexto(array)==true) return;

	var b = document.getElementById("txtFind").value;
	var a=0;
	if(formBusqEmpr.rbTipo[0].checked) a=1;
	if(formBusqEmpr.rbTipo[1].checked) a=2;
	
	if (a==2 && !validarCadena(1,b)){
		alert('Ingrese valor numerico');
		return;	
	}

	cargarContenido('Cvista/bc_empresaFind.php?tipo='+a+"&dato="+b,'detalle0');
}

function recargarOferta(cap){
	cargarContenido('Cvista/oferta.php?cap='+cap,'detalle_colegiado');
}


//Empresa Registro INICIO
function fichaEmpresa(tabmuestra,objeto,evento,key) {
	ColocarValorObjeto('TABDU,TABDG,TABLO,TABCO','tab','className');
    ColocarValorObjeto(tabmuestra,'tabsel','className') ;
    ColocarValorObjeto('DATOS_USUARIO,DATOS_GENERALES,LOCALIZACION,CONTACTO','none','style.display');
    //mostar_seleccionados(objeto)
    
switch(tabmuestra){
    case 'TABDU':	ColocarValorObjeto("DATOS_USUARIO",'block','style.display'); 	break;
    case 'TABDG': 	ColocarValorObjeto("DATOS_GENERALES",'block','style.display');  	break ;
    case 'TABLO':  	ColocarValorObjeto("LOCALIZACION",'block','style.display');	break ;
    case 'TABCO':	ColocarValorObjeto("CONTACTO",'block','style.display'); break ;
    }
}

function valEmpresaBuscar(control){
	var est=true;
	var texto=control.value;
	if(texto.length<11){
		alert("Escriba correctamente el numero de RUC (11 caracteres)!");
		document.getElementById("buscarRUC").focus();
		est=false;
	}
	
	return est;
}

function empresaRegistro(){
	var ruc=document.getElementById("buscarRUC").value;
	cargarContenido('Cvista/empresaReg.php?ruc='+ruc,'contenido');
}

function valEmpresaRegistro(){
	var est=true, cad="";
	document.getElementById("errores").innerHTML="";
	
	var array=new Array("usuario","clave","claveConfirmar","email","emailConfirmar","razonSocial","ciudad","apePaterno","apeMaterno","nombre","cargo");
	if (validarTexto(array)==true) est=false;	
	if(est==false) cad = "Faltan datos para el registro de la empresa!<br />";
	
	//Verificar clave y email
	var cla1=document.getElementById("clave").value;
	var cla2=document.getElementById("claveConfirmar").value;
	var mail1=document.getElementById("email").value;
	var mail2=document.getElementById("emailConfirmar").value;
	
	if(cla1!=cla2) {cad += "Las claves no coinciden!<br />"; est=false;}
	if(mail1!=mail2) {cad += "Los E-mails no coinciden!"; est=false;}
	
	if(est==false) document.getElementById("errores").innerHTML="<font color='#ff0000'>"+cad+"</font>";
	return est;
}
//Empresa Registro FIN

//usuario INICIO
function usuarioUPD(opc,id){
	if(opc==0)cargarContenido('Cvista/usuNUE.php','contenido');
	if(opc==1)cargarContenido('Cvista/usuMOD.php?id='+id,'contenido');
	if(opc==2)cargarContenido('Cvista/usuPER.php?id='+id,'contenido');
}

function valUsuario(){
	var est=true;
	var array=new Array("usuario","clave","nombre","mail");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("sede","estado","perfil");
	if (validarCombo(array2)==true) est=false;
	
	return est;
}

function usuarioPermiso(id,modulo,valor){
	var val=0;
	if(valor==true) val=1;
	var dato='sw=1&id='+id+"&modulo="+modulo+"&valor="+val;
	cargarContenido('Cvista/usuPER.php?'+dato,'contenido');
}
//USUARIO FIN

// RECUPERAR CLAVE INICIO
function valRecuperar(){
	var est=true;
	var array=new Array("codigo","mail","seguridad");
	if (validarTexto(array)==true) est=false;
	
	var txt1=document.getElementById("codSeg").value;
	var txt2=document.getElementById("seguridad").value;
	if(txt1!=txt2){
		est=false;
		alert('codigo de seguridad incorrecto!');
		document.getElementById("seguridad").focus();
	}
	
	return est;
}

function cambiarTextoRecuperar(cod){
	if(cod==1) document.getElementById("texto").innerHTML="NRO CIP:";
	if(cod==2) document.getElementById("texto").innerHTML="NRO RUC:";	
}
// RECUPERAR CLAVE FIN

//Oferta de empresa INICIO
function valOfertaEmpresa(){
	var est=true;
	var array=new Array("cargo","funciones","requisitos","vacantes","expiracion");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("especialidad","sueldo");
	if (validarCombo(array2)==true) est=false;
	
	return est;
}

//Oferta de empresa FIN

// CV VALIDAR FOTO INICIO
function valCVFoto(){
	var est=true;
	array=new Array(".gif",".jpg",".png");
	var control = document.getElementById("foto");
	var texto=control.value;
	var ext = (texto.substring(texto.lastIndexOf("."))).toLowerCase(); 
	
	var permitida = false;
	for (var i = 0; i < array.length; i++) {
		if (array[i] == ext) {
			permitida = true;
			break;
		}
	}
	
	control.style.backgroundColor="#ffffff";
	if(!permitida){
		alert("Usted solo puede subir archivos con extensiones " + (array.join(" ")) + "\nPor favor seleccione un nuevo archivo");
		control.value="";
		control.style.backgroundColor="#ff0000";
		control.focus();
		est=false;
	}
	return est;
}
// CV VALIDAR FOTO FIN

// evento INICIO
function validarCombo(array){
	var control,est=false,cad='';
	for(i=0;i<array.length;i++){
		control = document.getElementById(array[i]);
		control.style.backgroundColor="#ffffff";
		cad=control.name + '_span';
		document.getElementById(cad).innerHTML="";
		if(control.value==0){
			control.style.backgroundColor="#ff0000";
			//cad=control.name + '_span';
			document.getElementById(cad).innerHTML="<font color='#ff0000'>*</font>";
			est=true;
		}
	}
	return est;
}

function selProvincia(dpto){
	cargarContenido('Cvista/pp_ubigeo.php?departamento='+dpto,'ubigeo');
}

function selDistrito(dpto,prov){
	cargarContenido('Cvista/pp_ubigeo.php?departamento='+dpto+'&provincia='+prov,'ubigeo');
}

function valPreBeca(){
	var est=true;
	var array=new Array("cod","fNac");
	if (validarTexto(array)==true) est=false;	
	return est;
}

function valBeca(){
	var est=true;
	var array=new Array("direccion","telefono","celular","mail_1");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("departamento","provincia","distrito");
	if (validarCombo(array2)==true) est=false;
	
	return est;
}

// evento FIN

//ENCUESTAS INICIO
function activarCelda(){
	document.getElementById("oculto").style.display = "block";
	document.getElementById("btnVotar").disabled= false;
}
function validarVoto(){
	var est=true;
	var control22=document.getElementById("cip");
	var control=document.getElementById("cip_span");
	
	control.innerHTML="";
	if(control22.value.length<=2){
		control.innerHTML="<font size=4 color='#FF0000'>*</font>";
		alert("Ingrese su Nro de CIP para Votar");
		control22.focus();
		est=false;
	}
	
	return est;	
}
//ENCUESTAS FIN

// APORTE INICIO
function aporteListaCSV(){
	var control2=document.getElementById("sede22");
	var control3=document.getElementById("anio22");
	
	var dato="idSede="+control2.value+"&anio="+control3.value;
	cargarContenido('Cvista/j_listaAporte.php?'+dato,'bodyActMas');
}
function print_listaAporte(){
	var control2=document.getElementById("sede22");
	var control3=document.getElementById("anio22");
	
	var dato="idSede="+control2.value+"&anio="+control3.value;
	abrir_ventana('reportes/aporteTMP.php?'+dato,700,600) ;
}
// APORTE FIN

function prePostulacion(){
	var cod = document.getElementById('cod').value;
	var fecha = document.getElementById('fNac').value;
	var dato="cod="+cod+"&fecha="+fecha;
	cargarContenido('Cvista/modPostulacion.php?'+dato,'contenido');
	
}

function valPrePostulacion(){
	var est=true;
	var array=new Array("cod","fNac");
	if (validarTexto(array)==true) est=false;	
	return est;
}


function valPostulacionMod(){	
	var est=true;
	var array=new Array("direccion","celular","mail_1","cv","opt5","opt2");
	if (validarTexto(array)==true) est=false;	
	
	var array2=new Array("departamento","provincia","distrito");
	if (validarCombo(array2)==true) est=false;
	
	var error=document.getElementById('error').value;
	if(error==1) {
		est=false;
		alert('Los formatos permitido para CV son: .doc, .docx, .pdf. Sirvase a cambiar el formato de su CV');
	}
	
	return est;
}

function valCorreo(nro,control){
	if(nro==1){ //No Correo
		var texto=control.value;
		var arroba=texto.indexOf("@",0);
		if(arroba>0){
			control.value=texto.substr(0,arroba);
			alert('El usuario no puede contener simbolo @');
		}
		
	}
}

function cambiarFoto(foto,form){	
	//var dire="Cvista/cambiarFoto.php?foto="+foto;
	var dire="Cvista/cambiarFoto.php";
		//var dato=getDatoCV1();
	var result = window.showModalDialog(dire, form, "dialogWidth:280px; dialogHeight:280px; center:yes");
	
	//cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+"&sw=0&tab=1"+dato,'detalle');
}


function perfilCV(control,cod){
	var indice = document.form.selectPerfil.selectedIndex;
	if(indice == 0){
		cargarContenido('Cvista/cv.php','detalle_colegiado');
		return;
	}

	var sel = document.form.selectPerfil.options[indice].text;
	var texto = document.getElementById(control);
	texto.value=sel.substr(11);
	
	var nuevo=1;
	texto.value=texto.value.toUpperCase();
	if(texto.value=="VACIO") nuevo=0;
	
	var perfil = document.getElementById("selectPerfil").value;
	var titulo = texto.value;
	cargarContenido('Cvista/cvDetalle.php?nn='+aleatorio()+'&sw=1&perfil=' + perfil + "&nuevo=" + nuevo + "&titulo=" + titulo + "&cod="+cod,'detalle');
}

/* cambio en bolsa de trabajo INICIO */
function cvAgregar2(nroForm,nroProc){
	if(nroForm==3){
		if(nroProc==3){
			cargarContenido('Cvista/cvIdioma.php?nroProc=0','IDIOMAS');
			return;
		}
		var array=new Array("idioma","institucionIdioma","nivel");
		if (validarTexto(array)==true) return;

		document.tbIdioma.nroProc.value=nroProc;
		document.tbIdioma.submit();
	}
	if(nroForm==2){
		if(nroProc==3){
			cargarContenido('Cvista/cvExperienciaP.php?nroProc=0','EXPERIENCIA_PROFESIONAL');
			return;
		}
		var array=new Array("empresa","cargo","descripcion","funciones","fInicio2","fFin2");
		if (validarTexto(array)==true) return;
		
		document.tbExperienciaP.fInicio.value=document.tbExperienciaP.fInicio2.value;
		document.tbExperienciaP.fFin.value=document.tbExperienciaP.fFin2.value;
		
		document.tbExperienciaP.nroProc.value=nroProc;
		document.tbExperienciaP.submit();
	}
	if(nroForm==1){
		if(nroProc==3){
			cargarContenido('Cvista/cvFormacionP.php?nroProc=0','FORMACION_PROFESIONAL');
			return;
		}
		var array=new Array("institucion","especialidad","grado","situacion","anioInicio","anioTermino");
		if (validarTexto(array)==true) return;
		
		document.tbFormacionP.nroProc.value=nroProc;
		document.tbFormacionP.submit();
	}	
}

function cvEditar2(nroForm,id){
	var dato="cod="+id;
	if(nroForm==3){
		cargarContenido('Cvista/cvIdioma.php?'+dato,'IDIOMAS');
	}
	if(nroForm==2){
		cargarContenido('Cvista/cvExperienciaP.php?'+dato,'EXPERIENCIA_PROFESIONAL');
	}
	if(nroForm==1){
		cargarContenido('Cvista/cvFormacionP.php?'+dato,'FORMACION_PROFESIONAL');
	}
}

function cvEliminar2(nroForm,id){
	if(nroForm==3){
		document.tbIdioma.nroProc.value=3;
		document.tbIdioma.cod.value=id;
		document.tbIdioma.submit();
	}
	if(nroForm==2){
		document.tbExperienciaP.nroProc.value=3;
		document.tbExperienciaP.cod.value=id;
		document.tbExperienciaP.submit();
	}
	if(nroForm==1){
		document.tbFormacionP.nroProc.value=3;
		document.tbFormacionP.cod.value=id;
		document.tbFormacionP.submit();
	}
}

function cvGrabar2(){
	document.tbDato.fNac.value=document.tbDato.fNac2.value;
	document.tbDato.titulo.value=document.form.titulo.value;
	document.tbDato.submit();
}

/* cambio en bolsa de trabajo FIN */

function ppRegColegiado(){
	sede=document.getElementById('hdn_sede').value;
	usu=document.getElementById('Hdncod_usu').value; 
	cargarContenido('Cvista/consultaprecol.php?sede='+sede+'&usu='+usu+'','contenido')
}

function ppRegColegiadoNO(){
	cargarContenido('Cvista/ppRegBuscar.php','contenido')
}

function ppRegColegiadoNO2(cod){
	var dato="cod2="+cod;
	cargarContenido('Cvista/ppRegCNT.php?'+dato,'contenido');
}

function ppRegBuscar(){
	var nom=document.getElementById('nombre').value;
	var dato="nombre=" + nom;
	cargarContenido('Cvista/ppRegBuscarLista.php?'+dato,'detalle22');
}

function ppDatoDetalle(){
	
	var est=true;
	//var array=new Array("nombre","telefono","celular","email","direccion");
	var array=new Array("nombre","telefono","celular","email");
	if (validarTexto(array)==true) est=false;
	
	//var array2=new Array("departamento","provincia","distrito");
	//if (validarCombo(array2)==true) est=false;
	
	if(est==true){
		var frm=document.frmDetalle;
		var bb=validarCheckBox(frm);
		if(bb==false){
			alert('seleccione una tematica');
			est=false;
		}else{
			var elem,cad="";
			for(var i=0;i<frm.elements.length;i++){
				if(frm.elements[i].type=="checkbox"){
					elem=frm.elements[i];
					if(elem.checked==true) cad+=","+elem.id.substr(3);
				}
			}
			cad=cad.substr(1);
			document.getElementById('chk').value=cad;
		}
	}
	
	var msg="";
	var errores=document.getElementById('errores');
	if(est==false) msg="Faltan datos<br>";
		
	if(est==false) errores.innerHTML="<font color='#ff0000' style='font-size:10px;'>" + msg + "</font>";
	return est;
}

function validarCheckBox(frm){
	var est=false;
	var elem;
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			if(elem.checked==true) est=true;
		}
	}
	return est;
}

//Correo INICIO
function valCorreo(){
	var est=true;
	var array=new Array("correo","clave","claveC");
	if (validarTexto(array)==true) est=false;
	
	return est;
}

function crearCorreo(){
	if(!valCorreo()) return;
	
	var clave=document.getElementById('clave').value;
	var claveC=document.getElementById('claveC').value;
	if(clave!=claveC){
		alert('Las contrasenas no son iguales, verifiquelos!');
		return;
	}
	
	var usu = document.getElementById('correo').value;
	var dato="usuario="+usu;
	cargarContenido('Cvista/cuentaDuplicado.php?'+dato,'errores');
	setTimeout("this.correoUPD()", 200);
}

function correoUPD(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	document.frmCorreo.submit();
}
//Correo FIN

function imprimirDIV(nombre){
	document.getElementById('noPrint').style.display='none';
	var ficha = document.getElementById(nombre);
	var ventimp = window.open(' ', 'popimpr');
	ventimp.document.write( ficha.innerHTML );
	ventimp.document.close();
	ventimp.print( );
	ventimp.close();
	document.getElementById('noPrint').style.display='block';
}

//Aula Virtual - Inicio
function valVirtualIns(){
	var est=true;
	var array=new Array("apellido","nombre","dni","telefono","celular","email_1","usuario");
	if (validarTexto(array)==true) est=false;	
	return est;
}

//Modificado 12-01-2011
function verVirtualDetalle(){
	var doc = document.getElementById('documento').value;
	var fNac = document.getElementById('fechaNac').value;
	if(doc.length<8){
		alert('Ingrese un DNI valido!');
		return;
	}
	var fecha=new Date();
	var ff=fNac.split('-');
	if(ff[2] >= fecha.getFullYear()-15){
		alert('Ingrese una fecha de nacimiento valida');
		return;
	}
	document.getElementById('fNac').value=fNac;
	
	var dato="doc="+doc+"&fNac="+fNac;
	cargarContenido('Cvista/virtualDetalle.php?'+dato,'detalle');
}

function virtualUsuSug(){
	var ape=document.getElementById('apellido').value;
	var nom=document.getElementById('nombre').value;
	
	apeA=ape.split(' ');
	nomA=nom.split(' ');
	
	var cad=nomA[0]+'.'+apeA[0];
	document.getElementById('usuario').value=cad.toLowerCase();
}

function verVirtualUsuario(){
	if(!valVirtualIns()) return;
	
	var usu = document.getElementById('usuario').value;
	var dato="usuario="+usu;
	cargarContenido('Cvista/virtualUsuario.php?'+dato,'errores');
	setTimeout("this.virtualUPD()", 100);
}

function virtualUPD(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	document.frmDato.submit();
}

function virtualAproDes(){
	var tipo=document.getElementById('tipo').value;
	var nom=document.getElementById('nombre').value;
	var dato="tipo="+tipo+"&nom="+nom;
	cargarContenido('Cvista/virtualLista.php?'+dato,'contenido');
}

function virtualListaDet(cod,nro){
	var dato="id="+cod+"&nro="+nro;
	cargarContenido('Cvista/virtualListaDet.php?'+dato,'detalle22');
}

function virtualUsuarioUPD(){
	var usu = document.getElementById('usuario').value;
	var dato="usuario="+usu;
	cargarContenido('Cvista/virtualUsuario.php?'+dato,'errores');
	setTimeout("this.virtualUsuarioUPD22()", 100);
}

function virtualUsuarioUPD22(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	
	var usuario=document.getElementById('usuario').value;
	var id=document.getElementById('idA').value;
	var tipo=document.getElementById('tipo').value;
	
	var dato="usu="+usuario+"&id="+id;
	cargarContenido('Cvista/virtualUsuarioUPD.php?'+dato,'detalle22');
	cargarContenido('Cvista/virtualLista.php?tipo='+tipo,'contenido');	
}

function virtualAceptaciones(tipo,cod,nro){
	var cad="";
	switch(tipo){
		case 0: cad="RECHAZAR"; break;
		case 1: cad="ACEPTAR"; break;
		case 2: cad="PRE-APROBAR"; break;
	}
	if(!confirm('¿Seguro que desea ' + cad + ' el registro numero ' + nro + '?')){
		tipo=100;
	}
	
	if(tipo==0){
		cad=prompt('Escriba el motivo por la cual desea rechazar el registro numero '+nro,'')
		if(cad.length==0){
			alert('Accion cancelada');
			tipo=100;
		}		
	}
	
	if(tipo!=100){
		var tipo22=document.getElementById('tipo').value;
		
		var dato="cad="+cad+"&tipo="+tipo+"&id="+cod;
		cargarContenido('Cvista/virtualAprobacion.php?'+dato,'detalle22');
		cargarContenido('Cvista/virtualLista.php?tipo='+tipo22,'contenido');
	}
}

//Aula Virtual - FIN


//Modificado 01/07/2011
function chkForum(control){
	var nom=control.name;
	var opcPiura=document.getElementById('opcPiura').value;
	if(opcPiura.length > 0){
		if(nom=="chkCDPiura"){
			control.checked=true;
			return;
		}else{
			var est=control.checked;
			control.checked= est;
			return;
		}		
	}else{
		control.checked=true;
	}
}
function verUsuario(){
	if(!valForumIns()) return;
	
	var usu = document.getElementById('usuario').value;
	var id=document.getElementById('idIntegrante').value;
	var dato="usuario="+usu+"&id="+id;
	cargarContenido('Cvista/forumUsuario.php?'+dato,'errores');
	setTimeout("this.forumUPD()", 100);
}
function forumUPD(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	document.frmDato.submit();
}
function valForumIns(){
	var est=true;
	var array=new Array("apellido","nombre","dni","telefono","celular","email_1","usuario");
	if (validarTexto(array)==true) est=false;	
	return est;
}
function verDetalleForum(){
	var doc = document.getElementById('documento').value;
	var fNac = document.getElementById('fechaNac').value;
	if(doc.length<8){
		alert('Ingrese un DNI valido!');
		return;
	}
	var fecha=new Date();
	var ff=fNac.split('-');
	if(ff[2] >= fecha.getFullYear()-15){
		alert('Ingrese una fecha de nacimiento valida');
		return;
	}
	document.getElementById('fNac').value=fNac;
	
	var dato="doc="+doc+"&fNac="+fNac;
	cargarContenido('Cvista/forumDetalle.php?'+dato,'detalle');
}

function forumUsuSug(){
	var ape=document.getElementById('apellido').value;
	var nom=document.getElementById('nombre').value;
	
	apeA=ape.split(' ');
	nomA=nom.split(' ');
	
	var cad=nomA[0]+'.'+apeA[0];
	document.getElementById('usuario').value=cad.toLowerCase();
}

function forumAproDes(){
	var tipo=document.getElementById('tipo').value;
	var nom=document.getElementById('nombre').value;
	
	var rubro=document.getElementById('rubro').value;
	var sede=document.getElementById('sede').value;
	
	var dato="tipo="+tipo+"&nom="+nom+"&rubro="+rubro+"&sede="+sede;
	cargarContenido('Cvista/forumLista.php?'+dato,'contenido');
}

function forumListaDet(cod,nro){
	var dato="id="+cod+"&nro="+nro;
	cargarContenido('Cvista/forumListaDet.php?'+dato,'detalle22');
}

function forumUsuarioUPD(){
	var usu = document.getElementById('usuario').value;
	var dato="usuario="+usu;
	cargarContenido('Cvista/forumUsuario.php?'+dato,'errores');
	setTimeout("this.forumUsuarioUPD22()", 100);
}

/*
function forumUsuarioUPD22(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	
	var usuario=document.getElementById('usuario').value;
	var id=document.getElementById('idIntegrante').value;
	var tipo=document.getElementById('tipo').value;
	
	//var dato="usu="+usuario+"&id="+id;
	

	var nom=document.getElementById('nombre').value;	
	var rubro=document.getElementById('rubro').value;
	var sede=document.getElementById('sede').value;	
	var dato="tipo="+tipo+"&nom="+nom+"&rubro="+rubro+"&sede="+sede+"&usu="+usuario+"&id="+id;
	
	
	cargarContenido('Cvista/forumUsuarioUPD.php?'+dato,'detalle22');
	cargarContenido('Cvista/forumLista.php?'+dato,'contenido');	
}
*/

//modificado 18-01-2011
function forumUsuarioUPD22(){
	var err = document.getElementById('error').value;
	if(err==1) return;
	
	var usuario=document.getElementById('usuario').value;
	var id=document.getElementById('idIntegrante').value;
	var tipo=document.getElementById('tipo').value;
	var cip=document.getElementById('cip').value;
	if(cip.length==0) cip=0;
	//var dato="usu="+usuario+"&id="+id;
	

	var nom=document.getElementById('nombre').value;	
	var rubro=document.getElementById('rubro').value;
	var sede=document.getElementById('sede').value;	
	var dato="tipo="+tipo+"&nom="+nom+"&rubro="+rubro+"&sede="+sede+"&usu="+usuario+"&id="+id+"&cip="+cip;
	
	
	cargarContenido('Cvista/forumUsuarioUPD.php?'+dato,'detalle22');
	cargarContenido('Cvista/forumLista.php?'+dato,'contenido');	
}

function forumAceptaciones(tipo,cod,nro){
	var cad="";
	switch(tipo){
		case 0: cad="RECHAZAR"; break;
		case 1: cad="ACEPTAR"; break;
		case 2: cad="PRE-APROBAR"; break;
	}
	if(!confirm('¿Seguro que desea ' + cad + ' el registro numero ' + nro + '?')){
		tipo=100;
	}
	
	if(tipo==0){
		cad=prompt('Escriba el motivo por la cual desea rechazar el registro numero '+nro,'')
		if(cad.length==0){
			alert('Accion cancelada');
			tipo=100;
		}		
	}
	
	if(tipo!=100){
		var tipo22=document.getElementById('tipo').value;
		
		var nom=document.getElementById('nombre').value;	
		var rubro=document.getElementById('rubro').value;
		var sede=document.getElementById('sede').value;	
		var dato2="tipo="+tipo22+"&nom="+nom+"&rubro="+rubro+"&sede="+sede;


		
		var dato="cad="+cad+"&tipo="+tipo+"&id="+cod;
		cargarContenido('Cvista/forumAprobacion.php?'+dato,'detalle22');
		cargarContenido('Cvista/forumLista.php?'+dato2,'contenido');
	}
}



// FORUM - Fin


//Creado 11/01/2011
function votaSeleccion(opc){
	if(opc==0){
		document.getElementById('curso').disabled=false;
		document.getElementById('nombreCurso').disabled=true;
		document.getElementById('descripcion').disabled=true;
	}
	
	if(opc==1){
		document.getElementById('curso').disabled=true;
		document.getElementById('nombreCurso').disabled=false;
		document.getElementById('descripcion').disabled=false;
	}
	
}

function votaIniRegistro(){
	var est=true;
	var array=new Array("documento","fechaNac");
	if (validarTexto(array)==true){
		alert('Ingrese los datos correctamente!');
		return;
	}
	
	var doc=document.getElementById('documento').value;
	var fNac=document.getElementById('fechaNac').value;
	
	if(doc.length<8){
		alert('Ingrese un DNI valido');
		return;
	}
	
	document.getElementById('fNac').value=document.getElementById('fechaNac').value;
	
	var dato="doc="+doc+"&fNac="+fNac;
	cargarContenido('Cvista/votCursoPos.php?'+dato,'detalle22');
}

function votaIns(){
	var est=true;
	var array=new Array("apellido","nombre","dni","telefono","celular","email_1");
	if (validarTexto(array)==true) est=false;	

	var array2=new Array("idSede");
	if (validarCombo(array2)==true) est=false;

	return est;
}

function votaUsuario(){
	if(!votaIns()) return;	
	
	document.frmVotacion.action="Cvista/votCursoPosUPD.php",
	document.frmVotacion.submit();
}

//creado 12-01-2011
function curAproSel(){
	var cant=0;
	var dato="";
	var elem;
	var frm=document.getElementById('frmCurAprobacion');
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			if(elem.checked==true){
				cant++;
				dato+=elem.value+",";
			}
		}
	}
	
	if(cant==0){
		alert('Elija el curso a inscribir');
		return;
	}
	
	dato=dato.substr(0,dato.length - 1);
	var cad="dato="+dato+"&opc=1";
	cargarContenido('Cvista/curAprobacionUPD.php?'+cad,'detalle22');
	cargarContenido('Cvista/curAprobacion.php','contenido');
}

/*
function curApro(accion,cod,cur){
	if(accion==1){ //ver detalle
		var cad="dato="+cod+"&opc=2";
		cargarContenido('Cvista/curAprobacionDet.php?'+cad,'detalle22');
	}
	
	if(accion==2){ //eliminar
		if(confirm('¿Desea eliminar el curso \n'+ cur +'?')){
			var cad="dato="+cod+"&opc=3";
			cargarContenido('Cvista/curAprobacionUPD.php?'+cad,'detalle22');
			cargarContenido('Cvista/curAprobacion.php','contenido');
		}
	}
}
*/

//Modificado 17-01-2011
function curApro(accion,cod,cur){
	if(accion==1){ //ver detalle
		var cad="dato="+cod+"&opc=2";
		cargarContenido('Cvista/curAprobacionDet.php?'+cad,'detalle22');
	}
	
	if(accion==2){ //eliminar
		if(confirm('¿Desea eliminar el curso \n'+ cur +'?')){
			var cad="dato="+cod+"&opc=3";
			cargarContenido('Cvista/curAprobacionUPD.php?'+cad,'detalle22');
			cargarContenido('Cvista/curAprobacion.php','contenido');
		}
	}
	if(accion==3){//Mostrar usuario quien voto
		var dato="curso="+cod+"&iden=2";
		cargarContenido('Cvista/curAperturaDet.php?'+dato,'detalle22');
	}
}

function curAproVal(){
	var est=true;
	var array=new Array("nombreL");
	if (validarTexto(array)==true) est=false;	
	return est;	
}

function curAperturaVal(){
	var cur=document.getElementById('idCurso').value;
	if(cur==0){
		alert('Elija el curso a Aperturar');
		return;
	}
	
	document.getElementById('fInicio').value=document.getElementById('fechaInicio').value;
	document.getElementById('fTermino').value=document.getElementById('fechaTermino').value;
	
	document.frmcurApertura.submit();
}

function curAperturaSede(cod){	
	var dato="codSede="+cod.value;
	cargarContenido('Cvista/curApertura.php?'+dato,'contenido');
}

function curAgregarLista(){
	var opc=document.frmVotacion.opcion[0].checked;
	if(opc==true) opc=1; else opc=2;
	
	if(opc==2){
		var dato1=document.getElementById('nombreCurso').value;
		dato1=dato1.replace(/^\s*|\s*$/g,"");

		if(dato1.length<=0){
			alert('Escriba el curso a sugerir');
			document.getElementById('nombreCurso').value="";
			return;
		}
		
		var dato2=document.getElementById('descripcion').value;
		dato2=dato2.replace(/^\s+|\s+$/g,"");
		if(dato2.length<=0){
			alert('Escriba una descripcion del curso a sugerir');
			document.getElementById('descripcion').value="";
			return;
		}
	}
	
	document.frmVotacion.action="Cvista/votCursoAgregar.php",
	document.frmVotacion.submit();
}
/*
function curVotacion(acc,sed,cur,des){
	if(acc==1){//Mostrar detalle de los votantes
		var dato="sede="+sed+"&curso="+cur;
		cargarContenido('Cvista/curAperturaDet.php?'+dato,'detalle22');
	}
}
*/

function curVotacion(acc,sed,cur,des){
	if(acc==1){//Mostrar detalle de los votantes
		var dato="sede="+sed+"&curso="+cur+"&iden=1";
		cargarContenido('Cvista/curAperturaDet.php?'+dato,'detalle22');
	}
}

//creado 18-01-2011
function curDetIntegrante(cod){
	var dato="cod="+cod;
	cargarContenido('Cvista/curDetIntegrante.php?'+dato,'detalle33');
}

//creado 18-01-2011
function curAlumnoImprimir(sed,cur){
	var dato="sede="+sed+"&curso="+cur;
	abrir_ventana('reportes/curAlumno.php?'+dato,'Impresion de Ingreso',400,300) ;
}

//Evento Dia de la Musica Criolla - INICIO
function valDatoRegistro(tipo, documento){
	if(tipo.value==0){
		alert('Seleccione un tipo de documento');
		tipo.focus();
		return false;
	}
	if(tipo.value==1 && documento.value.length<8){
		alert('Escriba correctamente su DNI');
		return false;
	}
	if(tipo.value==2 && documento.value.length<4){
		alert('Escriba correctamente su Nro CIP');
		return false;
	}
	return true;
}

//Evento Dia de la Musica Criolla - FIN

function valDatoDetalle22(){
	var est=true;
	var array=new Array("nombre","telPersonal","profesion","especialidad","email_1","direccion");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("departamento","provincia","distrito");
	if (validarCombo(array2)==true) est=false;
	
	if(est==true){
		var frm=document.frmDetalle;
		var bb=validarCheckBox(frm);
		if(bb==false){
			alert('seleccione una tematica');
			est=false;
		}else{
			var elem,cad="";
			for(var i=0;i<frm.elements.length;i++){
				if(frm.elements[i].type=="checkbox"){
					elem=frm.elements[i];
					if(elem.checked==true) cad+=","+elem.id.substr(3);
				}
			}
			cad=cad.substr(1);
			document.getElementById('chk').value=cad;
		}
	}
	
	var msg="";
	var errores=document.getElementById('errores');
	if(est==false) msg="Faltan datos<br>";
	
	var error=document.getElementById('error');
	if(error.value==1){est=false; msg+="Error de formato en curriculum vitae y/o foto";}
	
	if(est==false) errores.innerHTML="<font color='#ff0000' style='font-size:10px;'>" + msg + "</font>";
	
	return est;
}

//Tematica
function cargarTematicaLista(cod){
	var dato="cod="+cod;
	cargarContenido('Cvista/ppTematicaLista.php?'+dato,'detTematica');
}

function temSeleccionar(bb){
	var elem;
	var frm=document.getElementById('frmDato');
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			elem.checked=bb;
		}
	}
}

function temValidar(){
	var est=true;
	var frm=document.frmDato;
	var bb=validarCheckBox(frm);
	if(bb==false){
		alert('seleccione una tematica');
		est=false;
	}else{
		var elem,cad="";
		for(var i=0;i<frm.elements.length;i++){
			if(frm.elements[i].type=="checkbox"){
				elem=frm.elements[i];
				if(elem.checked==true) cad+=","+elem.id.substr(3);
			}
		}
		cad=cad.substr(1);
		document.getElementById('chk').value=cad;
	}
	
	return est;
}

//PP2040 - integracion
function validarMail(nom){
	var est=false;
	control = document.getElementById(nom);
	var mail=control.value;
	
	control.style.backgroundColor="#ffffff";
	cad=control.name + '_span';
	document.getElementById(cad).innerHTML="";
	
	var re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/;
	if(!re.exec(mail)) {
		control.style.backgroundColor="#ff0000";
		document.getElementById(cad).innerHTML="<font color='#ff0000'>*</font>";
		est=true;
	}
	
	return est;
}

function opcTrabajo(opc){
	var bb=true;
	if(opc==2) bb=false;
	else{
		document.getElementById("empresa").style.backgroundColor="#E5E5E5";
		document.getElementById("empresa_span").innerHTML="";
		
		document.getElementById("cargo").style.backgroundColor="#E5E5E5";
		document.getElementById("cargo_span").innerHTML="";
	}
	document.getElementById("btnBuscarEmpresa").disabled=bb;
	document.getElementById("btnBuscarCargo").disabled=bb;
	document.getElementById("telOficina").disabled=bb;
	document.getElementById("contacto").disabled=bb;
}

function selRegistro(nom,tipo){
	var strFeatures = "dialogTop=100px; dialogLeft=100px; dialogWidth=560px;" +
						"dialogHeight=400px; center=yes; help=no; font-family:Arial; font-size:12px"
	var valor = window.showModalDialog('Cvista/buscarRegistroPP.php?tipo='+tipo,'ventana1',strFeatures);
	if(valor.length>0){
		var tmp=valor.split(';');
		if(tmp.length==2){
			document.getElementById(nom).value = tmp[1];
			if(tipo==1) document.getElementById('idEmpresa').value = tmp[0];
			if(tipo==2) document.getElementById('idCargo').value = tmp[0];
			if(tipo==3) document.getElementById('idProfesion').value = tmp[0];
			if(tipo==4) document.getElementById('idEspecialidad').value = tmp[0];
		}
		
	}	
}

/*
function verDetalle(){
	var doc = document.getElementById('documento').value;
	var tipo=2;
	var dato="doc="+doc+"&tipo="+tipo;
	cargarContenido('Cvista/pp_Detalle.php?'+dato,'detalle');
}
*/

//modificado 19-01-2011
function verDetalle(evento){
	var doc = document.getElementById('documento').value;
	var dato="doc="+doc+"&evento="+evento;
	cargarContenido('Cvista/eveRegistroDetalle.php?'+dato,'detalle');
}

function cargarTematica(cod){
	var dato="cod="+cod;
	cargarContenido('Cvista/ppTematica.php?'+dato,'detTematica');
}

function temRegistrar(){
	if(!valDatoDetalle()){
		document.frmDetalle.submit();
	}
}

function ppListaIntegrante(cod){
	var dato="tipo="+cod;
	cargarContenido('Cvista/pp_BuscarDet.php?'+dato,'detalle');
	/*
	if(cod==3 || cod==8 || cod==4){
		var dato="tipo="+cod;
		cargarContenido('Cvista/pp_BuscarDet.php?'+dato,'detalle');
	}
	*/
}

//modificado 14-02-2011
function valDatoDetalle(){
	var est=true;
	var array=new Array("apellido","nombre","especialidad","email_1","direccion");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("departamento","provincia","distrito","tipo");
	if (validarCombo(array2)==true) est=false;

	//Validar Centro de trabajo
	var opc=document.frmDetalle.opcion[1].checked;
	if(opc==true){
		var array3=new Array("empresa","cargo");
		if (validarTexto(array3)==true) est=false;
	}
	
	//Asignar titulo al participante
	document.getElementById('titulo1').value=document.getElementById('tit1').value;
	
	//Validacion de email
	if(validarMail('email_1')==true){
		est=false;
		alert("email obligatorio invalido!!!");
	}
	
	var mail2=document.getElementById('email_2').value;
	if(mail2.length>0){
		if(validarMail('email_2')==true){
			est=false;
			alert("email opcional invalido!!!");
		}	
	}
	
	//validar nroColegiatura
	var colegio=document.getElementById('colProf').value;
	if(colegio>0){
		var nroCole=document.getElementById('nroCole').value;
		nroCole = nroCole.replace(/^\s*|\s*$/g,"");
		if(nroCole.length<=0){
			alert('Escriba su numero de colegiatura!!!');
			est=false;
		}else{
			document.getElementById('nroColegiatura').value=nroCole;
			document.getElementById('colProfesional').value=colegio;
		}
		
	}
	
	//Validar telefonos
	var tel1=document.getElementById('telPersonal').value;
	var tel2=document.getElementById('claroMovil').value;
	var tel3=document.getElementById('claroRadio').value;
	var tel4=document.getElementById('movistarMovil').value;
	var tel5=document.getElementById('movistarRadio').value;
	var tel6=document.getElementById('nextelRadio').value;
	
	tel3 = tel3.replace(/^\s*|\s*$/g,"");
	tel5 = tel5.replace(/^\s*|\s*$/g,"");
	tel6 = tel6.replace(/^\s*|\s*$/g,"");
	
	var ccant=0;
	if(tel1.length>0) ccant++;
	if(tel2.length>0) ccant++;
	if(tel3.length>0) ccant++;
	if(tel4.length>0) ccant++;
	if(tel5.length>0) ccant++;
	if(tel6.length>0) ccant++;
	if(ccant==0){
		alert("Escriba algun numero telefonico!!!");
		est=false;
	}
	
	if(est==true){
		var frm=document.frmDetalle;
		var bb=validarCheckBox(frm);
		if(bb==false){
			alert('seleccione una tematica');
			est=false;
		}else{
			var elem,cad="";
			for(var i=0;i<frm.elements.length;i++){
				if(frm.elements[i].type=="checkbox"){
					elem=frm.elements[i];
					if(elem.checked==true) cad+=","+elem.id.substr(3);
				}
			}
			cad=cad.substr(1);
			document.getElementById('chk').value=cad;
		}
	}
	
	var msg="";
	var errores=document.getElementById('errores');
	if(est==false) msg="Faltan datos<br>";
	
	var error=document.getElementById('error');
	if(error.value==1){est=false; msg+="Error de formato en curriculum vitae y/o foto";}
	
	if(est==false) errores.innerHTML="<font color='#ff0000' style='font-size:10px;'>" + msg + "</font>";
	
	return est;
}

function ppActivarNroColegiatura(cod){
	if(cod==0){
		document.getElementById('nroCole').value='';
		document.getElementById('nroCole').disabled=true;
		document.getElementById('colProfesional').value=0;
	}else{
		document.getElementById('nroCole').disabled=false;
		document.getElementById('colProfesional').value=cod;
	}
}

//Functiones para las votaciones
function verCapaAll(capa){
	capas=document.getElementsByTagName('div');
	for (i=0;i<capas.length;i++){
		if(capas[i].id.indexOf('div') != -1) capas[i].style.display='none';
	}
	document.getElementById(capa).style.display = "block";
}

function encRegistro(){
	var est=true;
	var array=new Array("documento","fechaNac");
	if (validarTexto(array)==true){
		alert('Ingrese los datos correctamente!');
		return;
	}
	
	var doc=document.getElementById('documento').value;
	var fNac=document.getElementById('fechaNac').value;
	
	if(doc.length==0){
		alert('Ingrese un CIP valido');
		return;
	}
	
	document.getElementById('fNac').value=document.getElementById('fechaNac').value;
	
	var dato="doc="+doc+"&fNac="+fNac;
	cargarContenido('Cvista/encRegistroColegiado.php?'+dato,'detalle22');
}

function encRegistroUPD_Aux1(){
	var est=true;
	var array=new Array("apellido","nombre","telefono","celular","email_1");
	if (validarTexto(array)==true) est=false;
	
	var array2=new Array("departamento","provincia","distrito");
	if (validarCombo(array2)==true) est=false;

	return est;
}

function encRegistroUPD_Aux2(){
	est=true;
	var elem,cad="",otro=true;
	var frm=document.frmEncuesta;
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			if(elem.checked==true){
				cad+=","+elem.id.substr(3);
				if(elem.id.substr(3)=="13109") otro=false;
			}
			
		}
	}
	if(cad.length>0) {
		cad=cad.substr(1); 
		document.getElementById('chk').value=cad;	
	}else{
		est=false;
		alert("Seleccione los elementos a votar!");
	}
		
	//Validar otros
	if(!otro){
		var caja=document.getElementById('otros').value;
		caja= caja.replace(/^\s*|\s*$/g,"");
		if(caja.length==0){
			est=false;
			alert('Escriba el nombre de algun servicio que desea que se implemente en el casillero de otros.');
		}
	}
	
	return est;
}

function encRegistroUPD(){
	if(!encRegistroUPD_Aux1()) return;	
	if(!encRegistroUPD_Aux2()) return;	
	
	document.frmEncuesta.action="Cvista/encRegistroUPD.php",
	document.frmEncuesta.submit();
}

function eveReporte(){
	var tipo=document.getElementById('tipoEvento').value;
	var anio=document.getElementById('anio').value;
	var mes=document.getElementById('mes').value;
	var evento=document.getElementById('evento').value;
	
	var dato="carga=1&tipo="+tipo+"&anio="+anio+"&mes="+mes+"&evento="+evento;
	cargarContenido('Cvista/eveReporte.php?'+dato,'contenido');
}

function mailCP(){
	var est=true;
	var array=new Array("claveNueva","claveNuevaC");
	if (validarTexto(array)==true) est=false;
	
	//Verificar la igualdad de contraseñas
	var clave=document.getElementById('claveNueva').value;
	var claveC=document.getElementById('claveNuevaC').value;
	clave= clave.replace(/^\s*|\s*$/g,"");	
	claveC= claveC.replace(/^\s*|\s*$/g,"");
	if(clave!=claveC){
		est=false;
		alert('La nueva contrasena y su confirmacion deben ser iguales!');
	}
	if(clave.length<4){
		est=false;
		alert('Escriba al menos 4 caracteres para la nueva contrasena');
	}
	
	return est;	
}

function encAprobar(id,estado, texto){
	var est=false, cad='', cad01='', cad02='', msg01='', msg02='';
	if (estado==1){	
		if(confirm('¿Seguro que desea aprobar la Solicitud?')){
			est=true;
			msg01='Escriba el nuevo nombre del servicio?';
			msg02='Escriba una breve descripcion del servicio a mostrar en la web';
			cad01=prompt(msg01,texto);
			cad02=prompt(msg02,'');
		};
	}else{
		if(confirm('¿Seguro que desea Rechazar la Solicitud?')){
			est=true;
			msg02='Escriba el motivo por la cual esta rechazando este servicio';
			cad02=prompt(msg02,'');
		};
	}
	if (est==true){
		cad="id="+id+"&estado="+estado+"&cad01="+cad01+"&cad02="+cad02;
		cargarContenido('Cvista/encReporteUPD.php?'+cad,'detalle22');
		cargarContenido('Cvista/encReporteOtros.php?cod=13109','contenido')
	}
}

function emailAumentarEspacio(){
	document.getElementById('detalle33').style.display = "none";
	cargarContenido('Cvista/cuentaCorreo.php?cuota=1','contenido');
}

function cnissTipoCarga(dato){
	document.getElementById('tipo').value=dato;
}

//Funcion temporal - INICIO
function perfilCV2(control,cod){
	var indice = document.form.selectPerfil.selectedIndex;
	if(indice == 0){
		cargarContenido('Cvista/cv2.php','detalle_colegiado');
		return;
	}

	var sel = document.form.selectPerfil.options[indice].text;
	var texto = document.getElementById(control);
	texto.value=sel.substr(11);
	
	var nuevo=1;
	texto.value=texto.value.toUpperCase();
	if(texto.value=="VACIO") nuevo=0;
	
	var perfil = document.getElementById("selectPerfil").value;
	var titulo = texto.value;
	cargarContenido('Cvista/cvDetalle2.php?nn='+aleatorio()+'&sw=1&perfil=' + perfil + "&nuevo=" + nuevo + "&titulo=" + titulo + "&cod="+cod,'detalle');
}
function imprimir_cv2(id,tipo){
    //abrir_ventana('reportes/cv.php?id='+id+'&tipo='+tipo,'Impresion de CV',700,600) ;
	var dire="Cvista/verCV2.php?id="+id+"&tipo="+tipo;
	var result = window.showModalDialog(dire, '', "dialogWidth:800px; dialogHeight:600px; center:yes");
}
function imprimir_cvPDF2(id,tipo){
    //abrir_ventana('reportes/cv.php?id='+id+'&tipo='+tipo,'Impresion de CV',700,600) ;
    abrir_ventana('reportes/cv2.php?id='+id+'&tipo='+tipo,700,600) ;

}
function cambiarFoto2(foto,form){	
	//var dire="Cvista/cambiarFoto.php?foto="+foto;
	var dire="Cvista/cambiarFoto2.php";
		//var dato=getDatoCV1();
	var result = window.showModalDialog(dire, form, "dialogWidth:280px; dialogHeight:280px; center:yes");
}
//Funcion temporal - FIN

function forumCipLista(){
	var cap = document.getElementById("capitulo").value;
	var sed = document.getElementById("sede").value;
	var dato="capitulo=" + cap + "&sede=" + sed;
	cargarContenido('Cvista/ForumCipListaDet.php?'+dato,'detalle22');
}

//creado 21-01-2011
function cntImprimir(){
	var cod=document.getElementById('impresion').value;
	var dato="cod="+cod;
	if(cod > 1){		
		var sede=document.getElementById('cboSede').value;
		dato += "&sede=" + sede;		
	}
	
	abrir_ventana('reportes/cntExcel.php?'+dato,'Impresion de Ingreso',400,300) ;
}

//creado 24-01-2011
function cntDetImprimir(){
	var cod=document.getElementById('impresion').value;
	var dato="cod="+cod;
	if(cod > 1){		
		var sede=document.getElementById('cboSede').value;
		dato += "&sede=" + sede;		
	}
	
	abrir_ventana('reportes/cntExcelDet.php?'+dato,'Impresion de Ingreso',400,300) ;
}
function printComisionPP(cod){
	if(cod==1){
		document.getElementById("cboSede").disabled= true;
	}else{
		document.getElementById("cboSede").disabled= false;
	}
}

function repEventoInscrito(){
	var eve=document.getElementById('evento').value;
	if(eve==0){
		alert('Para mostrar listado de participantes, debe seleccionar un evento!');
		return;
	}
	var dato="evento="+eve;
	cargarContenido('Cvista/repEventoInscritoDet.php?'+dato,'detalle22');
}

function repEventoInscritoExcel(){
	var eve=document.getElementById('evento').value;
	if(eve==0){
		alert('Para mostrar listado de participantes en excel, debe seleccionar un evento!');
		return;
	}
	var dato="evento="+eve;
	abrir_ventana('reportes/repEventoInscrito.php?'+dato,'Impresion de Ingreso',400,300) ;
}

//REGISTRO CIADES INICIO
function ciades_busqueda(){
	var sector=document.getElementById('sector').value;
	var dato="sector="+sector;
	
	cargarContenido('Cvista/ciades_busqueda.php?'+dato,'contenido');
}
function ciades_busquedaDetalle(tipo){
	var opcion=mostrar_valor_seleccionado('opcion');
	var codigo=0;
	if(opcion==1) {
		codigo=document.getElementById('proyecto').value;
		document.getElementById('ciades_busquedaLista').innerHTML="";
	}else{
		codigo=document.getElementById('codigo').value;
	}
	var dato="opcion="+opcion+"&dato="+codigo;
	
	if(tipo==1) cargarContenido('Cvista/ciades_busquedaDet.php?'+dato,'detalle22');
	if(tipo==2)	abrir_ventana('reportes/ciades_lista.php?'+dato,'Impresion de Ingreso',400,300) ;
}
//REGISTRO CIADES FIN

//Reporte de Colegiados por Capitulos - INICIO
function repSedeCapitulo(){
	var fecDel=document.getElementById('fecDel').value;
	var fecHasta=document.getElementById('fecHasta').value;
	
	var dato="fecDel="+fecDel+"&fecHasta="+fecHasta;
	abrir_ventana('reportes/repSedeCapituloFecha.php?'+dato,700,600);
}

//Reporte de Colegiados por Capitulos - FIN

//biblioteca virtual
function biv_tipoMaterial(){
	var tMat=document.getElementById('tipoMaterial').value;
	var bAutor=document.getElementById('btnAutor');
	var bEdi=document.getElementById('btnEditorial');
	
	if(tMat==1){
		bAutor.disabled=false;
		bEdi.disabled=false;
	}else{
		bAutor.disabled=true;
		bEdi.disabled=true;
	}	
}

function biv_mostrarAutor(){
	var strFeatures = "dialogTop=100px; dialogLeft=100px; dialogWidth=560px;" +
					"dialogHeight=400px; center=yes; help=no; font-family:Arial; font-size:12px"
		
		var valor = window.showModalDialog('Cvista/biv_manAutorFrame.php','ventana1',strFeatures);
		valor += "";
		//alert(valor);
		if(valor.length>0){
			var tmp=valor.split(';');
			if(tmp.length==2) {
				document.getElementById('idAutor').value=tmp[0];
				document.getElementById('autor').value=tmp[1];
			}
		}	
}

function biv_mostrarEditorial(){
	var strFeatures = "dialogTop=100px; dialogLeft=100px; dialogWidth=560px;" +
					"dialogHeight=400px; center=yes; help=no; font-family:Arial; font-size:12px"
		
		var valor = window.showModalDialog('Cvista/biv_manEditorialFrame.php','ventana1',strFeatures);
		valor += "";
		//alert(valor);
		if(valor.length>0){
			var tmp=valor.split(';');
			if(tmp.length==2) {
				document.getElementById('idEditorial').value=tmp[0];		
				document.getElementById('editorial').value=tmp[1];
			}
		}	
}

function biv_mostrarDonante(){
	var strFeatures = "dialogTop=100px; dialogLeft=100px; dialogWidth=560px;" +
					"dialogHeight=400px; center=yes; help=no; font-family:Arial; font-size:12px"
		
		var valor = window.showModalDialog('Cvista/biv_manDonanteFrame.php','ventana1',strFeatures);
		valor += "";
		//alert(valor);
		if(valor.length>0){
			var tmp=valor.split(';');
			if(tmp.length>=2) {
				document.getElementById('idDonante').value=tmp[0];
				document.getElementById('donante').value=tmp[2];
				document.getElementById('tipoDonante').value=tmp[1];
				
				var arr = tmp[2].split(':');
				document.getElementById('docDonante').value=arr[0];
			}
		}	
}

function biv_valRegistro(){
	var est=true;
	var array=new Array("donante","titulo1","nroPagina");
	if (validarTexto(array)==true) est=false;

	var array2=new Array("tipoMaterial","estado");
	if (validarCombo(array2)==true) est=false;
	
	var obj1=document.getElementById('tipoMaterial').value;
	if(obj1==1){
		var array=new Array("autor","editorial");
		if (validarTexto(array)==true) est=false;
	}
	if(obj1==2){
		document.getElementById('idAutor').value=1;
		document.getElementById('idEditorial').value=1;
	}
	
	var valDig=0;
	var dig = document.getElementById('digital').checked;
	if (dig==true) valDig=1;
	document.getElementById('isDigital').value=valDig;
	document.getElementById('fechaP').value=document.getElementById('fechaPub').value
	
	document.getElementById('btnGrabar').disabled=est;
	return est;
}

function biv_texto_busqueda(){
	var opci=mostrar_valor_seleccionado('rbOpcion');
	var msg="";
	if(opci==1) msg="Escriba un titulo:";
	if(opci==2) msg="Escriba una editorial:";
	if(opci==3) msg="Escriba apellido y nombre:";
	if(opci==4) msg="Escriba apellido y nombre:";
	
	document.getElementById('txtB').innerHTML=msg;	
}

function biv_buscar(){
	var opci=mostrar_valor_seleccionado('rbOpcion');
	var mate=mostrar_valor_seleccionado('rbMaterial');
	var text=document.getElementById('txtBusqueda').value;	
	
	var dato="opcion="+opci+"&material="+mate+"&texto="+text;
	cargarContenido('Cvista/biv_busquedaDet.php?'+dato,'detalle');
}

function valCuentaCorreo2(){
	var est=true;
	var array=new Array("nroCIP","dni");
	if (validarTexto(array)==true) est=false;
	
	return est;
}

function enviarSolicitudCuenta(){
	var dato = "cuenta=1";
	cargarContenido('Cvista/cuentaCorreo2.php?'+dato,'detalle_colegiado');
}

function probarCorreo(id,estado,cip){
	var est=false;
	var mail="";
	if (estado==1){	
		if(confirm('¿Seguro que desea aprobar la Solicitud de correo?')){
			est=true;
		};
	}
	
	if (est==true){
		mail=prompt('Ingrese el correo creado del CIP '+cip,'');
		if(mail==null || mail.length==0){
			alert('Peticion cancelada');
			return;
		}
		var dato="id="+id+"&estado="+estado+"&mail="+mail+"&cip="+cip;
		cargarContenido('Cvista/cuentaCorreo2UPD.php?'+dato,'detalle22');
		cargarContenido('Cvista/cuentaCorreo2_Lista.php','contenido');
	}
}

function correo_exportar(codMax){
	var dato="codMax="+codMax;
	abrir_ventana('reportes/correoXLS.php?'+dato,'Impresion de Ingreso',400,300) ;
}

function correo_aprobar(codMax){
	var frm=document.frmExpediente;
	if(!existeCheckBox(frm)){
		alert('No existe registro para recepcionarlo');
		return;
	}
	
	var elem,cad="";
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			if(elem.id!='allchk')
				if(elem.checked==true) cad+=","+elem.id.substr(3);
		}
	}
	if(cad.length==0){
		alert('No hay elementos seleccionado');
		return;		
	}
	
	cad=cad.substr(1);
	document.getElementById('chk').value=cad;	
	
	var dato="codMax="+codMax+"&chk="+cad;
	cargarContenido('Cvista/cuentaCorreo2UPD.php?'+dato,'contenido');
	setTimeout("this.correo_aprobarMov()", 1000);
	
}

function correo_aprobarMov(){		
	cargarContenido('Cvista/cuentaCorreo2_Lista.php','contenido');
}


function evenRegistroVal(){
	var est=true;
	var opcion=mostrar_valor_seleccionado('tipoPago');
	if(opcion==2){
		var pago=document.getElementById('pago').value;
		if(pago.length==0) {
			alert('Escriba el importe del evento');
			est=false;
		}
	}
	
	return est;
}

function findParticipante(){
	var dni=document.getElementById('dni').value;
	if(dni.length<8){
		alert('Escriba correctamente el DNI');
		return;
	}
	
	var dato="dni="+dni;
	cargarContenido('Cvista/evenParticipanteFind.php?'+dato,'busParticipante');
}

function addParticipante(){
	var dni=document.getElementById('dni').value;
	if(dni.length<8){
		alert('Escriba correctamente el DNI');
		return;
	}
		
	var eve=document.getElementById('idEvento').value;
	
	var dato="sw=1&dni="+dni+"&id="+eve+"&asi=1";
	cargarContenido('Cvista/evenParticipanteLista.php?'+dato,'contenido');
}

function evenNuevoParticipante(){
	var dni=document.getElementById('dni').value;
	if(dni.length<8 && dni.length>0){
		alert('Escriba correctamente el DNI');
		return;
	}
		
	var eve=document.getElementById('idEvento').value;
	var dato="dni="+dni+"&id="+eve;
	
	cargarContenido('Cvista/evenParticipanteBuscar.php?'+dato,'contenido');
}

function evenExpositorFind(){
	var ape=document.getElementById('apellido').value;
	var nom=document.getElementById('nombre').value;
	var eve=document.getElementById('codEvento').value;
	
	var dato="ape="+ape+"&nom="+nom+"&id="+eve;
	cargarContenido('Cvista/evenExpositorFind.php?'+dato,'busqueda');
}
function evenParticipanteBuscar(){
	var ape=document.getElementById('apellido').value;
	var nom=document.getElementById('nombre').value;
	var eve=document.getElementById('idEvento').value;
	
	var dato="ape="+ape+"&nom="+nom+"&id="+eve;
	cargarContenido('Cvista/evenParticipanteBuscar.php?'+dato,'contenido');	
}

function evenExpositorSeleccionar(codigo,tipo){
	var eve=document.getElementById('idEvento').value;
	
	var dato="id="+eve+"&tipo="+tipo+"&codigo="+codigo;
	cargarContenido('Cvista/evenExpositorEvento.php?'+dato,'contenido');
}

function evenExpositorVal(){
	var est=true;
	var array=new Array("apellido","nombre");
	if (validarTexto(array)==true) est=false;
	
	var objDNI=document.getElementById('dni');
	var dni=objDNI.value;
	if(dni.length>0 && dni.length<8){
		alert('DNI invalido');
		est=false;
	}
	//document.getElementById('codEvento').value=document.getElementById('idEvento').value;	
	if(est && dni.length==0) objDNI.value=0;
	
	return est;
}

function evenRegConstancia(dato,par){
	var msg="Desea generar una constancia(certificado o diploma) para "+par+"?";
	if(confirm(msg)){
		cargarContenido('Cvista/evenParticipanteLista.php?'+dato,'contenido');
	}
}

function evenParticipanteExcel(){
	var eve=document.getElementById('idEvento').value;
	var dato="evento="+eve;
	abrir_ventana('reportes/evenParticipanteExcel.php?'+dato,'Impresion de Ingreso',400,300) ;
}

function evenPrintConstancia(){
	var frm=document.frmRegistroDet;
	var bb=validarCheckBox(frm);
	var msg="seleccione constancia a imprimir?";
	if(bb==false){
		alert(msg);
		return;
	}else{
		var elem,cad="";
		for(var i=0;i<frm.elements.length;i++){
			if(frm.elements[i].type=="checkbox"){
				elem=frm.elements[i];
				if(elem.id != "allchk")
					if(elem.checked==true) cad+=","+elem.id.substr(3);
			}
		}
		if(cad.length==0){
			alert(msg);
			return;
		}
		cad=cad.substr(1);
		document.getElementById('chk').value=cad;
	}
	
	var eve=document.getElementById('idEvento').value;
	var dato="chk="+cad+"&eve="+eve;
	abrir_ventana('reportes/evenPrintConstancia.php?'+dato,'Impresion',700,600) ;
}

function evenRegistroListadoAll(est){
	var frm=document.frmRegistroDet;
	var elem,cad="";
	for(var i=0;i<frm.elements.length;i++){
		if(frm.elements[i].type=="checkbox"){
			elem=frm.elements[i];
			elem.checked=est;
		}
	}
}

function evenParticipanteListaDet(){
	var eve=document.getElementById('idEvento').value;
	var chk=document.getElementById('chkConstancia').checked;
	if(chk) document.getElementById('chkAsistencia').checked=!chk;
	if(chk) opc=14; else opc=1;
	
	var dato="id="+eve+"&opc="+opc;
	cargarContenido('Cvista/evenParticipanteListaDet.php?'+dato,'evenDetalleLista');
}

function evenParticipanteAsistente(){
	var eve=document.getElementById('idEvento').value;
	var chk=document.getElementById('chkAsistencia').checked;
	if(chk) document.getElementById('chkConstancia').checked=!chk;
	if(chk) opc=17; else opc=1;
	
	var dato="id="+eve+"&opc="+opc;
	cargarContenido('Cvista/evenParticipanteListaDet.php?'+dato,'evenDetalleLista');	
}

function vig_equipo(nro){
	var chk=document.getElementById('chkEquipo'+nro);
	var cbo=document.getElementById('equipo'+nro);
	var txt=document.getElementById('serie'+nro);
	
	cbo.disabled= !chk.checked;
	txt.disabled= !chk.checked;	
}

function vig_ingresoProcesar(){
	var opcion=mostrar_valor_seleccionado('rbDocumento'); //1:DNI  2:CIP
	var nro=document.getElementById('nroDocumento').value;
	
	var dato="opcion="+opcion+"&nro="+nro;
	cargarContenido('Cvista/vig_ingresoDet.php?'+dato,'vig_detalle');
}

function mol_buscarCiudadano(){    
    var obj = document.getElementById("texto");
    var bus = obj.value;
    bus= bus.replace(/^\s*|\s*$/g,"");
    obj.value=bus;
    
    var nro = document.getElementById("nro").value;
    var opc=mostrar_valor_seleccionado('opcion'); //1:CIP  2:DNI  3:ApeNom

    var est=true;
    if(opc==1 && bus.length<3){
            alert('Escriba correctamente el nro de CIP(Minimo 3 caracteres)');
            est=false;
    }
    if(opc==2 && bus.length!=8){
            alert('Escriba correctamente el nro de DNI(8 caracteres)');
            est=false;
    }
    if(opc==3 && bus.length < 4){
            alert('Escriba por lo menos 4 caracteres de busqueda');
            est=false;
    }
    if(est==false) return;

    var dato="opcion="+opc+"&texto="+bus+"&nro="+nro;
    cargarContenido('Cvista/molBuscarCiudadanoDet.php?'+dato,'detalle');
	
	cargarContenido('Cvista/mensaje.php?tipo=9','detalle22');
}

function vig_valIngresoDet(){
    var est=true;
    var des = document.getElementById("lugarDestino").value;
    var mot = document.getElementById("motivoVisita").value;
    
    if(des==0 || mot.length==0){
        alert('Seleccione o escriba dato en Lugar Destino y/o Motivo Visita');
        est=false;
    }else{
        var chk1 = document.getElementById("chkEquipo1").checked;
        var chk2 = document.getElementById("chkEquipo2").checked;
        var chk3 = document.getElementById("chkEquipo3").checked;
        
        if(chk1){
            var eq = document.getElementById("equipo1").value;
            var se = document.getElementById("serie1").value;
            if(eq==0 || se.length==0){
                est=false;
            }
        }
        if(chk2){
            var eq = document.getElementById("equipo2").value;
            var se = document.getElementById("serie2").value;
            if(eq==0 || se.length==0){
                est=false;
            }
        }
        if(chk3){
            var eq = document.getElementById("equipo3").value;
            var se = document.getElementById("serie3").value;
            if(eq==0 || se.length==0){
                est=false;
            }
        }
        if(!est) alert('Seleccione o escriba el equipo y/o serie correspondiente');
    }

    return est;
}

function vig_valCiudadano(){
    var est=true;
    var array=new Array("apellido","nombre");
    if (validarTexto(array)==true) est=false;
    
    var obj = document.getElementById("dni");
    var dni = obj.value;
    dni= dni.replace(/^\s*|\s*$/g,"");
    obj.value=dni;
    
    if (!(dni.length == 0 || dni.length == 8)){
        alert('DNI debe tener 8 caracteres');
        est=false;
    }
    
    return est;
}

function btn_submit(frm,nro){
    var est=true;
    switch(nro){
        case 1: est=vig_valIngresoDet(); break;
        case 2: est=vig_valCiudadano(); break;
    }
    
    if(est) frm.submit();
}

function vig_listaES(){
    var fd = document.getElementById("fechaDel").value;
    var fa = document.getElementById("fechaAL").value;
    
    var dato="fechaD="+fd+"&fechaA="+fa;
    cargarContenido('Cvista/vig_listaES.php?'+dato,'detalle');
}

function evenListaEvento(){
	var tipo=document.getElementById('tipoEvento').value;
	var anio=document.getElementById('anio').value;
	var mes=document.getElementById('mes').value;
	var evento=document.getElementById('evento').value;
	
	var dato="carga=1&tipo="+tipo+"&anio="+anio+"&mes="+mes+"&evento="+evento;
	cargarContenido('Cvista/evenEventoLista.php?'+dato,'contenido');
}

function ste_expedienteDelete(id,res){
	if(confirm('Desea eliminar la resolucion:\n' + res + '?')){
		var dato="id="+id+"&opc=0";
		cargarContenido('Cvista/ste_expedienteDelete.php?'+dato,'contenido');
		setTimeout("this.ste_expedienteDelFinal()", 1000);
	}
	
}

function ste_expedienteDelFinal(){
	cargarContenido('Cvista/ste_expedienteLista.php','contenido');
}

function ste_expedienteSeleccion(){
	var frm=document.frmLista;
	var bb=validarCheckBox(frm);
	if(bb==false){
		alert('seleccione elemento a Aprobar');
	}else{
		var elem,cad="";
		for(var i=0;i<frm.elements.length;i++){
			if(frm.elements[i].type=="checkbox"){
				elem=frm.elements[i];
				if(elem.checked==true) cad+=","+elem.id.substr(3);
			}
		}
		cad=cad.substr(1);
		//alert(cad);
		var dato="id="+cad+"&opc=1";
		cargarContenido('Cvista/ste_expedienteDelete.php?'+dato,'contenido');
		setTimeout("this.ste_expedienteDelFinal()", 1000);
	}	
}

function ste_expedienteLista(){
	var est = document.getElementById("estado").value;
	var idSede = document.getElementById("idSede").value;
    var cip = document.getElementById("cip").value;
    
    var dato="idSede="+idSede+"&cip="+cip+"&estado="+est;
    cargarContenido('Cvista/ste_expedienteLista.php?'+dato,'contenido');
}

function ste_expedienteVal(){
	var est=true;
	eliminarVacios('nroExpediente');
	var nroE = document.getElementById("nroExpediente").value;
	var fecI = document.getElementById("fechaI").value;
	var fecF = document.getElementById("fechaF").value;
	document.getElementById("fechaInicio").value=fecI;
	document.getElementById("fechaFin").value=fecF;
	
	var msg="";
	if(nroE.length==0) msg+="Escriba Nro Expediente\n";
	if(fecI.length==0) msg+="Escriba Fecha que inicio el expediente";
	if(msg.length>0){
		alert(msg);
		est=false;
	}
	return est;
}

function ste_tipoFalta(cbo){
	var verCHK = document.getElementById("verCHK");
	if(cbo.value==1) verCHK.style.display="block"; else verCHK.style.display="none";
}

function ste_resolucionVal(){
	var est=true;
	eliminarVacios('nroResolucion');
	var res = document.getElementById("nroResolucion").value;
	var chk = document.getElementById("chkResolucion").checked;
	var tipo = document.getElementById("tipoResolucion").value;
	var fRes = document.getElementById("fecha").value;
	//var fCar = document.getElementById("fechaCargo").value;
	
	var msg="";
	if(res.length==0) msg+="Ingrese Nro Resolucion\n";
	if(fRes.length==0) msg+="Ingrese fecha de Resolucion\n";
	
	if(chk){
		var pdf = document.getElementById("resolucion").value;
		if(pdf.length==0) msg+="Ingrese Resolucion en PDF\n";
	}
	if(tipo==1){
		var falta = document.getElementById("tipoFalta").value;
		var tt = document.getElementById("tiempo").value;
		var uni = document.getElementById("unidad").value;
		var art = document.getElementById("articulo").value;
		
		if(falta==0) msg+="Ingrese el Tipo de Falta\n";
		if(tt.length==0) msg+="Ingrese el tiempo de de castigo\n";
		if(uni==0) msg+="Ingrese la unidad de castigo\n";
		if(art.length==0) msg+="Ingrese articulos transgredido\n";
	}
	//if(fCar.length==0) msg+="Ingrese fecha de Recepcion\n";
	if(msg.length>0){
		est=false;
		alert(msg);
	}
	
	return est;
}

function molBuscarCiuOpcion(nroFrm,opc){
	var opcion=document.frmBuscar.opcion[opc-1];
	opcion.checked=true;
}

