// JavaScript Document
function GetAvidDate(){
	var currentTime   = new Date()
	var day   = currentTime.getDay() 
	var month = currentTime.getMonth()
	var year  = currentTime.getFullYear()

	days = new Array ("Domenica", "Luned&igrave;", "Marted&igrave;", "Mercoled&igrave;", "Gioved&igrave;","Venerd&igrave;","Sabato")
	
	months = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre")
		    
	return days[day] + ', ' + currentTime.getDate() + ' ' + months[month] + ' ' + year
}


function importRSS(url)
{
	//document.write("importRSS start...");
	try //Internet Explorer
  	{
  		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		xmlDoc.load(url)
		if (xmlDoc.parseError.errorCode != 0) {
   			var myErr = xmlDoc.parseError;
   			//alert("You have error " + myErr.reason);
		} else {
   			//alert(xmlDoc.xml);			
		}

  	}
	catch(e)
  	{
  		try //Firefox, Mozilla, Opera, etc.
    	{
    		
			xmlDoc=document.implementation.createDocument("","",null);							
			xmlDoc.async=false;
			xmlDoc.load(url);
			
    	}
  		//catch(e) {alert(e.message)}
		catch(e)
 		{
  			try //Google Chrome
  			{
   				
				var xmlhttp = new window.XMLHttpRequest();
   				xmlhttp.open("GET",url,false);
   				xmlhttp.send(null);
   				xmlDoc = xmlhttp.responseXML.documentElement;
				
  			}
  			catch(e)
  			{
   				alert(e.message);
  			}
 		}

  	}
	return xmlDoc
}


function CreateTable1x2(xmlDoc, StrHref, StrImgSrc)
{
	//document.write("CreateTable1x2 start...");
	document.write('<table border=0 bordercolor="' + '#808080' + '">' );
	document.write('<tr>');
	document.write('<td bgcolor="#EFF0F4" valign="middle" align="center" height="25">');
	document.write('<a href="' + StrHref + '" target="_blank">');
	document.write('<img src="' + StrImgSrc + '" border="0">');			   
	document.write('</a>');
	document.write('</td>');
	document.write('<td width="510" height="10" >');
	document.write('<marquee width="510" height="25" scrolldelay="70" scrollamount="2" OnMouseOver="javascript:this.stop()" OnMouseOut="javascript:this.start()">');
	XMLParsing(xmlDoc);
	document.write('</marquee>');
	document.write('</td>');	
	document.write('</tr>');		   
	document.write('</table>');
}

function XMLParsing(xmlDoc)
{
//document.write("parseRSS start...");
	max_limit=15
	min_limit=1
	count=0
    
	var hitems = xmlDoc.getElementsByTagName( "item" );
	
	for ( var i = 0; i < hitems.length; i++ ) 	
	{		
		hitem = hitems.item(i)
		var stitle = hitem.getElementsByTagName("title")[0].firstChild.nodeValue;			
		var slink = hitem.getElementsByTagName("link")[0].firstChild.nodeValue;
        count = count + 1
		if (count >= min_limit && count <= max_limit) 
		{
			document.write('<a class="rss" href="' + slink + '" target=_blank>');
			document.write(stitle + ' | ');
			document.write('</a>');
		}
		slink = ''
		stitle = ''
	}
	
//document.write("parseRSS finish!");
}




function load_googlemaps(markers, id)
{
	var map = null;
	var geocoder = null;

	if (GBrowserIsCompatible())
	{	
			map = new GMap2(document.getElementById(id));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());

			geocoder = new GClientGeocoder();
			for(var i = 0; i < markers.length; i++)
				showAddress(markers[i], map, geocoder);
			}
}

function showAddress(data, map, geocoder)
	{
	if (geocoder)
		{
		geocoder.getLatLng(
    	data['address'],
			function(point)
				{
				if (!point)
					alert(data['address'] + " not found");
				else
					{
					map.setCenter(point, 13);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					GEvent.addListener(marker, "click",
						function()
							{
							map.openInfoWindowHtml(point, data['info']);
							}
						);
					}
				}
			);
		}
	}

