// ------------------ REGIONI E PROVINCIE ------------------ //

function gotoScr()
{
	szUrl = document.frmScr.lstScr.options[document.frmScr.lstScr.selectedIndex].value;
	//alert(szUrl);
	document.location = szUrl;
}

function gotoTest()
{
	szUrl = document.frmTest.lstTest.options[document.frmTest.lstTest.selectedIndex].value;
	//alert(szUrl);
	document.location = szUrl;
}
function gotoCond()
{
	szUrl = document.frmCond.lstCond.options[document.frmCond.lstCond.selectedIndex].value;
	//alert(szUrl);
	document.location = szUrl;
}
function selectedByValue(objCombo,val){
	for(var i=0;i<objCombo.options.length; i++){
		if(String(objCombo.options[i].value) == String(val)){
			objCombo.options[i].selected = true;
			return;
		}
	}
}
function clearListBox(objCombo,bAll){
	if((String(bAll) == 'true')){
		for(var i=objCombo.options.length;i>0;i--)	objCombo.options[i] = null;
	}else{ 
		for(var i=objCombo.options.length;i>-1;i--)	objCombo.options[i] = null;
	}
}
function updateListBox(objCombo,UpdateCombo,bAll){
	var objUpdateCombo = eval('objCombo.form.' + UpdateCombo);
	clearListBox(objUpdateCombo,bAll);
	var arName;
	arName = objCombo.options[objCombo.selectedIndex].value;
	arName = arName.replace(/ /gi,''); arName = arName.replace(/'/gi,''); arName = arName.replace(/"/gi,''); arName = arName.replace(/;/gi,''); arName = arName.replace(/=/gi,'');
	if(String(bAll)=='true' && objCombo.selectedIndex==0){		
		arName = objCombo.form.name + '_' + objCombo.name + '_ALL_';		
		loadListBox(objUpdateCombo,arName);
	}else if(arName != ''){
		arName = objCombo.form.name + '_' + objCombo.name + arName;
		loadListBox(objUpdateCombo,arName);
	}
	if(String(bAll)!='true' && String(bAll)!='false' && objUpdateCombo.length==0){
		objUpdateCombo.options[0] = new Option('','',true,true);
	}
	objUpdateCombo.options[0].selected = true;
}
function loadListBox(objChSelect, arName)
{	
	var arLabel = eval(arName + '_desc');
	var arValue = eval(arName + '_val');

	var j=0;
	if(objChSelect.options.length==1)
		j=1;
	if (arLabel.length >0){
		for (var i=0; i<arLabel.length; i++)
			objChSelect.options[i+j] = new Option(arLabel[i], arValue[i], false, false);
	}
}

function setRegionAndProv(idReg) {
	selectedByValue(document.thisForm.usrRegion,idReg);
	updateListBox(document.thisForm.usrRegion,'usrProv',true);
}



	
