
objetoactual = 0;
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)

var pop;
//***** NOU ***************************/
/*var offsetxpoint=-200 //Customize x offset of tooltip
var offsetypoint=-70 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["alt"] : document.getElementById? document.getElementById("alt") : ""




function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}*/
/****------------------------------------------------------------------------------*/


/*---------------- nova versio --------------------*/
function pop_up(objeto) {
	
	var yoffset = -80;
	
	var x, y, right, bottom;
	
	pop = document.getElementById('popID_'+objeto);
	
	if((objetoactual != objeto)||(objetoactual != 0)){
		
		objetoactual = objeto;

		//alert("AMPLE :"+window.innerWidth); 
		
		
		var nombre = navigator.appName;
		
		document.onmousemove = function(e) {

			if (nombre == "Microsoft Internet Explorer"){

				x = event.clientX;
				y = event.clientY + document.documentElement.scrollTop;
								
				if (document.documentElement.clientWidth>850){
					x = (x - ((document.documentElement.clientWidth - 735)/2)) + 10;
				}else{//la pantalla es mes petita que 850
					x = x - ((850 - 735)/2);		
				}

				
				y += yoffset;
				pop.style.top = y+'px';
				pop.style.left = x+'px';
				
			
			}else{
				x = e.pageX;
				y = e.pageY;
				
				if (window.innerWidth>850){
					x = (x - ((window.innerWidth - 735)/2)) + 10;
				}else{//la pantalla es mes petita que 850
					x = x - ((850 - 735)/2);		
				}
				
				y += yoffset;
					
				pop.style.top = y+'px';
				pop.style.left = x+'px';
				
			}

		}
		
		pop.style.visibility = "visible";
		pop.style.display = "block";

	}
	
}




function oculta (objeto){			
	objetoactual = 0;	
	document.getElementById('popID_'+objeto).style.visibility="hidden";
	document.getElementById('popID_'+objeto).style.display="none";	

	/*ids=objeto.split(",");
	for(i=0;i<ids.length-1;i++){
		document.getElementById("popID_"+ids[i]).style.visibility="hidden";
		document.getElementById("popID_"+ids[i]).style.display="none";
	}*/
}




function enviaMenuSuperior(ruta){
	document.forms.menu_superior.action = ruta;
	document.forms.menu_superior.submit();
}

function loading(capa){
	document.getElementById(capa).innerHTML = '<img src="imagenes/loading.gif" />';
}

// carrega les dades obtingudes a la capa indicada
function cargaDadesCapa(dades,capa){
	//$('#'+capa).hide();
	document.getElementById(capa).innerHTML = dades;
	//$('#'+capa).fadeIn('slow');
}

// carrega les dades obtingudes a la capa indicada
function cargaMutipleDadesCapaInicio(dades,capa){
	//$('#'+capa).hide();
	var codigo_origen = document.getElementById(capa).innerHTML;
	document.getElementById(capa).innerHTML = dades + codigo_origen;
	// $(obj2).fadeIn('fast',function(){$(obj2).remove();});
	//$('#'+capa).fadeIn('slow');
}

// carrega les dades obtingudes a la capa indicada
function cargaMutipleDadesCapa(dades,capa){
	//$('#'+capa).hide();
	document.getElementById(capa).innerHTML += dades;
	//$('#'+capa).fadeIn('slow');
}

// HOME .........................................................................................................................................................

id_video_actual = 0;
id_regal_actual_cmpl = 0;
function create(title_text,content, options) {
  options = $.extend({title: title_text}, options || {});
  var dialog = new Boxy(content, options);
  allDialogs.push(dialog);
  return false;
}	

function enviaVideo(video,directorio,tipus_video,num_video,id_proyecto){	
	loading('video_proyecto');	
	$.ajax({
	   type: "POST",
	   url: "secciones/proyectos/proyectos_video.php",
	   data: "ajax=1&directorio="+directorio+"&video="+video+"&tipus_video="+tipus_video, 
	   success: function(msg){
			cargaDadesCapa(msg,'video_proyecto');
			actualitzaNumeros(num_video,id_proyecto);
	   }
	});	
}

function actualitzaNumeros(num_video,id_proyecto){	
	loading('numeros');	
	$.ajax({
	   type: "POST",
	   url: "secciones/proyectos/proyectos_numeros.php",
	   data: "ajax=1&num_video="+num_video+"&id_proyecto="+id_proyecto, 
	   success: function(msg){			
			cargaDadesCapa(msg,'numeros');			
	   }
	});	
}

String.prototype.htmlEntities = function () {
   return this.replace(/&/g,'_AMP_').replace('>','_GRAN_').replace('<','_PETIT_').replace(/[+]/g,'_PLUS_').replace(/#/g,'_ALMO_');
};
