function funcionesHome(){

	// se llama a php
	load("ajax.php?Q=1");
	
	timeHome = window.setTimeout("funcionesHome_ajax(0)", 2000);
	}
function funcionesHome_ajax(vez){
	
	// mmm, posibles problemas, la dejamos ahí
	if(vez > 40){
		window.clearTimeout(timeHome);
		return;
		}
	
	// si todavía no hay nada, se vuelve a llamar
	if(valor_load == null || valor_load == "" || valor_load == "undefined"){
		vez2 = vez + 1;
		timeHome = window.setTimeout("funcionesHome_ajax(vez2)", 2000);
		return;
		}
	
	mtx_datos = valor_load.split("|");
	
	// si vino algo no esperado, se vuelve a llamar
	if(mtx_datos.length != 3){
		vez2 = vez + 1;
		timeHome = window.setTimeout("funcionesHome_ajax(vez2)", 550);
		return;
		}
	
	link = document.getElementById("pgHomeProdLink");
	titulo = document.getElementById("pgHomeProdTitulo");
	imagen = document.getElementById("pgHomeProdImagen");
	resumen = document.getElementById("pgHomeProdResumen");
	
	// se escriben algunas cosas
	titulo.innerHTML = "<h4>" + mtx_datos[0] + "</h4>";
	imagen.innerHTML = "<a href=\"" + link.innerHTML + "" +mtx_datos[0] + "\"><img src=\"www/img/prod_" +mtx_datos[0] + ".png\" /></a>";
	titulo.innerHTML = "<h4>" + mtx_datos[1] + "</h4>";
	//resumen.innerHTML = "<p>" + mtx_datos[2] + "</p>";
	resumen.innerHTML = "<p></p>";
	
	// se escribe el resumen de a poco
	funcionesHome_resumen(mtx_datos[2], 0);
	
	
	}
function funcionesHome_resumen(texto, pos){
	
	mtx = texto.split(" ");
	if(mtx.length >= pos){
		
		resumen = document.getElementById("pgHomeProdResumen");
		texto_tmp = "";
		for(i = 0; i < pos; i++){
			texto_tmp += mtx[i] + " ";
			}
		resumen.innerHTML = texto_tmp;
		
		// se vuelve a llamar
		pos2 = pos + 1;
		texto2 = texto;
		timeResumen = window.setTimeout("funcionesHome_resumen(texto2, pos2)", 150);
		
		}
	else{
		// se llama a php
		load("ajax.php?Q=1");
		timeHome = window.setTimeout("funcionesHome_ajax(0)", 2000);
		}
	}
