var a

function addresstopointnew(id,address,cliente) {
		xlongitudine = null
		ylatitudine = null
        var geocoder = new GClientGeocoder();
        geocoder.getLatLng(address,function(point){
        try {
        xlongitudine = point.x; 
        ylatitudine = point.y;
        SendQuerynew(id,xlongitudine,ylatitudine,address,cliente);
        } catch(e) {
       xlongitudine = "0";
       ylatitudine = "0";
       SendQuerynew(id,xlongitudine,ylatitudine,address,cliente);
}       
    }
        );
}

function SendQuerynew(id,xlongitudine,ylatitudine,address,cliente){
if(cliente == ''){
query = ("ID=" + id + '&Latitudine=' + ylatitudine + '&Longitudine=' + xlongitudine);
}else{
query = ("ID=" + id + '&Latitudine=' + ylatitudine + '&Longitudine=' + xlongitudine + '&cliente=citta');
}
//query = escape(query);
var xmlDoc = getXMLHttpRequestInstance();
xmlDoc.open("GET" , "http://www.regioneveneto.info/geocoding/updatecoord.asp?" + query, true);
xmlDoc.send("");

} 
    
function getXMLHttpRequestInstance() {
        var xmlhttp;
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
     
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp = false;
            }
        }
        //alert(e)
    return xmlhttp;
}

function apriinviomail(){
document.getElementById('sendmail').style.display='inline';
document.getElementById('sendmail').focus();
a=5;
return(false);
}

function insertflash(){
document.write('<img src="http://www.regioneveneto.info/immagini/header.jpg" usemap="#mapimg">')
document.write('<map name="mapimg">')
document.write('<area shape="rect" rel="nofollow" alt="home regioneveneto" href="http://www.regioneveneto.info" coords="3,39,317,123">')

document.write('</map>')

}

function compmail(id1,id2){
window.location.href = "mailto:" + id1 + "@" + id2
}

function ShowAndHide(id1,id2){
if(document.getElementById){
    el1=document.getElementById(id1);
    el2=document.getElementById(id2);
    if(el1.style.display=="none"){
        el1.style.display="inline";
        el2.style.display="none";
        }
    else{
        el1.style.display="none";
        el2.style.display="inline";
        }
    }
}

function forum(){
this.document.formforum.Submit();
}

function change(linguetta, scheda){

if(scheda == 'scheda2'){
document.getElementById("select10100").style.visibility = "hidden"
}
if(scheda == 'scheda1'){
document.getElementById("select10100").style.visibility = "visible"
}
if(document.getElementById){
var linguetta_x = document.getElementById(linguetta);
var scheda_x = document.getElementById(scheda);
var linguette = document.getElementById("linguette").getElementsByTagName("li");
var schede = document.getElementById("container").getElementsByTagName("div"); 
for(var i=0; i<linguette.length; i++){
//linguette[i].style.height = '30px';
linguette[i].style.background = '#fff';

}
for(var i=0; i<schede.length; i++){
schede[i].style.display="none";
}
//linguetta_x.style.height = '31px';
linguetta_x.style.background = '#e5ecf9';
scheda_x.style.display="inline";
//scheda2.style.height ="145px";
}

}

function runClock() {
theTime = window.setTimeout("runClock()", 200);
var today = new Date();
self.status = today.toLocaleString();
}
//runClock()

function eventi(a){

b=String(a)
//alert (''+b)
refer=b.substring(40,b.length)
//alert(''+refer)
indirizzo=b
//alert(''+indirizzo)
window.open(''+indirizzo,'e','height=500,width=700,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no')
//window.navigate(indirizzo)
return false
}


function eventi2(a){

b=String(a)
refer=b.substring(40,b.length)
//alert(''+refer)
indirizzo='eventi.asp?url2='+refer
//alert(''+indirizzo)
window.navigate(indirizzo)
return false
}


function cambiafac(a){
et=this.document.ris.facolta.options.selectedIndex;
ct=this.document.ris.facolta.options[et].text;
ct=ct.replace("'","''")
//alert(''+ct);
if (a>0){
et=this.document.ris.esame.options.selectedIndex;
ct1=this.document.ris.esame.options[et].text;
ct1=ct1.replace("'","''")
window.navigate('Appunti.asp?facolta='+ct+'&esame='+ct1)
}else{
window.navigate('Appunti.asp?facolta='+ct)}
}

function cerca(){
et=this.document.ris.facolta.options.selectedIndex;
ct=this.document.ris.facolta.options[et].text;
et=this.document.ris.esame.options.selectedIndex;
ct1=this.document.ris.esame.options[et].text;
ct1=ct1.replace("'","''")
window.navigate('Appunti.asp?facolta='+ct+'&esame='+ct1+'&submit=cerca')
}

function pubbl(id){

var idfinestra = window.open('pippo','DESCRIZIONE','height=500,width=700,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no');
idfinestra.document.open();
idfinestra.document.write("<html><scri")
idfinestra.document.write("pt language=javascript>")
idfinestra.document.write("function ridim(){window.resizeTo(document.images[0].width+50,document.images[0].height+90)}</scri")
idfinestra.document.write("pt>")
idfinestra.document.write("<body onLoad=ridim()><center><img src='/ImgLocali/"+id+"'>");
idfinestra.document.write("</center></body></html>");
idfinestra.document.close();
return false;
}

function cambianom(a){
//alert(''+a)
//lung=this.document.cerca.elements[a].length;
//et=this.document.cerca.elements[a].options.selectedLocali;
//ct=this.document.cerca.elements[a].options[et].text;

ct=this.document.cerca.elements[a].value;
//alert(''+ct);
	if(ct!="Cerca locale" && a==0){

	window.navigate('Locali.asp?lista='+ct)
	}

	if(ct!="Tipo di locale" && a==1){

	window.navigate('Locali.asp?tipo='+ct)
	}

}

function modelesswin(url,mwidth,mheight)
{
  if (document.all&&window.print) //if ie5
     eval('window.showModelessDialog(url,"LOCALE IN EVIDENZA","dialogtop:120px;dialogleft:20px;help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
  else
     eval('window.open(url,"LOCALE IN EVIDENZA","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=0")')
}


function smista(){
window.open('SmistaIscrizione.htm','Iscrizione','height=200,width=400,left=0,top=0,resizable=yes,scrollbars=no,toolbar=no,location=no')
return false;
}

function cancella(){
d=confirm('CANCELLARE IL PROFILO?')
if (d==true) {return true}
else{return false};
}

function mercatino(id){
//alert('')+id
window.open('Mercatino/'+id,'RegioneVeneto','height='+(screen.height-100)+',width='+screen.width+',left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no');
}

function generale(url,titolo,larghezza,altezza){
//alert('')+titolo
window.open(url,titolo,'height='+altezza+',width='+larghezza+',left=0,top=0,resizable=yes,scrollbars=no,toolbar=no,location=no');
return false;
}

function generaleconscroll(url,titolo,larghezza,altezza){
//alert('')+titolo
window.open(url,titolo,'height='+altezza+',width='+larghezza+',left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no');
return false;
}

function generaleconscrolleloc(url,titolo,larghezza,altezza){
//alert('')+titolo
window.open(url,titolo,'height='+altezza+',width='+larghezza+',left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=yes');
return false;
}

function messag(id){
//alert('')+id
window.open('http://www.regioneveneto.info/Messaggi.asp?ID='+id,'Regione Veneto','height='+(screen.height-50)+',width='+screen.width+',left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no');
return false;
}

function control(){

ww=document.getElementById('login').value;
aa=document.getElementById('password').value;
si=document.getElementById('sessionid').value;
	if(ww=="" || aa==""){
alert('Inserire sia la login sia la password');
return (false);}else{
//window.navigate('index.asp?valida=Entra&login='+ww+'&password='+aa+'&sid='+si)
document.logg.submit()
}
	}
	
	function passw(){
window.open('http://www.regioneveneto.info/Recupero.asp','PASSWORD','height=200,width=300,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no')
return false;
}

	function segnalaci(){
window.open('http://www.regioneveneto.info/Segnalaci.asp','PASSWORD','height=400,width=400,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no')
return false;
}

	function contattaci(){
window.open('http://www.regioneveneto.info/Contattaci.asp','PASSWORD','height=600,width=400,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no')
return false;
}

function pubbl(id){

var idfinestra = window.open('pippo','DESCRIZIONE','height=500,width=700,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,location=no');
idfinestra.document.open();
idfinestra.document.write("<html><scri")
idfinestra.document.write("pt language=javascript>")
idfinestra.document.write("function ridim(){window.resizeTo(document.images[0].width+50,document.images[0].height+90)}</scri")
idfinestra.document.write("pt>")
idfinestra.document.write("<body onLoad=ridim()><center><img src='/ImgLocali/"+id+"'>");
idfinestra.document.write("</center></body></html>");
idfinestra.document.close();
return false;
}

function cambianom(a){
//alert(''+a)
//lung=this.document.cerca.elements[a].length;
//et=this.document.cerca.elements[a].options.selectedLocali;
//ct=this.document.cerca.elements[a].options[et].text;

ct=this.document.cerca.elements[a].value;
//alert(''+ct);
	if(ct!="Cerca locale" && a==0){

	window.navigate('Locali.asp?lista='+ct)
	}

	if(ct!="Tipo di locale" && a==1){

	window.navigate('Locali.asp?tipo='+ct)
	}

}

function Banner(objName){
	this.obj = objName;
	this.aNodes = [];
	this.currentBanner = 0;
	
};

Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
	this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};

function Node(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
	this.name = name;
	this.bannerType = bannerType;
	this.bannerPath = bannerPath;
	this.bannerDuration = bannerDuration;
	this.height = height
	this.width = width;
	this.hyperlink= hyperlink;
//	alert (name +"|" + bannerType +"|" + bannerPath +"|" + bannerDuration +"|" + height +"|" + width + "|" + hyperlink);
};

Banner.prototype.toString = function() {
	var str = ""
	for (var iCtr=0; iCtr < this.aNodes.length; iCtr++){
		str = str + '<span name="'+this.aNodes[iCtr].name+'" '
		str = str + 'id="'+this.aNodes[iCtr].name+'" ';
		str = str + 'class="m_banner_hide" ';
		str = str + 'bgcolor="#FFFFFF" ';	// CHANGE BANNER COLOR HERE
		str = str + 'align="center" ';
		str = str + 'valign="top">\n';
		if (this.aNodes[iCtr].hyperlink != ""){
			//str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target=_blank>';
			//str = str + '<a href="http://www.regioneveneto.info" target=_blank>'
		}
			
		if ( this.aNodes[iCtr].bannerType == "FLASH" ){
			str = str + '<OBJECT '
			str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
			str = str + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '
			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" '
			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" '
			str = str + 'id="bnr_'+this.aNodes[iCtr].name+'" '
			str = str + 'ALIGN="" '
			str = str + '>'
			str = str + '<PARAM NAME=movie VALUE="'+ this.aNodes[iCtr].bannerPath + '">'
			str = str + '<PARAM NAME=quality VALUE=high>'
			str = str + '<PARAM NAME=bgcolor VALUE=#FFFFFF>'
			str = str + '<PARAM NAME=wmode value=transparent>' 
			str = str + '<EMBED ';
			str = str + 'src="'+this.aNodes[iCtr].bannerPath+'" '
			str = str + 'quality=high '
//			str = str + 'bgcolor=#FFFCDA '
			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" '
			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" '
			str = str + 'NAME="bnr_'+this.aNodes[iCtr].name+'" '
			str = str + 'ALIGN="center" '
			str = str + 'TYPE="application/x-shockwave-flash" '
			str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
			str = str + '</EMBED>'
			str = str + '</OBJECT>'
			
		}else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
			str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
			str = str + 'border="0" ';
			str = str + 'height="'+this.aNodes[iCtr].height+'" ';
			str = str + 'width="'+this.aNodes[iCtr].width+'">';
		}

		if (this.aNodes[iCtr].hyperlink != ""){
			//str = str + '</a>';
		}
		str += '</span>';
	}
	document.write(str)
	var str= ''
	return str;
	
};

Banner.prototype.start = function(){
	this.changeBanner();
	var thisBannerObj = this.obj;
	setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].bannerDuration * 1000);
}

Banner.prototype.changeBanner = function(){
	var thisBanner;
	var prevBanner = -1;
	if (this.currentBanner < this.aNodes.length ){
		thisBanner = this.currentBanner;
		if (this.aNodes.length > 1){
			if ( thisBanner > 0 ){
				prevBanner = thisBanner - 1;
			}else{
				prevBanner = this.aNodes.length-1;
			}
		}
		if (this.currentBanner < this.aNodes.length - 1){
			this.currentBanner = this.currentBanner + 1;
		}else{
			this.currentBanner = 0;
		}
	}
	

	if (prevBanner >= 0){
		document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide";
	}
	document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show";
}
