function ajax_directorio(val1, divSetValues){
	if (document.getElementById(val1).value){
		document.getElementById(divSetValues).innerHTML = '<img src="cv_images/loading.gif">';
		sys_ajax_var = '';
		sys_ajax_var = sys_ajax_var + 'valCRecurso=' + document.getElementById(val1).value;  
	
		var ajax=obj_ajax();
		ajax.open("POST", "ajax_directorio.asp", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(sys_ajax_var);
		ajax.onreadystatechange=function(){
			if (ajax.readyState==4){
				document.getElementById(divSetValues).innerHTML = ajax.responseText;
				ActivarScript();
			}
  		}
		return false;
	}
}
$(document).ready(function(){
	$('body').css('display','none');
	$('body').fadeIn('slow');
	$('.filetree').treeview({
		animated: "fast",
		unique: false
	});
	$('.Open').click(function(){
		var directorio = $(this).attr("id");
		document.getElementById("valCRecurso").value = directorio;
		ajax_directorio("valCRecurso","directorio","");
	});
	ActivarScript();
});
function ActivarScript(){
	var popUpWin=0;
	$("a[rel='pop-up']").click(function () {
		if(popUpWin){
			if(!popUpWin.closed) popUpWin.close();
		}
		var dimY = ($(window).height() - 500) / 2 + $(window).scrollTop() + "px";
		var dimX = ($(window).width() - 450) / 2 + $(window).scrollLeft() + "px";
		var caracteristicas = 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes ,width=500, height=600,left='+dimX+', top='+dimY+',screenX='+dimX+',screenY='+dimY+'';
		popUpWin = window.open(this.href, 'Popup', caracteristicas);
		popUpWin.focus();
		return false;
	});
}
function on_over(celda){
	/*celda.style.filter="alpha(opacity=100)";
	celda.style.opacity="1.0";*/
	celda.style.backgroundColor="#6699CC";
	celda.style.color="#FFF";
}
function on_out(celda){
	/*celda.style.filter="alpha(opacity=90)";
	celda.style.opacity="0.9";*/
	celda.style.backgroundColor="";
	celda.style.color="";
	celda.style.fontWeight="normal";
}
