// rileviamo il Sistema Operativo il Browser e la sua versione 
// e settiamo variabili globali  

SOWIN = (navigator.userAgent.toLowerCase().indexOf("win") > -1) ? 1 : 0; 
SOMAC = (navigator.userAgent.toLowerCase().indexOf("mac") > -1) ? 1 : 0; 
SOLIN = (navigator.userAgent.toLowerCase().indexOf("linux") > -1) ? 1 : 0; 
SOALT = (!SOWIN && !SOMAC && !SOLIN) ? 1 : 0; 
 
OP = ((ind1 = navigator.userAgent.indexOf("Opera")) > -1) ? 1 : 0; 
punto = (OP) ? navigator.userAgent.indexOf(".",ind1):0; 
OP5 = (OP && parseInt(navigator.userAgent.substr(punto-1)) == 5) ? 1 : 0; 
OP6 = (OP && parseInt(navigator.userAgent.substr(punto-1)) == 6) ? 1 : 0; 

IE = ((ind2 = navigator.appVersion.indexOf("MSIE")) > -1 && !OP) ? 1 : 0; 
IE4 = (IE && parseInt(navigator.appVersion.substr(ind2+5)) == 4) ? 1 : 0; 
IE5 = (IE && parseInt(navigator.appVersion.substr(ind2+5)) == 5) ? 1 : 0; 
IE6 = (IE && parseInt(navigator.appVersion.substr(ind2+5)) == 6) ? 1 : 0; 

NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0; 
NN4 = (NN && parseInt(navigator.appVersion)==4) ? 1 : 0; 
NN6 = (NN && parseInt(navigator.appVersion)>4) ? 1 : 0; 

OT = (!IE && !NN && !OP) ? 1 : 0;

/////////////////// Lista funzioni 

function go(url) {
	//alert(url)
	location.href = url
}
function goParent(url) {
	//alert(url)
	parent.location.href = url
}
function openWindowCalendario(url) {
		w2 = window.open(url,"win",'scrollbars=0,menubar=0,resizable=0,width=310,height=270,status=0,top=250,left=300')
		w2.focus()
}
function openWindowSize(url, width, height) {
		//w2 = window.open(url,"win",'scrollbars=0,menubar=0,resizable=1,width="+ width +",height="+ height +",status=0')
		w2 = window.open(url,"win",'scrollbars=1,menubar=0,status=1,locationbar=1,location=1,width='+ width +',height='+ height)
		w2.focus()
}
function openWindow(url) {
		w2 = window.open(url,"win")
		w2.focus()
}
function openWindowClean(url) {
		w3 = window.open(url,"win3","status=0, resizable=1")
		w3.focus()
}


function indietro() {
	history.go(-1)
}
function checkdate( x)
{
	var anum=/(^[0-3]\d)-([0-1]\d)-(\d\d\d\d)/
	if (!anum.test(x))
		return false

	day = 1*RegExp.$1
	mon = 1*RegExp.$2
	year = 1*RegExp.$3

   maxday = 31
   if( (mon == 4) || (mon == 6) || (mon == 9) || (mon == 11))
		maxday = 30
   if( mon == 2) {
	  	maxday = 28
		if( (year % 4) == 0)
			maxday = 29
		if( (year % 100) == 0)
			maxday = 28
 	}

	if( (day<= maxday) && (day>0) && (mon<=12) && (mon>0))
		return true;
  
	return false
}

function showDIV(nameDiv) {
	var obj = document.getElementById(nameDiv)
	obj.style.display = 'block'
}

function calcolaPercorso (form ) {
	
	//strParam = "?CalcPer=1&lingua=ita"
	strParam = "?0=0";
	strParam += "&comune=" + form.comune.value.toLowerCase() + "&via=" + form.via.value.toLowerCase() + "&civico=" + form.civico.value
	
	strParam += "&comune2=" + form.comune2.value + "&via2=" + form.via2.value + "&civico2=" + form.civico2.value
	
	destination = "http://infopoint.atac.roma.it/bw.asp" + strParam
	openWindowSize(destination, 800, 600)
}

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function MostraImage( percorso) {
			i1 = new Image;
			i1.src = percorso;
			html = '<HTML>\n<head>\n<TITLE>Image</TITLE>\n</HEAD>\n<BODY onLoad="self.focus()" LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC="'+percorso+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER>\n</BODY>\n</HTML>';
			popupImage = window.open('','popupImage','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
			popupImage.document.open();
			popupImage.document.write(html);
			popupImage.document.close()
}





