var siteMessage = "@itona Web Site - Web de la vila d\'Aitona © 1998 - 2008 TM@SOT";
function click(key){
if (navigator.appName == "Netscape" && key.which == 3)
    {alert(siteMessage);return false;}
if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2)
    {alert(siteMessage);return false;}
}
document.onmousedown = click;

function findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
var obj_TIMERID;
var obj_VISIBLE;
var c;

function obj_PLACE()
{
	if (!c)
		return false;
	
	if (c.style)
		c = c.style;
	
	if (window.innerHeight)
		ih = window.innerHeight;
	else
		ih = document.body.clientHeight;
	
	if (window.innerWidth)
		iw = window.innerWidth;
	else
		iw = document.body.clientWidth;
	
	if (document.all) 
	{ 
		c.pixelLeft = (iw - 580) / 2 + document.body.scrollLeft + 0;
		c.pixelTop = 5;
	} 
	else 
	{
		c.left = (iw - 580) / 2 + window.pageXOffset + 0;
		c.top = 5;
	}
	c.visibility = obj_VISIBLE;
}

function openSP(obj)
{
	c = findObj(obj);

	if (!c)
		return false;

	if (c.style)
		c = c.style;

	obj_VISIBLE = 'visible';
	obj_PLACE();
	obj_TIMERID = window.setInterval('obj_PLACE()', 10);
	return true;
}

function closeSP(obj)
{
	c = findObj(obj);

	if (!c)
		return false;

	if (c.style)
		c = c.style;

	obj_VISIBLE = 'hidden';
	obj_PLACE();
	window.clearInterval(obj_TIMERID);
	return true;
}
