
/*	$(document).ready(
		function()
		{
			$('#dock').Fisheye(
				{
					maxWidth: 50,
					items: 'a',
					itemsText: 'span',
					container: '.dock-container',
					itemWidth: 40,
					proximity: 90,
					halign : 'center'
				}
			)
		}
	);
<*/
function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function nuevoAjax1(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function validarEntrada()
{
if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;
}
function validarEntradaDate()
{
if (event.keyCode < 47 || event.keyCode > 57) event.returnValue = false;
}
function checkEnter(e){ var characterCode; characterCode = e.keyCode; 
if(characterCode == 13){  document.forms[0].submit();  }; }; 

function sendForm(redirect){
	document.forms[0].redirect.value = redirect;
	document.forms[0].submit();
	}
function MsgOkCanceldrop(msg,redirect,idUser)
	{

	if(confirm(msg)){
		document.forms[0].redirect.value = redirect;
		document.forms[0].userid.value = idUser;
		document.forms[0].submit();
	}
}


function Trim( str ) 
{
	var resultStr = str;
	resultStr = resultStr.replace( /^\s*|\s*$/g, "" ); 	
	return resultStr;
}

/*
function validate( val )
{
	document.forms[0].redirect.value = redirect;
	document.forms[0].submit();
}

function MsgOkCanceldrop(msg,redirect)
{
	if( confirm( msg ) )
	{
		document.forms[0].redirect.value = redirect;
		document.forms[0].submit();
	}
}
*/

function displayInfo(nombre, valor )
{
	
	document.getElementById('informacion').style.display = 'block';	
	document.getElementById('acciones').style.display = 'block';	
	document.getElementById('tituloDirigido').innerHTML = nombre;	
	document.getElementById('accion').value = valor;
	
	
	
	if(valor==4) {  document.getElementById('ayuntamiento').style.display 		= 'block'; 		} else { document.getElementById('ayuntamiento').style.display 			= 'none'; 		}
	if(valor==5) {  document.getElementById('organismoautonomo').style.display 	= 'block'; 		} else { document.getElementById('organismoautonomo').style.display 	= 'none'; 		}
	if(valor==6) {  document.getElementById('otroorganimso').style.display 		= 'block'; 		} else { document.getElementById('otroorganimso').style.display 		= 'none'; 		}
	
}

function infoAlterna()
{
	
	document.getElementById('domicilioInformacion').style.display 	= 'block';	
	document.getElementById('registrarDomicilio').style.display 	= 'none';	
	document.getElementById('complemento').value	= 1;	
	
	
	document.getElementById('calle').disabled			=false;
	document.getElementById('num_ext').disabled			=false;
	document.getElementById('num_inter').disabled		=false;
	document.getElementById('colonia').disabled			=false;
	document.getElementById('poblacion').disabled		=false;
	document.getElementById('cp').disabled				=false;
	document.getElementById('clave').disabled			=false;
	document.getElementById('tel').disabled				=false;
	document.getElementById('email').disabled			=false;
	//document.getElementById('cmbmunicipio').disabled	=false;
	document.getElementById('cmbpais').disabled			=false;
	document.getElementById('valorEstado').disabled		=false;
	document.getElementById('comboMunicipio').disabled	=false;
	
	
	
	
	
	
	document.getElementById('domicilioInformacion').style.display 	= 'block';	
	document.getElementById('registrarDomicilio').style.display 	= 'none';	
		
}

function infoAlternaCancelar()
{
	document.getElementById('domicilioInformacion').style.display 	= 'none';		
	document.getElementById('registrarDomicilio').style.display 	= 'block';	
	
	document.getElementById('complemento').value	= 0;	
	
	document.getElementById('calle').disabled			=true;
	document.getElementById('num_ext').disabled			=true;
	document.getElementById('num_inter').disabled		=true;
	document.getElementById('colonia').disabled			=true;
	document.getElementById('poblacion').disabled		=true;
	document.getElementById('cp').disabled				=true;
	document.getElementById('clave').disabled			=true;
	document.getElementById('tel').disabled				=true;
	document.getElementById('email').disabled			=true;
	//document.getElementById('cmbmunicipio').disabled	=true;
	document.getElementById('cmbpais').disabled			=true;
	document.getElementById('valorEstado').disabled		=true;
	document.getElementById('comboMunicipio').disabled	=true;
	
	
	
		
}

// Funcion para desplegar la sección de Motivos para el rechazo de un recurso de inconformidad.

function rechazaRecursoDisplay()
{
	
	document.getElementById('motivoRechazo').style.display 	= 'block';	
	// Habilitamos el textArea para que pueda ser validado por la clase FormCheck
	document.getElementById('txtMotivoRechazo').disabled	=false;
		
}

function rechazaRecursoHide(){
	
	document.getElementById('motivoRechazo').style.display 	= 'none';	
	// Habilitamos el textArea para que pueda ser validado por la clase FormCheck
	document.getElementById('txtMotivoRechazo').disabled	=true;		
}





function getEstados(selObj){
	
	var tipo;
	
	tipo=selObj;	
	var contenedorotroorganismoAmbito;	
	contenedorotroorganismoAmbito = document.getElementById('estados');	
	ajax=nuevoAjax();
	ajax.open("GET", "getEstados.php?idPais="+tipo,true);
	ajax.onreadystatechange=function() 
	{
		if (ajax.readyState==4)
		{
			contenedorotroorganismoAmbito.innerHTML = ajax.responseText			
		}
		else
		{
			contenedorotroorganismoAmbito.innerHTML = '<select name="cmbpais" id="cmbpais" class="objSelect1" disabled="disabled"><option value="0">-- Cargando Contenido --</option></select>';	
						
		}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(null); 	
	}
	
	
	

function getMunicipios(selObj){
	
	var tipo;
	
	tipo=selObj;	
	var contenedor;	
	document.getElementById('valorEstado').value=tipo;
	
	if(tipo==2547)
	{
		document.getElementById('divTxtMunicipio').style.display="none";	
		document.getElementById('txtMunicipio').disabled=true;
		
		document.getElementById('divComboMunicipio').style.display="block";	
		document.getElementById('comboMunicipio').disabled=false;
		
		document.getElementById('textoTitulo').style.display="none";	
		
	}
	else
	{
		document.getElementById('divTxtMunicipio').style.display="block";	
		document.getElementById('txtMunicipio').disabled=false;
		
		document.getElementById('divComboMunicipio').style.display="none";	
		document.getElementById('comboMunicipio').disabled=true;
		
		document.getElementById('textoTitulo').style.display="none";	
	}
	}




function verOtroOrganismo(selObj){
	
	var tipo;
	
	tipo=selObj;	
	var contenedorotroorganismoAmbito;	
	contenedorotroorganismoAmbito = document.getElementById('otroorganismoAmbito');	
	ajax=nuevoAjax();
	ajax.open("GET", "getOtroOrganismoAmbito.php?idtipo="+tipo,true);
	ajax.onreadystatechange=function() 
	{
		if (ajax.readyState==4)
		{
			contenedorotroorganismoAmbito.innerHTML = ajax.responseText			
		}
		else
		{
			contenedorotroorganismoAmbito.innerHTML = '<select name="cmborganismosOtros" id="cmborganismosOtros" class="objSelect1" disabled="disabled"><option value="0">-- Cargando Contenido --</option></select>';	
						
		}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(null); 	
	}
	
	
	function verOtroOrganismoSolicitud(selObj){
	
	var tipo;
	
	tipo=selObj;	
	var contenedorotroorganismoAmbito;	
	contenedorotroorganismoAmbito = document.getElementById('otroorganismoAmbito');	
	ajax=nuevoAjax();
	ajax.open("GET", "getOtroOrganismoAmbito.php?idtipo="+tipo,true);
	ajax.onreadystatechange=function() 
	{
		if (ajax.readyState==4)
		{
			contenedorotroorganismoAmbito.innerHTML = ajax.responseText			
		}
		else
		{
			contenedorotroorganismoAmbito.innerHTML = '<select name="cmborganismosOtros" id="cmborganismosOtros" class="objSelect1" disabled="disabled"><option value="0">-- Cargando Contenido --</option></select>';	
						
		}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(null); 	
	}
	
	
/**********************************************************************/
/******************************* FUNCIONES PARA EL CALENDARIO *******************************************/

var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (oldLink) oldLink.style.fontWeight = 'normal';
  oldLink = link;
  /*link.style.fontWeight = 'bold';*/
  return false;
}

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled.  In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here.  However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function flatSelected(cal, date) {
  var el = document.getElementById("preview");
  el.innerHTML = date;
}

function showFlatCalendar() {
  var parent = document.getElementById("display");

  // construct a calendar giving only the "selected" handler.
  var cal = new Calendar(0, null, flatSelected);

  // hide week numbers
  cal.weekNumbers = false;

  // We want some dates to be disabled; see function isDisabled above
  cal.setDisabledHandler(isDisabled);
  cal.setDateFormat("%A, %B %e");

  // this call must be the last as it might use data initialized above; if
  // we specify a parent, as opposite to the "showCalendar" function above,
  // then we create a flat calendar -- not popup.  Hidden, though, but...
  cal.create(parent);

  // ... we can show it here.
  cal.show();
}

setActiveStyleSheet(document.getElementById("defaultTheme"), "Aqua");

/************************ FIN VALIDAR USUARIOS **********************************************************/
	
	
// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

function registrosPagina( enlace )
{
	document.location.href = enlace;	
}	

function verAyuntamientosInconformidades(value)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	//window.document.location.href="listadorecursos.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	

	window.document.location.href="listadorecursos.php?opt=4&idmunicipio="+value+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
		
}

function verAyuntamientosRevision(value)
{
	
	window.document.location.href="listadorecursos.php?opt=4&idmunicipio="+value;
		
}






function verAyuntamientosInconformidadesT(value)
{  	
         	
	//window.document.location.href="listadorecursos.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	

	window.document.location.href="listadorecursos.php?opt=4&idmunicipio="+value;
		
}

function verAyuntamientosRInconformidadesT(value)
{  	
         	
	//window.document.location.href="listadorecursos.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	

	window.document.location.href="listadorecursosiNC.php?opt=4&idmunicipio="+value;
		
}

function verAyuntamientosInconformidadesSolicitud(value)
{
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=		document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	//window.document.location.href="listadosolicitudes.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	
	window.document.location.href="listadosolicitudes.php?opt=4&idmunicipio="+value+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
		
}



function verAyuntamientosSolicitud(value)
{
	
     	
         	
	//window.document.location.href="listadosolicitudes.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	
	window.document.location.href="listadosolicitudes.php?opt=4&idmunicipio="+value;
		
}

function verOtrosAutonomos(value)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
 
	window.document.location.href="listadorecursos.php?opt=5&idorganismo="+value+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}


function verOtrosAutonomosT(value)
{
	
	
	window.document.location.href="listadorecursos.php?opt=5&idorganismo="+value;
}

function verOtrosAutonomosRT(value)
{
	
	
	window.document.location.href="listadorecursosInc.php?opt=5&idorganismo="+value;
}

function verOtrosAutonomosSolicitud(value)
{
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=		document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;

	window.document.location.href="listadosolicitudes.php?opt=5&idorganismo="+value+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;	
}


function verOtrosAutonomosSolicitudDirector(value)
{
	
	
	

	window.document.location.href="listadosolicitudes.php?opt=5&idorganismo="+value;	
}

function otroOrganismoDependencia(value)
{
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
 
	ambito=document.getElementById('ambito').value;
	window.document.location.href="listadorecursos.php?opt=6&idorganismo="+value+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}

function otroOrganismoDependenciaRevision(value)
{
	
 
	ambito=document.getElementById('ambito').value;
	window.document.location.href="listadorecursos.php?opt=6&idorganismo="+value+"&ambito="+ambito;
}



function otroOrganismoDependenciaSolicitud(value)
{
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=		document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;

	ambito=document.getElementById('ambito').value;
	window.document.location.href="listadosolicitudes.php?opt=6&idorganismo="+value+"&ambito="+ambito+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;	
}

function otroOrganismoDependenciaSolicitudDirector(value)
{
	

	ambito=document.getElementById('ambito').value;
	window.document.location.href="listadosolicitudes.php?opt=6&idorganismo="+value+"&ambito="+ambito;	
}


function eliminarDocumento(msg,val,id,solicitud,idinconformidad,idsupuesto)
{

	
			if(confirm(msg)){
				window.document.location.href="functions/workarchivo.php?redirect=1&id="+id+"&idsolicitud="+solicitud+"&idinconformidad="+idinconformidad+"&idsupuesto="+idsupuesto;
			}
}

function eliminarNotificacion(msg,id,solicitud,idinconformidad,idsupuesto)
{

	
			if(confirm(msg)){
		window.document.location.href="functions/workrecurso.php?accion=6&id="+id+"&idsolicitud="+solicitud+"&idinconformidad="+idinconformidad+"&idsupuesto="+idsupuesto;
			}
}

function div(nombreDiv, nombreCheck)
{
	//alert(document.getElementById(nombreCheck).checked);
	//alert(nombreDiv);
	if(document.getElementById(nombreCheck).checked==true)
	{
		slidedown(nombreDiv);	
	}
	else
	{
		slideup(nombreDiv);	
	}
}

function divRechazoDisplay(nombreDiv)
{
		
		cambiarContenido();
		document.getElementById("txtMotivoRechazo").disabled=false;	
		document.getElementById("upload_value").disabled=false;	
		
		slidedown('rechazoDiv');	
}

function divRechazoHide(nombreDiv)
{	
		cambiarContenidoMostrar();
		document.getElementById("txtMotivoRechazo").disabled=true;	
		document.getElementById("upload_value").disabled=true;	
		slideup('rechazoDiv');		
}


function divMotivoShow()
{
		
		//cambiarContenido();
		document.getElementById("cmbMotivo").disabled=false;	
		slidedown('divMotivo');	
}

function divMotivoHide()
{	
		document.getElementById("cmbMotivo").disabled=true;	
		slideup('divMotivo');	
		
}

function divTipoInfoShow()
{
		
		//cambiarContenido();
		document.getElementById("cmbTipoInfo").disabled=false;	
		slidedown('divTipoInformacion');	
}

function divTipoInfoHide()
{	
		document.getElementById("cmbTipoInfo").disabled=true;	
		slideup('divTipoInformacion');	
		
}



function tipoResuelve(obj)
{
	var tipoId;
	tipoId=obj;
	
	if(tipoId==4)
	{
		document.getElementById("cmbsobresee").disabled=false;
		slidedown('divGralSobresee');	
	}
	else
	{
		document.getElementById("cmbsobresee").disabled=true;	
		slideup('divGralSobresee');	
		document.getElementById("otroSobresee").disabled=true;	
		slideup('divGralOtroSobresee');		
	}
	

}


function otraOcupacion(obj)
{
	var tipoId;
	tipoId=obj;
	
	if(tipoId==7)
	{
		document.getElementById("otraocupacion").disabled=false;
		slidedown('divOtraOcupacion');	
	}
	else
	{
		document.getElementById("otraocupacion").disabled=true;	
		slideup('divOtraOcupacion');		
	}
	

}

function tipoSobresee(obj)
{
	var tipoId;
	tipoId=obj;
	
	if(tipoId==3)
	{
		document.getElementById("otroSobresee").disabled=false;
		slidedown('divGralOtroSobresee');	
	}
	else
	{
		document.getElementById("otroSobresee").disabled=true;	
		slideup('divGralOtroSobresee');		
	}
	

}





function divGralDisplay(nombreDiv, nomEtiqueta)
{
		if(nombreDiv=='datosUsuario')
		{
			document.getElementById('usuario').disabled=false;
			document.getElementById('contrasena').disabled=false;
			document.getElementById('confirmarcon').disabled=false;
			document.getElementById('pregunta_contra').disabled=false;
			document.getElementById('respuesta_contra').disabled=false;
			document.getElementById('accion').value	=	1;
		
		
		}
		
		cambiarContenidoGral(nombreDiv, nomEtiqueta);
		
		slidedown(nombreDiv);	
}

function divGralHide(nombreDiv, nomEtiqueta)
{
		if(nombreDiv=='datosUsuario')
		{
			document.getElementById('usuario').disabled				=	true;
			document.getElementById('contrasena').disabled			=	true;
			document.getElementById('confirmarcon').disabled		=	true;
			document.getElementById('pregunta_contra').disabled		=	true;
			document.getElementById('respuesta_contra').disabled	=	true;
			document.getElementById('accion').value	=	0;
			
		
		
		}
		cambiarContenidoMostrarGral(nombreDiv, nomEtiqueta);
		
		slideup(nombreDiv);		
}




function cambiarContenidoGral(nombreDiv, nomEtiqueta)
{
	
	
	document.getElementById(nomEtiqueta).innerHTML="<a href=\"javascript:divGralHide('"+nombreDiv+"','"+nomEtiqueta+"');\" style=\"text-decoration:none;\">- Ocultar </a>";

}
function cambiarContenidoMostrarGral(nombreDiv, nomEtiqueta)
{
	document.getElementById(nomEtiqueta).innerHTML="<a href=\"javascript:divGralDisplay('"+nombreDiv+"','"+nomEtiqueta+"');\" style=\"text-decoration:none;\">+ Mostrar </a>";

}



function cambiarContenido()
{
	document.getElementById("ocultarMostrar").innerHTML="<a href=\"javascript:divRechazoHide('rechazoDiv');\" style=\"text-decoration:none;\">- Ocultar </a>";

}

function cambiarContenidoMostrar()
{
	document.getElementById("ocultarMostrar").innerHTML='<a href="javascript:divRechazoDisplay(\'rechazoDiv\');" style="text-decoration:none;">+ Mostrar </a>';

}


function deshabilitarCampo()
{
	document.getElementById("txtMotivoRechazo").disabled=true;	
}

function habilitarCampo()
{
	document.getElementById("txtMotivoRechazo").disabled=false;	
}


function verSujetosBusqueda(selObj){
	
	var tipo;
	
	tipo=selObj;	
	var contenedorotroorganismoAmbito;	
	contenedorotroorganismoAmbito = document.getElementById('sujetos');	
	ajax=nuevoAjax();
	ajax.open("GET", "getsujetos.php?idtipo="+tipo,true);
	ajax.onreadystatechange=function() 
	{
		if (ajax.readyState==4)
		{
			contenedorotroorganismoAmbito.innerHTML = ajax.responseText			
		}
		else
		{
			contenedorotroorganismoAmbito.innerHTML = '<select name="cmborganismosOtros" id="cmborganismosOtros" class="objSelect1" disabled="disabled"><option value="0">-- Cargando Contenido --</option></select>';	
						
		}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(null); 	
	}
	
	



var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='pix/button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}



function cargador(num, tot){
	
	
	var contenedorCargador;	
	contenedorCargador = document.getElementById('testDiv');	
	ajax=nuevoAjax();
	ajax.open("GET", "cargador.php?numero="+num+"&total="+tot,true);
	ajax.onreadystatechange=function() 
	{
		if (ajax.readyState==4)
		{
			contenedorCargador.innerHTML = ajax.responseText			
		}
		else
		{
			contenedorCargador.innerHTML = '<div style="height:12px;"></div>';	
						
		}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(null); 	
	}
	
	
function cambiarFondo()
{
	document.getElementById('testDiv').style.backgroundColor='#66CC33';	
}

function direccionar(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	window.document.location.href="listadosolicitudes.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}
function direccionarReporte(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	window.document.location.href=""+val+".php?fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}

function direccionarReporteRecurso(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	window.document.location.href=""+val+".php?fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}


function direccionarRecursos(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
     	
         	
	window.document.location.href="listadorecursos.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
}
function radios(valor)
{
	if(valor==1)
	{
		document.getElementById('sesi').checked=true;
	}
	else if(valor==2)
	{
		document.getElementById('manual').checked=true;
	}
	else if(valor==3)
	{
		document.getElementById('ambas').checked=true;
	}
}

function gralRecursos(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
 
	window.document.location.href="listadorecursos.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	
}

function gralSolicitudes(val)
{
	
	for (i=0;i<document.forms.filtro.elements.length;i++) 
	{
		if(document.forms.filtro.elements[i].type == "radio") 
		{
			if(document.forms.filtro.elements[i].checked==1)	
				tipo=document.forms.filtro.elements[i].value;
		}
	}
	
	fechaInicio	=	document.getElementById('sel1').value;
	fechaFin		=	document.getElementById('sel3').value;
 
	window.document.location.href="listadosolicitudes.php?opt="+val+"&fechaInicio="+fechaInicio+"&fechaFin="+fechaFin+"&tipo="+tipo;
	
}



	function enviarform(msg){	

	
			if(confirm(msg)){
			document.forms.formulario.boton.click(); 
			
			}		

		
	}

