function mostrarAcciones(nombreFila, mostrar) {
    document.getElementById(nombreFila).style.visibility = (mostrar ? "visible" : "hidden");
}

function mostrarCargando(elemento) {
    document.getElementById(elemento).innerHTML = '<div style="height: 150px; padding: 10px" align="center" style="text-align: center"><img src="vista/imagenes/sitio/loading_big.gif" /> Cargando...</div>';
}

function mostrarCargandoModulo(elemento) {
    document.getElementById(elemento).innerHTML = '<div style="height: 150px; padding: 10px" align="center" style="text-align: center"><img src="vista/img/sitio/loading_big.gif" /> Cargando...</div>';
}

function mostrarCargandoOp(elemento, elementoOp) {
    if (document.getElementById(elemento) != null) {
        document.getElementById(elemento).innerHTML = '<div style="height: 150px; padding: 10px"><img src="vista/img/sitio/loading.gif" /> Cargando...</div>';
    } else {
        document.getElementById(elementoOp).innerHTML = '<div style="height: 150px; padding: 10px"><img src="vista/img/sitio/loading.gif" /> Cargando...</div>';
    }
}

function mostrarCargandoSimple(elemento) {
    document.getElementById(elemento).innerHTML = '<img src="vista/img/sitio/loading.gif" /> Cargando...';
}

function muestraDiv(div) {
   	document.getElementById(div).style.display = 'block';
}

function ocultaDiv(div) {
   	document.getElementById(div).style.display = 'none';
}

function ocultaMuestraDiv(div) {
    if (document.getElementById(div).style.display == 'none'){
   		document.getElementById(div).style.display = 'block';
    }else{
   		document.getElementById(div).style.display = 'none';
    }
}


function uploadImage(boton, div, ruta){
	var button = $('#'+boton), interval;
	new AjaxUpload('#'+boton, {
        action: 'upload.php',
		onSubmit : function(file , ext){
		if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
			// extensiones permitidas
			document.getElementById('errimagen').style.display = 'block';
			// cancela upload
			return false;
		} else {
			//button.text('Uploading');
			
			this.disable();
		}
		},
		onComplete: function(file, response){
			
			//button.text('Upload');
			// enable upload button
			this.enable();
			// Agrega archivo a la lista
			$('#'+div).appendTo('.files').text(file);
			
			document.getElementById(ruta).value = response;
			document.getElementById('rutaArchivoA').value = file;
			
			xajax_mostrarImg(file);
			
		}
	});
}


function recargarImg(foto)
  {
   var img=document.getElementById(foto);
   img.src="";
   img.src="captcha.php?"+Date().now();
  }


function uploadFile(boton, div, ruta){
	var button = $('#'+boton), interval;
	new AjaxsubirArchivo('#'+boton, {
        action: 'subirArchivo.php',
		onSubmit : function(file , ext){
		if (! (ext && /^(doc|docx|ppt|pptx|xls|xlsx|txt|pst|accdb|mdb|grv|accde|accda|xsn|one|pub|rar|7z|zip|pdf)$/.test(ext))){
			// extensiones permitidas
			document.getElementById('errdocumento').style.display = 'block';
			// cancela upload
			return false;
		} else {
			//button.text('Uploading');			
			document.getElementById('errdocumento').style.display = 'none';
			mostrarCargando('loading');
			this.disable();
		}
		},
		onComplete: function(file, response){
			
			//button.text('Upload');
			// enable upload button
			this.enable();
			// Agrega archivo a la lista
			$('#'+div).appendTo('.files').text(file);
			document.getElementById('loading').innerHTML = '';
			document.getElementById(ruta).value = response;
			document.getElementById('rutadocumento').value = file;
			
						
		}
	});
}
