function getTime(lang){
	now = new Date();
	hour = now.getHours();
	min = now.getMinutes();
	sec = now.getSeconds();
	
	switch(lang){
		case "ita":
					txt="Benvenuto";
		
					dayName = new Array ("Domenica", "Luned&igrave;", "Marted&igrave;", "Mercoled&igrave;", "Gioved&igrave;", "Venerd&igrave;", "Sabato");
					break;
		case "eng":
					txt="Welcome";
					
					dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday;", "Saturday");
								
	}
	
	

	day = dayName[now.getDay()];
	year = now.getYear();
	if( year<2000 )
		year += 1900;	//Other browser compatibility
	data = now.getDate()+"/"+(now.getMonth()+1)+"/"+year;

	if( min<=9 )
		min = "0"+min;
	if( sec<=9 )
		sec = "0"+sec;

	GID('time').innerHTML = txt+" in S.T.I.T.I.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+day+" "+data+" "+((hour<=9) ? "0"+hour : hour) + ":" + min + ":" + sec;
	setTimeout("getTime()", 1000);
}


function close(){
	show2( 'scrollbar' );
	show2( 'captions' );
	show2( 'images' );
	hide2( 'zoom' );
}

function createMailto(name,domain,text,style){
	var STYLE="";
	EMAIL=name+"@"+domain;
	if( text != '' )
		TESTO=text;
	else
		TESTO=EMAIL;
	if( style )
		STYLE="style=\""+style+"\"";
	document.write("<a href=\"mailto:"+EMAIL+"\""+STYLE+">"+TESTO+"</a>");
}

function GID(id){
	return document.getElementById(id);
}

function toggleDiv(id){
	if( GID(id).style.display=="none" )
		show(id);
	else
		hide(id);
}

function show(id){
	GID(id).style.display='block';
}

function hide(id){
	GID(id).style.display='none';
}


/*
Muove avanti di una immagine
*/
function moveNext( ){
	if( current_index < max_index )
		loadImage( 'img', ++current_index );
	else{
		current_index=0;
		loadImage( 'img', current_index );
	}
}

/*
Muove indietro di una immagine
*/
function movePrev( ){
	if( current_index > 0 )
		loadImage( 'img', --current_index );
	else{
		current_index=images.length-1;
		loadImage( 'img', current_index );
	}
}

/*
Mostra l'immagine nell'id specificato e inserisce il rispettivo testo
*/
function loadImage( id, index ){
	GID(id).src = images[index];
	GID('text').innerHTML = text[index];
}


/*
Setta un'immagine (path) nel tag con l'id specificato
*/
function setImg( path, id ){
	GID(id).src = path;
}

function CalcolaPercorso(lang){
		CITTAD="Orgiano (VI)";
	INDIRIZZOD="Via%20Campagnola";
	ND="7";


	var CITTA=GID("citta").value;
	var INDIRIZZO=GID("indirizzo").value;
	var N=GID("n").value;
	
	switch(lang)
	{
	
	case "ita":
		if( CITTA=="" )
			alert("Inserire la citta' di partenza!")
		else
			window.open("http://www.viamichelin.it/viamichelin/ita/dyn/controller/Itineraires?strStartCityCountry=612&strStartAddress="+INDIRIZZO+"%2C+"+N+"&strStartMerged="+CITTA+"&strDestCityCountry=612&strDestAddress=CAMPAGNOLA%2C+7&strDestMerged=ORGIANO&choiceType=1&ie=UTF-8&x=0&y=0");
	break;
	
	case "eng":
			if( CITTA=="" )
			alert("Enter the city of departure!")
		else
			window.open("http://www.viamichelin.it/viamichelin/gbr/dyn/controller/Itineraires?strStartCityCountry=612&strStartAddress="+INDIRIZZO+"%2C+"+N+"&strStartMerged="+CITTA+"&strDestCityCountry=612&strDestAddress=CAMPAGNOLA%2C+7&strDestMerged=ORGIANO&choiceType=1&ie=UTF-8&x=0&y=0");

							
	}
	
	
	/*	window.open("http://www.tuttocitta.it/tcolnew/index_tcol.html#sez=1110&tpr=C&ft=1&com="+CITTA+"&ind="+INDIRIZZO+"&nc="+N+"&comR="+CITTAD+"&indR="+INDIRIZZOD+"&ncR="+ND);*/
}


function CalcolaPercorso2(lang){
		var CITTAD=GID("cittad").value;
	var INDIRIZZOD=GID("indirizzod").value;
	var ND=GID("nd").value;


	var CITTA=GID("cittap").value;
	var INDIRIZZO=GID("indirizzop").value;
	var N=GID("np").value;
	
	switch(lang)
	{
	case "ita":
		if( CITTA=="" )
			alert("Inserire la citta' di partenza!")
		else if( CITTAD=="" )
			alert("Inserire la citta' di destinazione!")
		else
			window.open("http://www.viamichelin.it/viamichelin/ita/dyn/controller/Itineraires?strStartCityCountry=612&strStartAddress="+INDIRIZZO+"%2C+"+N+"&strStartMerged="+CITTA+"&strDestCityCountry=612&strDestAddress="+INDIRIZZOD+"%2C+"+ND+"&strDestMerged="+CITTAD+"&choiceType=1&ie=UTF-8&x=0&y=0");
	break;
	
	case "eng":
		if( CITTA=="" )
			alert("Enter the city of departure!")
		else if( CITTAD=="" )
			alert("Enter the city of destination!")
		else
			window.open("http://www.viamichelin.it/viamichelin/gbr/dyn/controller/Itineraires?strStartCityCountry=612&strStartAddress="+INDIRIZZO+"%2C+"+N+"&strStartMerged="+CITTA+"&strDestCityCountry=612&strDestAddress="+INDIRIZZOD+"%2C+"+ND+"&strDestMerged="+CITTAD+"&choiceType=1&ie=UTF-8&x=0&y=0");						
	}
	
	

	
	/*	window.open("http://www.tuttocitta.it/tcolnew/index_tcol.html#sez=1110&tpr=C&ft=1&com="+CITTA+"&ind="+INDIRIZZO+"&nc="+N+"&comR="+CITTAD+"&indR="+INDIRIZZOD+"&ncR="+ND);*/
}


function showVideo( videoname ){
	//Centramento video
	GID('video').style.position = 'absolute';
	GID('video').style.top = screen.height/2-139;
	GID('video').style.left = screen.width/2-160;

	//Grigio di sfondo
	GID('gray').style.position = 'absolute';
	GID('gray').style.top = '0px';
	GID('gray').style.left = '0px';
	GID('gray').style.width = screen.width;
	GID('gray').style.height = screen.height;
	show('gray');

	getURL( 'video/video.asp?video='+videoname, 'video3d' );
	show('video');
	void(0);
}


function showVideo2( videoname ){
	//Centramento video
	GID('video').style.position = 'absolute';
	GID('video').style.top = screen.height/2-320;
	GID('video').style.left = screen.width/2-259;

	//Grigio di sfondo
	GID('gray').style.position = 'absolute';
	GID('gray').style.top = '0px';
	GID('gray').style.left = '0px';
	GID('gray').style.width = screen.width;
	GID('gray').style.height = screen.height;
	show('gray');

	getURL( 'video/video.asp?video='+videoname, 'video3d' );
	show('video');
	void(0);
}

function resetVideo(){
	getURL( 'empty.html', 'video3d' );
	hide('video');
	hide('gray');
}
