function elm(str)
{
	return 	document.getElementById(str);
}

function swap(img,over)
{
	//alert(img)
	var image=document.getElementById(img)
	//var image=source1.firstChild
	var source=image.src
	var sourcenew=""
	if(over && source.substr(source.length-6,2)!="_u")
	{
		sourcenew=source.substr(0,source.length-4)+"_u"+source.substr(source.length-4,4)
		image.setAttribute("src",sourcenew);	
	}
	else if (!over && source.substr(source.length-6,2)=="_u")
	{
		sourcenew=source.substr(0,source.length-6)+source.substr(source.length-4,4)
		image.src=sourcenew;
	}
}


//-------------------------------
var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height, center)
{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }
  if(center)
  {
  	left = (screen.width) ? (screen.width-width)/2 : 0;
  	top = (screen.height) ? (screen.height-height)/2 : 0;
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
//-----------------------------------

function Zoom(oggetto)
{
	//alert("ZOOM!")
	div=oggetto.parentNode;
	//alert(div.id.substr(0,10))
	if(div.id.substr(0,10)=="MiniaturaP")
	{
		elm("LinkIngrandimento").style.position="absolute";	
	}
	else
	{
		elm("LinkIngrandimento").style.position="fixed";
	}
	
	div=oggetto.parentNode;
	arrStr=div.style.backgroundImage.split("/")
	strCod=arrStr[arrStr.length-1]
	strCod=strCod.substr(0,strCod.length-6)
	
	elm("LinkIngrandimento").style.display="block";
	elm("LabelChiudiIngrandimento").style.display="block";
	elm("loading").style.display="block";

	
	ajaxFunction()	
	
	xmlHttp.open("GET","FileGenerator.asp?code="+strCod,true);
	xmlHttp.send(null);

	
	elm("ingrandimento").style.backgroundImage="url(/FileGenerator.asp?code="+strCod+")"
	//elm("loading").style.display="none";
	elm("map").style.visibility="hidden";
	
}

function Clear()
{
	elm("LinkIngrandimento").style.display="none";
	elm("LabelChiudiIngrandimento").style.display="none";
	elm("loading").style.display="none";
	elm("map").style.visibility="visible";
	
}

//--------------------------------------------------------------------------

var xmlHttp;
function ajaxFunction()
{
	
	try
	{
		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			elm("loading").style.display="none"
			//document.myForm.time.value=xmlHttp.responseText;
		}
	}
}
/*
0	The request is not initialized
1	The request has been set up
2	The request has been sent
3	The request is in process
4	The request is complete
*/
//xmlHttp.open("GET","time.asp",true);
//xmlHttp.send(null);

