// JavaScript Document
////////////////////////////////////////////////////////////////
var SI_Array_ita = new Array("('Seleziona sottozona','0',true,true)",
							  "('Siena centro storico','1')",
							  "('Aree suburbane e Maremma senese','16')",
							  "('Val di Chiana','2')",
							  "('Val d\\'Orcia e monte Amiata','3')",
							  "('Chianti senese','4')"
					 );
var AR_Array_ita = new Array("('Seleziona sottozona','0',true,true)",
							  "('Arezzo centro storico','14')",
							  "('Aree suburbane e Val di Chiana','17')",
							  "('Val d\\'Arno aretino','5')",
							  "('Casentino','6')",
							  "('Val Tiberina','7')"
							  
					 );
var LU_Array_ita = new Array("('Seleziona sottozona','0',true,true)",
							  "('Lucca centro storico','8')",
							  "('Aree suburbane, Versilia e Garfagnana','18')",
							  "('Colli lucchesi','9')"
					 );
var FI_Array_ita = new Array("('Seleziona sottozona','0',true,true)",
							  "('Firenze centro storico','10')",
							  "('Aree suburbane e Val d\\'Arno inferiore','15')",
							  "('Chianti fiorentino','11')",							 
							  "('Val d\\'Arno fiorentino','12')",
							   "('Mugello','13')"
					 );
var AltroArray_ita = new Array("('Nessuna sottozona','0',true,true)");

/////INGLESE////////////////////////////////////////////////////////////////////////////////////
var SI_Array_eng = new Array("('Select zone','0',true,true)",
							  "('Siena historical center','1')",
							  "('Suburban areas and senese Maremma','16')",
							  "('Chiana valley','2')",
							  "('Orcia valley and Mount Amiata','3')",
							  "('Siena\\'s Chianti','4')"
					 );
var AR_Array_eng = new Array("('Select zone','0',true,true)",
							  "('Arezzo historical center','14')",
							  "('Suburban areas and Chiana valley','17')",
							  "('Arezzo\\'s Arno valley','5')",
							  "('Casentino','6')",
							  "('Tiber valley','7')"
					 );
var LU_Array_eng = new Array("('Select zone','0',true,true)",
							  "('Lucca historical centre','8')",
							  "('Suburban areas, Versilia and Garfagnana','18')",
							  "('Lucca\\'s hills','9')"
					 );
var FI_Array_eng = new Array("('Select zone','0',true,true)",
							  "('Florence historical centre','10')",
							   "('Suburban areas and Lower Arno valley','15')",
							  "('Florentine Chianti','11')",							 
							  "('Upper Arno valley','12')",
							   "('Mugello','13')"
					 );

var AltroArray_eng = new Array("('No zones','0',true,true)");

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;
}
					 
function populateregione(inForm,selected,Populate,lang) {
	var selectedArray;
	selectedArray=eval("AltroArray"+"_"+lang);
	 try {
	 	   selectedArray = eval(selected+"_Array"+"_"+lang);
		   if(selectedArray===undefined)
			  throw "undef"
	 }catch(err){}
		
	myObjName="document."+inForm+"."+Populate;
	myObj=findObj(Populate)
	while (selectedArray.length < myObj.options.length) {
		myObj.options[(myObj.options.length - 1)] = null;
	}
	
	for (var i=0; i < selectedArray.length; i++) {
		eval("myObj.options[i]=" + "new Option" + selectedArray[i]);
	}
}

function setSelZona(obj,val){
	myObj=findObj(obj);
	i=0;newIndex=0;
	while (i < myObj.options.length) {
		if(myObj.options[i].value==val){
			newIndex=i;break;
		}
		i++;
	}
	myObj.selectedIndex=newIndex;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->