// JavaScript Document
// Archivo JScript

var errFunc = function(t) {
	myAjaxProgressLoading.hideLoading();
    alert('Error ' + t.status + ' -- ' + t.statusText + ' -- ' + t.responseText );
}

function generarAleatorio(largo){
	
	var caracter = new Array;
	var resultado="";
	caracter=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z","_","-"];
	for(i=0;i<largo;i++){
		resultado=resultado + caracter[ Math.floor(Math.random() * caracter.length) ];
	}
	return resultado;
	}


var myToolsArchivos = {
		
	start: function(idseccion){
		
		switch(idseccion){
			case 31:
				$ES('div.contenedorarchivos').each(function(el){
					el.identificador=el.getProperty('id');
					el.identificador = el.identificador.substr(5);
					new Ajax('../manuales/listmanuales.asp?id=' + el.identificador + '&aleat=' + generarAleatorio(30),
					{
						method: 'post',
						postBody:'nombre=piti',
						update:$(el),
						onFailure: errFunc
					}
					).request();
				});
				break;
			case 41:
				$ES('div.contenedorarchivos').each(function(el){
					el.identificador=el.getProperty('id');
					el.identificador = el.identificador.substr(5);
					new Ajax('../articulos/listarticulos.asp?id=' + el.identificador + '&aleat=' + generarAleatorio(30),
					{
						method: 'post',
						postBody:'nombre=piti',
						update:$(el),
						onFailure: errFunc
					}
					).request();
				});
				break;
			}
		}
	}
	








