jq = {
	carregaFoto: function(){
		var urlrequest;
		if(document.location.protocol == 'https:'){
			urlrequest = 'https://intranet.uniasselvi.com.br/layout';
		}
		else{
			urlrequest = 'http://www.uniasselvi.com.br/extranet/layout';
		}

		$('.hint_foto_aluno').tooltip({ 
			delay: 300, 
			showURL: false,
			fade: 500,
			opacity: 1,
			track: true,
			bodyHandler: function() { 
				return $('<img/>').attr('src', urlrequest+'/request/img_pessoa_foto.php?pess_codi='+$(this).attr('rel')); 
			} 
		});
	}
}

$(document).ready(function(){
	jq.carregaFoto();
	
	var y_fixo = $('.icone_voltar_relatorio').offset.top;
    $(window).scroll(function () {
        $('.icone_voltar_relatorio').animate({top: y_fixo + $(document).scrollTop()+'px'},{duration:500,queue:false}
        );
    });
    var urlrequest;
	if(document.location.protocol == 'https:'){
		urlrequest = 'https://intranet.uniasselvi.com.br/layout/imagens-2.0';
	}
	else{
		urlrequest = 'http://www.uniasselvi.com.br/extranet/layout/imagens-2.0';
	}
    $('#tree').checkboxTree({
        collapseImage: urlrequest+'/minus.png',
        expandImage: urlrequest+'/plus.png'
    });
});

jQuery(document).keydown(function (e) {
	// F9
	if(e.which == 120){ 
		if(document.location.protocol == 'https:'){
			window.open('https://intranet.uniasselvi.com.br/layout/request/regra_pagina_ver.php', 'Regra', 'poppost,nova_janela,width=800,height=600,scrollbars=yes');
		}
		else{
			window.open('http://www.uniasselvi.com.br/extranet/layout/request/regra_pagina_ver.php', 'Regra', 'poppost,nova_janela,width=800,height=600,scrollbars=yes');
		}
	}
});