function crea_ajax()
{
	var pagina = false
	if (window.XMLHttpRequest){
		pagina = new XMLHttpRequest()
	}else
	{
		if (window.ActiveXObject){
			try{
				pagina = new ActiveXObject("Msxml2.XMLHTTP")
			}
			catch (e){
				try{
					pagina = new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch (e){}
			}
		}
	}
	return pagina;
}

function canvi(val)
{
  var ajax = crea_ajax();
	ajax.open('GET', "cal.php?ladata="+val, true)
	ajax.onreadystatechange=function()
	{										
    if (ajax.readyState == 4 && (ajax.status==200 || window.location.href.indexOf("http")==-1))
    {
      document.getElementById("calendari").innerHTML = ajax.responseText;
		}
	}
	ajax.send(null);
}

function Out()
{
    document.getElementById("dades").style.visibility='hidden';
}

function thumb(obj, txt)
{   
  posit = document.getElementById("dades");
  posit.style.top = getTop(obj);
  posit.style.left = getLeft(obj)+20;
  posit.innerHTML = txt.substring(0, txt.length-8);
  posit.style.visibility = 'visible';
}

function getLeft(obj)
{
var el = obj;
var pL = 0;
while(el){pL+=el.offsetLeft;el=el.offsetParent;}
return pL
}

function getTop(obj)
{
var el = obj;
var pL = 0;
while(el){pL+=el.offsetTop;el=el.offsetParent;}
return pL
}
