function cargar_cerrar()
	{
	var UserClicked=false; 
	document.onkeydown=spyclick; 
	document.onmousedown=spyclick; 
	function spyclick() 
	{ 
	UserClicked=true; 
	setTimeout("UserClicked=false",2000); 
	} 
	function popup() 
	{ 
	if(!UserClicked) 
	{ 
	//var win=window.open("adios.php","","width=500,height=200") 
	} 
	} 
	//window.onbeforeunload=popup; 
	}



_editor_url = "wysiwyg";
  _editor_lang = "sp";
var editor = null;
  function initEditor() {
 var config = {
        interface: ["full"],  //full,nosave,reduce,minimo
		tablesprop: ["yes"],  //yes,no
		fullscreen: ["0"],   //no tocar
		pdefault: ["3"]    //no implementado
	};
  function ini(){
  editor = new NINBOX("txt_contenido",config);
 // comment the following two lines to see how customization works
  editor.generate();
  return false;
   }
   setTimeout(ini,250);
  }

function cargar_tab_sesion(usuario)
	{
	usuario.focus();
	}

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function cargar_tab_index(txt_caja)
	{
	txt_caja.focus();
	}
function validar_responder_tarea()
	{

	var file;
	var msg="";
	file=document.form.txt_tarea_nombre.value; 
	extArray = new Array(".pptx",".xlsx",".docx",".doc",".xls",".ppt",".txt",".rtf",".zip",".rar",".pdf",".vsd");  
	allowSubmit = false; 
	
	ext = file.slice(file.indexOf(".")).toLowerCase(); 
	for (var i = 0; i < extArray.length; i++) 
		{ 
		if (extArray[i] == ext)
			{ 
			allowSubmit = true; 
			break; 
			}
		} 
	
	
	if (allowSubmit) { 
	} else { 
	
	if(file!="")
		{
		msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
		
		}
	} 
	
		
		
		
		if(document.form.txt_tarea_ok.value==0)
			{
			msg=msg+"\n - No subio el archivo";
			
			}
		
	if(document.form.txt_tarea_nombre.value=="")
			{
			msg=msg+"\n - Nombre archivo";
			
			}
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara esponder la tarea debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
		
	}



function validar_responder_tarea2()
	{
		
	var file;
	var msg="";
	file=window.opener.document.form.txt_tarea_nombre.value; 
	extArray = new Array(".pptx",".xlsx",".docx",".doc",".xls",".ppt",".txt",".rtf",".zip",".rar",".pdf",".vsd");  
	allowSubmit = false; 
	ext = file.slice(file.indexOf(".")).toLowerCase(); 
	for(var i = 0; i < extArray.length; i++) 
		{ 
		if(extArray[i] == ext)
			{ 
			allowSubmit = true; 
			break; 
			}
		} 
	if(allowSubmit)
		{ 
	} else { 
	
	if(file!="")
		{
		msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
		
		}
	} 
	
		
		
		
		if(window.opener.document.form.txt_tarea_ok.value==0)
			{
			msg=msg+"\n - No subio el archivo";
			
			}
		
	if(window.opener.document.form.txt_tarea_nombre.value=="")
			{
			msg=msg+"\n - Nombre archivo";
			
			}
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara esponder la tarea debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		
		
	}
	else
		{
			window.opener.document.form.acc.value='RESPONDER TAREA';
			window.opener.document.form.submit();
			window.close();
		}
	}


function validar_responder_tarea3()
	{
	var file;
	var msg="";
	file=window.opener.document.form.txt_tarea_nombre.value; 
	extArray = new Array(".xlsx",".pptx",".docx",".doc",".xls",".ppt",".txt",".rtf",".zip",".rar",".pdf",".vsd");  
	allowSubmit = false; 
	ext = file.slice(file.indexOf(".")).toLowerCase(); 
	for(var i = 0; i < extArray.length; i++) 
		{ 
		if(extArray[i] == ext)
			{ 
			allowSubmit = true; 
			break; 
			}
		} 
	if(allowSubmit)
		{ 
	} else { 
	
	if(file!="")
		{
		msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
		
		}
	} 
	
		
		
		
		if(window.opener.document.form.txt_tarea_ok.value==0)
			{
			msg=msg+"\n - No subio el archivo";
			
			}
		
	if(window.opener.document.form.txt_tarea_nombre.value=="")
			{
			msg=msg+"\n - Nombre archivo";
			
			}
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara esponder la tarea debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		
		
	}
	else
		{
			window.opener.document.form.acc.value='REENVIAR TAREA';
			window.opener.document.form.submit();
			window.close();
		}
	}
	
function validar_nueva_tarea()
	{
		var inicial=0;
		var final=0;
		var file;
		var msg="";
		inicial=document.form.txt_porcentaje_tarea.value;
		final=document.form.txt_porcentaje_restante.value;
		
		
		if(window.opener.document.form.txt_tarea_nombre.value!="")
			{
			if(window.opener.document.form.txt_tarea_ok.value==0)
				{
				msg=msg+"\n - No subio el archivo";
				}
			}
	
		
	
	
			
		if(parseInt(inicial)>parseInt(final))
			{
			msg=msg+"\n - El porcentaje ingresado es mayor al restante";
			document.form.txt_porcentaje_tarea.value=0;
			}
		
		if(document.form.txt_tema_tarea.value=="")
			{
			msg=msg+"\n - Falta Tema Tarea";
			document.form.txt_tema_tarea.focus();
			
			}
		if(document.form.txt_porcentaje_tarea.value=="")
			{
			msg=msg+"\n - Falta Porcentaje Tarea";
			document.form.txt_porcentaje_tarea.focus();
			}
		
		
		if(document.form.txt_corte_tarea.value=="")
			{
			msg=msg+"\n - Falta Corte Tarea";
			document.form.txt_corte_tarea.focus();
			}
		if(document.form.txt_fecha_tarea.value=="Ninguna" || document.form.txt_fecha_tarea.value=="" )
			{
			msg=msg+"\n - Falta Fecha Tarea";
			document.form.txt_fecha_tarea.focus();
			}
		if(document.form.txt_titulo_tarea.value=="")
			{
			msg=msg+"\n - Falta Titulo Tarea";
			document.form.txt_titulo_tarea.focus();
			}
		
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara guardar la tarea debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
	
	
	}






function validar_habilitar()
	{
		var msg="";
	
		
	
	
		if(document.form.txt_fecha_foro.value=="")
			{
			msg=msg+"\n - Falta Fecha limite";
			document.form.txt_fecha_foro.focus();
			}
		
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara habilitar debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
	
	
	}

function validar_nueva_tarea2()
	{
	var inicial=0;
	var final=0;
	var file;
	var msg="";
	inicial=window.opener.document.form.txt_porcentaje_tarea.value;
	final=window.opener.document.form.txt_porcentaje_restante.value;
	if(parseInt(inicial)>parseInt(final))
		{
		msg=msg+"\n - El porcentaje ingresado es mayor al restante";
		}
	if(window.opener.document.form.txt_tema_tarea.value=="")
		{
		msg=msg+"\n - Falta Tema Tarea";
		}
	if(window.opener.document.form.txt_porcentaje_tarea.value=="")
		{
		msg=msg+"\n - Falta Porcentaje Tarea";
		}
	if(window.opener.document.form.txt_corte_tarea.value=="")
		{
		msg=msg+"\n - Falta Corte Tarea";
		}
	if(window.opener.document.form.txt_fecha_tarea.value=="Ninguna" || window.opener.document.form.txt_fecha_tarea.value=="" )
		{
		msg=msg+"\n - Falta Fecha Tarea";
		}
	if(window.opener.document.form.txt_titulo_tarea.value=="")
		{
		msg=msg+"\n - Falta Titulo Tarea";
		}
	if(msg!="")
		{
		alert("------------------------------*___*___*------------------------------\nPara guardar la tarea debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		}
	else
		{
		window.opener.document.form.acc.value='NUEVA TAREA';
		window.opener.document.form.submit();
		window.close();	
		}
	}



function validar_nuevo_contenido()
	{
		if(document.form.txt_titulo_contenido.value=="")
			{
			alert("ERROR, Falta Titulo Contenido")
			document.form.txt_titulo_contenido.focus();
			return false;
			}
		if(document.form.txt_descripcion.value=="")
			{
			alert("ERROR, Falta Descripci&#65533;n")
			document.form.txt_descripcion.focus();
			return false;
			}
		if(document.form.txt_archivo_adjunto_contenido.value=="")
			{
			alert("ERROR, Falta Contenido")
			document.form.txt_archivo_adjunto_contenido.focus();
			return false;
			}
		
	var total_selecionados;
	total_selecionados=0;
	for (i=0;i<document.form.elements.length-1;i++) 
		{
		if(document.form.elements[i].type == "checkbox") 
			{
			if(document.form.elements[i].checked==true)
		  		{
				total_selecionados=total_selecionados+1;  
				}
			}
		}
	if(total_selecionados==0)
		{
			alert("Seleccione Grupo");
			return false;
		}


		
	}
function validar_calificar_tarea()
	{
		
		if(document.form.txt_nota_tarea.value=="")
			{
			alert("ERROR, Falta Nota Tarea")
			document.form.txt_nota_tarea.focus();
			return false;
			}
				var total_selecionados;
	total_selecionados=0;
	for (i=0;i<document.form.elements.length-1;i++) 
		{
		if(document.form.elements[i].type == "checkbox") 
			{
			if(document.form.elements[i].checked==true)
		  		{
				total_selecionados=total_selecionados+1;  
				}
			}
		}
	if(total_selecionados==0)
		{
			alert("Seleccione Registro a Calificar");
			return false;
		}

	}


		
function validar_nuevo_foro()
	{
		var inicial=0;
		var final=0;
		var file;
		var msg="";
		inicial=document.form.txt_porcentaje_foro.value;
		final=document.form.txt_porcentaje_restante.value;
		
		
		
	
		
		if(parseInt(inicial)>parseInt(final))
			{
			msg=msg+"\n - El porcentaje ingresado es mayor al restante";
			document.form.txt_porcentaje_foro.value=0;
			}
		
		if(document.form.txt_tema_foro.value=="")
			{
			msg=msg+"\n - Falta Tema Foro";
			document.form.txt_tema_foro.focus();
			
			}
			
		if(document.form.txt_tema_foro.value=="")
			{
			msg=msg+"\n - Falta Porcentaje Foro";
			document.form.txt_porcentaje_foro.focus();
			}
		
		
		if(document.form.txt_corte_foro.value=="")
			{
			msg=msg+"\n - Falta Corte Foro";
			document.form.txt_corte_foro.focus();
			}
		if(document.form.txt_fecha_foro.value=="Ninguna" || document.form.txt_fecha_foro.value=="" )
			{
			msg=msg+"\n - Falta Fecha foro";
			document.form.txt_fecha_foro.focus();
			}
		if(document.form.txt_titulo_foro.value=="")
			{
			msg=msg+"\n - Falta Titulo foro";
			document.form.txt_titulo_foro.focus();
			}
		
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara guardar el foro debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
	
	
	}
	

function validar_nuevo_foro2()
	{
	var inicial=0;
	var final=0;
	var file;
	var msg="";
	inicial=window.opener.document.form.txt_porcentaje_foro.value;
	final=window.opener.document.form.txt_porcentaje_restante.value;
	if(parseInt(inicial)>parseInt(final))
		{
		msg=msg+"\n - El porcentaje ingresado es mayor al restante";
		}
	if(window.opener.document.form.txt_tema_foro.value=="")
		{
		msg=msg+"\n - Falta Tema Foro";
		}
	if(window.opener.document.form.txt_tema_foro.value=="")
		{
		msg=msg+"\n - Falta Porcentaje Foro";
		}
	if(window.opener.document.form.txt_corte_foro.value=="")
		{
		msg=msg+"\n - Falta Corte Foro";
		}
	if(window.opener.document.form.txt_fecha_foro.value=="Ninguna" || window.opener.document.form.txt_fecha_foro.value=="" )
		{
		msg=msg+"\n - Falta Fecha foro";
		}
	if(window.opener.document.form.txt_titulo_foro.value=="")
		{
		msg=msg+"\n - Falta Titulo foro";
		}
	if(msg!="")
		{
		alert("------------------------------*___*___*------------------------------\nPara guardar el foro debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		}
	else
		{
		window.opener.document.form.acc.value='NUEVO FORO';
		window.opener.document.form.submit();
		window.close();	
		}
	}

function validar_responder_foro()
	{
		
		var file;
		var msg="";
		
		file=document.form.txt_tarea_nombre.value; 
		
		if(file=="")
			{	
		if(document.form.txtc.value=="" || parseInt(document.form.txtc.value)<255)
			{
			msg=msg+"\n - Minimo 250 caracteres";
			}
			}
		
		
		extArray = new Array(".docx",".doc",".xls",".ppt",".txt",".rtf",".zip",".rar",".pdf",".vsd",".pptx",".xlsx");  
		allowSubmit = false; 
	
	ext = file.slice(file.indexOf(".")).toLowerCase(); 
	for (var i = 0; i < extArray.length; i++) 
		{ 
		if (extArray[i] == ext)
			{ 
			allowSubmit = true; 
			break; 
			}
		} 
	
	
	if (allowSubmit) { 
	} else { 
	
	if(file!="")
		{
		msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
		
		}
	} 
	
		
		
		
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara responder el foro debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
	
	
	}


function validar_responder_foro2()
	{
		
		var file;
		var msg="";
		
		
		
		file=window.opener.document.form.txt_tarea_nombre.value; 
		extArray = new Array(".docx",".doc",".xls",".ppt",".txt",".rtf",".zip",".rar",".pdf",".vsd",".pptx",".xlsx");  
		allowSubmit = false; 
	
	ext = file.slice(file.indexOf(".")).toLowerCase(); 
	for (var i = 0; i < extArray.length; i++) 
		{ 
		if (extArray[i] == ext)
			{ 
			allowSubmit = true; 
			break; 
			}
		} 
	
	
	if (allowSubmit) { 
	} else { 
	
	if(file!="")
		{
		msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
		
		}
	} 
	
		
		
		
	  
if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara responder el foro debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
	}
else
	{
	window.opener.document.form.acc.value='RESPONDER FORO';
	window.opener.document.form.submit();
	window.close();	
	}
	
	
	}

function ocultarFila(idFila){
if(document.getElementById(idFila).style.display =="")
	{
	document.getElementById(idFila).style.display='block';
	}
else if(document.getElementById(idFila).style.display =='none')
	{
	document.getElementById(idFila).style.display='block';
	}
else if(document.getElementById(idFila).style.display =='block')
	{
	document.getElementById(idFila).style.display='none';
	}
 
}

function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg +
    '"><td align="center"><font face="Verdana" color="' + fg +
    '" size="2"><b>&nbsp\;' + msg +
    '&nbsp\;</b></font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

function SoloNumeros(campo)
{  
	var ubicacion
	var caracteres = "0123456789."
	
	var contador = 0
	for (var i=0; i < campo.length; i++)
	{
		ubicacion = campo.substring(i, i + 1)
		if (caracteres.indexOf(ubicacion) != -1) 
		{
		  contador++
		} 
		else 
		{
		  alert("ERROR: No se acepta el caracter '" + ubicacion + "'.\nDebe ingresar solo n&#65533;meros.")
		  return false
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function centrar(){
x = (screen.width - 680) / 2;
y = (screen.height - 550) / 2;
moveTo(x, y);
}
function centrar2(x1,y1){
x = (screen.width - x1) / 2;
y = (screen.height - y1) / 2;
moveTo(x, y);
}
function nu_ventana(url,nombre, ancho, alto, barra) {
	izquierda = (screen.width) ? (screen.width-ancho)/2 : 100
	arriba = (screen.height) ? (screen.height-alto)/2 : 100
	opciones = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + barra + ',resizable=0,width=' + ancho + ',height=' + alto + ',left=' + izquierda + ',top=' + arriba + ''
	window.open(url, nombre, opciones)
}

function validar_actualizar_docente()
	{
		var msg="";
	if(document.form.txt_documento.value=="")
			{
			msg=msg+"\n - Falta documento";
			}
	if(document.form.txt_nombres.value=="")
			{
			msg=msg+"\n - Falta nombres";
			}
	if(document.form.txt_apellidos.value=="")
			{
			msg=msg+"\n - Falta apellidos";
			}
	if(document.form.txt_direccion.value=="")
			{
			msg=msg+"\n - Falta direcci&#65533;n";
			}
	if(document.form.txt_celular.value=="null")
			{
			msg=msg+"\n - Falta celular";
			}
	
	if(document.form.txt_password.value=="")
		{
		msg=msg+"\n - Falta contrase&#65533;a";
		}
	if(document.form.txt_password.value!=document.form.txt_password2.value)
		{
		msg=msg+"\n - Falta confirmar contrase&#65533;a";
		}
		
		
		if(document.form.txt_foto.value!="")
		{
		
		file=document.form.txt_foto.value; 
		extArray = new Array(".jpg");  
		allowSubmit = false; 
		ext = file.slice(file.indexOf(".")).toLowerCase(); 
		for(var i = 0; i < extArray.length; i++) 
			{ 
			if (extArray[i] == ext)
				{ 
				allowSubmit = true; 
				break; 
				}
			} 
		if(allowSubmit)
			{ 
			}
		else{ 
			if(file!="")
				{
				msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
				}
			} 
		}
		
		if(msg!="")
			{
			alert("------------------------------*___*___*------------------------------\nPara Actualizar su informaci&#65533;n debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
			return false;
		}
	}
	
function validar_actualizar_estudiante()
	{
		var file;
		var msg="";
	if(document.form.txt_documento.value=="")
		{
		msg=msg+"\n - Falta Documento";
		document.form.txt_documento.focus();
		}
	if(document.form.txt_nombres.value=="")
		{
		msg=msg+"\n - Falta Nombres";
		document.form.txt_nombres.focus();
		}
	if(document.form.txt_apellidos.value=="")
		{
		msg=msg+"\n - Falta Apellidos";
		document.form.txt_apellidos.focus();
		}
	if(document.form.txt_direccion.value=="")
		{
		msg=msg+"\n - Falta Direccion";
		document.form.txt_direccion.focus();
		}
	if(document.form.txt_celular.value=="null")
		{
		msg=msg+"\n - Falta Celular";
		document.form.txt_celular.focus();
		}
	
	
	if(document.form.txt_foto.value!="")
		{
		
		file=document.form.txt_foto.value; 
		extArray = new Array(".jpg");  
		allowSubmit = false; 
		ext = file.slice(file.indexOf(".")).toLowerCase(); 
		for(var i = 0; i < extArray.length; i++) 
			{ 
			if (extArray[i] == ext)
				{ 
				allowSubmit = true; 
				break; 
				}
			} 
		if(allowSubmit)
			{ 
			}
		else{ 
			if(file!="")
				{
				msg=msg+"\n - Usted s&#65533;lo puede subir archivos con extensiones " + (extArray.join(" ")) + " y no se permite poner puntos en el nombre del archivo \nPor favor seleccione un nuevo archivo";
				}
			} 
		}
		
	if(msg!="")
	{
		alert("------------------------------*___*___*------------------------------\nPara Actualizar su informaci&#65533;n debe diligenciar:\n"+msg+"\n------------------------------*___*___*------------------------------");
		return false;
		
	}
	
	
	}
	
function validar_nuevo_recurso()
	{
		
		
		if(document.form.txt_descripcion.value=="")
			{
			alert("ERROR, Falta Descripci&#65533;n")
			document.form.txt_descripcion.focus();
			return false;
			}
		
		
	var total_selecionados;
	total_selecionados=0;
	for (i=0;i<document.form.elements.length-1;i++) 
		{
		if(document.form.elements[i].type == "checkbox") 
			{
			if(document.form.elements[i].checked==true)
		  		{
				total_selecionados=total_selecionados+1;  
				}
			}
		}
	if(total_selecionados==0)
		{
			alert("Seleccione Grupo");
			return false;
		}
	


var total_selecionados;
var valor_radio;
	total_selecionados=0;
	valor_radio=0;
	for (i=0;i<document.form.elements.length-1;i++) 
		{
			
		if(document.form.elements[i].type == "radio") 
			{
			if(document.form.elements[i].checked==true)
		  		{
				total_selecionados=total_selecionados+1; 
				valor_radio=document.form.elements[i].value;
				}
			}
		}
	if(total_selecionados==0)
		{
			alert("Seleccione Tipo a enviar");
			return false;
		}
	else
		{
			
					if(valor_radio==1)
						{
							if(document.form.txt_archivo_adjunto_recurso.value=="")
								{
								alert("ERROR, Falta Archivo a enviar")
								document.form.txt_archivo_adjunto_recurso.focus();
								return false;
								}
						}
						
					
				if(valor_radio==2)
						{
							if(document.form.txt_pagina.value=="")
								{
								alert("ERROR, Falta Nombre del enlace o url")
								document.form.txt_pagina.focus();
								return false;
								}
						}
		}

		
		
	}
	
function validar_bitacora()
		{
			if(document.form.txt_estudiante.value==0)
			{
			alert("ERROR, Falta Estudiante")
			document.form.txt_estudiante.focus();
			return false;
			}
		}
		
function validar_porcentaje_tarea()
	{
		if(document.form.txt_corte_tarea.value==1)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[0].value;
			foro=document.form.porcentaje_acumulado_foro[0].value;
			total=parseInt(tarea)+parseInt(foro);
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			}
		
		if(document.form.txt_corte_tarea.value==2)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[1].value;
			foro=document.form.porcentaje_acumulado_foro[1].value;
			total=parseInt(tarea)+parseInt(foro);
			
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
		if(document.form.txt_corte_tarea.value==3)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[2].value;
			foro=document.form.porcentaje_acumulado_foro[2].value;
			total=parseInt(tarea)+parseInt(foro);
			
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
		if(document.form.txt_corte_tarea.value==4)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[3].value;
			foro=document.form.porcentaje_acumulado_foro[3].value;
			total=parseInt(tarea)+parseInt(foro);
			
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
	}

function validar_restante_tarea()
	{
		var inicial=0;
		var final=0;
		inicial=document.form.txt_porcentaje_tarea.value;
		final=document.form.txt_porcentaje_restante.value;
		
		if(parseInt(inicial)>parseInt(final))
			{
				alert("El porcentaje ingresado es mayor al restante ");
				document.form.txt_porcentaje_tarea.value=0;
				}
	}

function validar_porcentaje_foro()
	{
		if(document.form.txt_corte_foro.value==1)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[0].value;
			foro=document.form.porcentaje_acumulado_foro[0].value;
			total=parseInt(tarea)+parseInt(foro);
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
		if(document.form.txt_corte_foro.value==2)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[1].value;
			foro=document.form.porcentaje_acumulado_foro[1].value;
			total=parseInt(tarea)+parseInt(foro);
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
		if(document.form.txt_corte_foro.value==3)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[2].value;
			foro=document.form.porcentaje_acumulado_foro[2].value;
			total=parseInt(tarea)+parseInt(foro);
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
		if(document.form.txt_corte_foro.value==4)
			{
			var total=0;
			var tarea=0;
			var foro=0;
			var disponible=0;
			tarea=document.form.porcentaje_acumulado_tarea[3].value;
			foro=document.form.porcentaje_acumulado_foro[3].value;
			total=parseInt(tarea)+parseInt(foro);
			disponible=100-total;
			document.form.txt_porcentaje_restante.value=disponible;
			
			}
		
	}
function validar_restante_foro()
	{
		var inicial=0;
		var final=0;
		inicial=document.form.txt_porcentaje_foro.value;
		final=document.form.txt_porcentaje_restante.value;
		if(parseInt(inicial)>parseInt(final))
			{
			alert("El porcentaje ingresado es mayor al restante ");
			document.form.txt_porcentaje_foro.value=0;
			}
	}

function enviar_foro(valor)
	{
	var URL='enviar_calificar.php?id_foro_enviar='+valor;
	window.open(URL,'','scrollbars=1,toolbar=no,width=591,height=545,left=150,top=120');
	}

function posicion(x1,y1)
	{
	var x;
	var y;
	x = (screen.width - x1) / 2;
	y = (screen.height - y1) / 2;
	moveTo(x,y);
	}

function validar_calificar_foro()
	{
		if(document.form1.txt_nota.value=="" || document.form1.txt_nota.value==0 )
			{
			alert("ERROR, No ha calificado")
			document.form1.txt_nota.focus();
			return false;
			}
	}

function validar_calificar_tarea()
	{
		if(document.form1.txt_nota.value=="" || document.form1.txt_nota.value==0 )
			{
			alert("ERROR, No ha calificado")
			document.form1.txt_nota.focus();
			return false;
			}
	}

function seleccionado(valor)
	{
	opener.document.form.txt_tema_scorm_activar.value=valor;
	window.close();
	}
function actualizar_contenido_scorm(valor)
	{
		
		opener.window.document.form.txt_contenido_scorm.value=valor;
		window.close();
	}
function habilitar_foros_tareas(nombre,id)
	{
	var casillas = new Array();
	var k=0;
	
	if(nombre=='txt_habilitar_tarea[]')
		{
		var total=parseInt(document.form.total_tareas.value);
		}
	else
		{
		var total=parseInt(document.form.total_foros.value);
		}
			
	for (i=0;i<document.form.elements.length-1;i++) 
		{
		if(document.form.elements[i].name == nombre) 
			{
			casillas[k]=i;
			k++;
			}	
		}
	
	var i=parseInt((parseInt(id)-1));
	
	
	while(i<k)
		{
		if(document.form.elements[casillas[i]].checked==true)
				{
				document.form.elements[casillas[i]].checked=false;
				}
			else
				{
				document.form.elements[casillas[i]].checked=true;
				}
			
		i=i+parseInt(total);
		}
			
					
	}

var objeto = false;
var div_mostrar;
function crearObjeto() {
 // --- Crear el Objeto dependiendo los diferentes Navegadores y versiones ---
 try { objeto = new ActiveXObject("Msxml2.XMLHTTP");  }
 catch (e) {
 try { objeto = new ActiveXObject("Microsoft.XMLHTTP"); }
 catch (E) {
 objeto = false; }
 }

 if (!objeto && typeof XMLHttpRequest!='undefined') {
   objeto = new XMLHttpRequest();
 }
} 



function leerDatos(id_pregunta,div_ver,id_evaluacion,letra,descr,tipo,acc,ide)
	{
	crearObjeto();
	div_mostrar=div_ver;
    if(objeto.readyState != 0)
		{
   		alert('Error al crear el objeto XML. El Navegador no soporta AJAX');
 		} 
 	else
		{
 	    objeto.onreadystatechange = procesaResultado;
		
		if(acc==1)
			{
 			var r_letra=document.getElementById(letra).value;
			var r_respuesta=document.getElementById(descr).value;
			var r_tipo=document.getElementById(tipo).value;
			objeto.open("GET", "agregar_respuesta.php?pregunta="+id_pregunta+"&letra_f="+r_letra+"&respuesta_f="+r_respuesta+"&tipo_f="+r_tipo+"&evaluacion="+id_evaluacion+"&letra_ver="+letra+"&descr_ver="+descr+"&tipo_ver="+tipo+"&div_ver="+div_ver, true);
			}
		if(acc==2)
			{
     		objeto.open("GET", "borrar_respuesta.php?id_eliminar="+ide+"&pregunta="+id_pregunta+"&evaluacion="+id_evaluacion+"&letra_ver="+letra+"&descr_ver="+descr+"&tipo_ver="+tipo+"&div_ver="+div_ver, true);
			}
		objeto.send(null);
 		}
	}



function procesaResultado() {
	
if (objeto.readyState == 1) {
 document.getElementById(div_mostrar).innerHTML = "<img src='imagenes/reload.gif'>";
}
if (objeto.readyState == 4) {
 document.getElementById(div_mostrar).innerHTML = objeto.responseText;
} 
}

 
 
var CronoID = null   
var CronoEjecutandose = false   
var decimas, segundos, minutos, segundos_2
  
function DetenerCrono (){   
    if(CronoEjecutandose)   
        clearTimeout(CronoID)   
    CronoEjecutandose = false   
}   
  
function InicializarCrono () {   
   
    decimas = 0   
    segundos = 0   
    minutos = 0   
       segundos_2=0
   
    document.crono.display.value = '00:00:0'  
  }   
  
function MostrarCrono () {   
            
  
    decimas++   
    if ( decimas > 9 ) {   
        decimas = 0   
        segundos++   
		segundos_2++
        if ( segundos > 59 ) {   
            segundos = 0   
            minutos++   
            if ( minutos > 1 ) {   
                alert('Fin de la cuenta')   
                document.crono.submit();
                return true   
            }   
        }   
    }   
  
    
    var ValorCrono = ""  
    ValorCrono = (minutos < 10) ? "0" + minutos : minutos   
    ValorCrono += (segundos < 10) ? ":0" + segundos : ":" + segundos   
    ValorCrono += ":" + decimas    
     
	 
	 
    document.crono.display.value = ValorCrono   
 
	
	if(parseInt(document.crono.txt_tiempo_evaluacion.value)==segundos_2)
		{
		  document.crono.responder_evaluacion.value="RESPONDER";
		  document.crono.submit();
		}
    CronoID = setTimeout("MostrarCrono()", 100)   
    CronoEjecutandose = true   
    return true   
}   
  
function IniciarCrono () {   
    DetenerCrono()   
    InicializarCrono()   
    MostrarCrono()   
}   
  
function ObtenerParcial() {   
    
    document.crono.parcial.value = document.crono.display.value  
}   
  
  
function validar_cargo_tarea()
	{
		
		var msg="";
		if(document.form.photoupload.value=="")
			{
				msg=msg+"- Favor seleccione archivo ha adjuntar\n";
			}
		
		if(msg!="")
			{
				alert("Para adjuntar el archivo falta:\n"+msg);
				return false;
			}
	}
  