﻿	
        // DEFINIMOS VARIABLES
	//var mes = "Julio";	
		 
		// FUNCIONES
		
		function cambiar(n){
			//eval('document.getElementById("'+n+'").className')="tooltip";
			document.getElementById("desc12").className='tooltip';
			eval('$("#'+n+'")').show();
		}
		
		function ocultar(n){
			eval('$("#'+n+'")').hide();
		}
		
		function carga_fotos(){
			/*
			i=0;
			while (i < total_temas){
				inicio_cont = eval('$("#foto_tema_"+i+"")').html();
				eval('$("#imag_"+i+"")').html(inicio_cont);
				i++;
			}
			*/
			
			i=0;
				
				$('div[id^="foto_tema"]').each(function(i){
					i++;
					$("#imag_"+i).html($(this).html());
				});
				
		}
		
		var contador_segundos = 0;

		function start_timer(){

			contador_segundos =(new Date()).getTime();

			/*
			alert(contador_segundos);

			//Controlar id curso?
			$.get('http://127.0.0.1/20091021_moodle_1.9.6/www/blocks/fsstats/get_timestamp.php',null,function(data)
			{
			   	  contador_segundos = data;

			});
			*/

		}

		function register_timer(){

				

				var tiempo_final = (new Date()).getTime();
				var segundos = Math.round((tiempo_final - contador_segundos)/1000);
					
				if(contador_segundos != 0){
				//var segundos = contador_segundos;

					$.get('/blocks/fsstats/process_ajax.php?course_id='+id_curso+'&var_name=dedication&var_value='+segundos,null,function(data)
					{
						alert(data);
					});
				}
		}


		window.onload = start_timer;
		window.onunload = register_timer;
