// JavaScript Document
var ie4 = document.all;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all; 
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"

var gCmdPath="../images/menu";
var googleMapRef ="http://maps.google.it/maps?f=q&hl=it&geocode=&q=Lungomare+delle+Meduse+114,+Torvaianica,+Roma&sll=41.442726,12.392578&sspn=12.084734,20.43457&ie=UTF8&ll=41.607292,12.47725&spn=0.023553,0.039911&z=15&iwloc=addr";
var CitiesCode = new Array("Agrigento_74",
						   "Alessandria_144",
						   "Ancona_223",
						   "Aosta_266",
						   "Arezzo_316",
						   "AscoliPiceno_373",
						   "Asti_387",
						   "Avellino_412",
						   "Bari_532",
						   "Bolzano_752",
						   "Brindisi_924",
						   "Cagliari_1039",
						   "Caltanisetta_1100",
						   "Campobasso_1176",
						   "Caserta_1530",
						   "Catania1832",
						   "Catanzaro_1833",
						   "Firenze_2798",
						   "Foggia_2823",
						   "Forlė_2872",
						   "Genova_3088",
						   "Grosseto_3277",
						   "Imperia_3346",
						   "LaSpezia_3429",
						   "Latina_3498",
						   "Lecce_3523",
						   "Lecco_3525",
						   "Livorno_3614",
						   "Messina_4040",
						   "Napoli_4579",
						   "Oristano_4937",
						   "Pescara_5100",
						   "Pisa_5282",
						   "Ragusa_5644",
						   "ReggioCalabria_5687",
						   "ReggioEmilia_5688",
						   "Rimini_5740",
						   "Roma_5913",
						   "Salerno_6072",
						   "Sassari_6668",
						   "Siracusa_6921",
						   "Taranto_7159",
						   "Trento_7429",
						   "Trieste_7468",
						   "Venezia_7729",
						   "Viterbo_8005"
						   );


function MM_reloadPage(init)
{  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_setCmdPath(s)
{
	gCmdPath=s;
	
}
function MM_switchImageCmd(imgname,type)
{
	if ( document.images)
	{
		gCmdPath="../images/menu/";
		
		if ( type == 'S')
			document.images[imgname].src=gCmdPath+imgname+type+".png";
		else
  		    document.images[imgname].src=gCmdPath+imgname+".png";
	}
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
/************************ METEO ***********************************/
function MM_PopulateComboCity(theDoc)
{
	var oCitiesCombo = findObj("MeteoCity",theDoc);
	for ( var i=0; i<CitiesCode.length;i++)
	{
		var strCity = CitiesCode[i];
		var sepPos = strCity.indexOf("_");
			
		var oOption = theDoc.createElement("OPTION");
		oCitiesCombo.options.add(oOption);
		oOption.innerHTML = "<b>" + strCity.slice(0,sepPos); "</b>";
		oOption.innerText = strCity.slice(0,sepPos);
		oOption.value = strCity.slice(sepPos+1,strCity.length);
		if ( oOption.innerText  == "Latina")
			 oOption.selected=true;

		
	}
}
function MM_ComboCitySelected(oCitiesCombo)
{

	var oOptSelected = oCitiesCombo.options[oCitiesCombo.selectedIndex];
	var ilMeteoFrame = findObj("IlMeteoIT");
	var srcValue = "http://www.ilmeteo.it/script/meteo3h.php?id=free&citta=" + oOptSelected.value;
	
	ilMeteoFrame.src=srcValue;

}



// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
//Example: preloadImages('file.gif', 'http://www.x.com/y.gif');
function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}


/******************************************
* DHTML Ad Box (By Matt Gabbert at http://www.nolag.com)
* Visit http://www.dynamicdrive.com/ for full script
* This notice must stay intact for use
******************************************/

adTime=30;  // seconds ad reminder is shown
chanceAd=5; // ad will be shown 1 in X times (put 1 for everytime)
adCount=1;
function initAd()
{
      
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.sponsorAdDiv.style');
	else if(ns)	adDiv=eval('document.layers["sponsorAdDiv"]');
	else if(w3)	adDiv=eval('document.getElementById("sponsorAdDiv").style');
	randAd=Math.ceil(Math.random()*chanceAd);
        if (ie||w3)
        adDiv.visibility="visible";
        else
        adDiv.visibility ="show";
	if(randAd==1) showAd();
}
function showAd(){
	if(adCount<adTime*40)
	{
		adCount+=1;
	if (ie)
	{
		documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
		documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;
	}	
	else if (ns)
	{
		documentWidth=window.innerWidth/2+window.pageXOffset-20;
		documentHeight=window.innerHeight/2+window.pageYOffset-20;
	} 
	else if (w3)
	{
		documentWidth=self.innerWidth/2+window.pageXOffset-20;
		documentHeight=self.innerHeight/2+window.pageYOffset-20;
	} 
	adDiv.left=documentWidth-200+calunit;adDiv.top =documentHeight-200+calunit;
	setTimeout("showAd()",100);
	}
	else closeAd();
	
	
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function MM_ShowAdBox(imgSelected)
{

    var Path="../Events/images/";
	document.images['SponsorImg'].src=Path+imgSelected;
    if (ie||w3)
        adDiv.visibility="visible";
    else
        adDiv.visibility ="show";

showAd();
return false;
}

//End-->
