// JavaScript Document
<!--
function borra(SelectObj)
{
//	var temp = document.formEncuesta.Comuna.options.length;
	var temp = SelectObj.options.length;
	for (var x=0;x <= temp ;x++)
	{
		//document.formEncuesta.Comuna.options.remove(temp-x);
//		document.formEncuesta.Comuna.options[temp-x]=null;
		SelectObj.options[temp-x]=null;
	};
}
//************************************
function getSelected(opt)
		{
           	var selected = new Array();      
            for (var intLoop = 0; intLoop < opt.length; intLoop++)
			{
               if ((opt[intLoop].selected) ||
                   (opt[intLoop].checked))
					{
                  index = selected.length;
                  selected[index] = new Object;
                  selected[index].value = opt[intLoop].value;
                  selected[index].index = intLoop;
               	}
            }
            return selected;
         }
//***********************************
function outputSelected(opt)
			{
            var sel = getSelected(opt);
            var strSel = "";
				for (var item in sel)
					strSel += sel[item].value;
			return strSel;
         	}
//************************************
function addNew(text, value,i,j)
{
	// Add a new option.
	var el = new Option(text,value);
	if (j == 1 )
           document.form.d8.options[i] = el;
	else
           document.form.d8.options[i] = el;
}
//*************************************
function mensaje(opt1)
{
	var Lista_Nombres=new Array();
        var Lista_Codigos=new Array();
	var seleccion = outputSelected(opt1.options);
	//----------------------------------
	borra(document.form.d8);
	//----------------------------------
	//----------------------------------
	if (seleccion == "13"){
			Lista_Nombres = Lista_Comuna_Nom_13;
		        Lista_Codigos = Lista_Comuna_Cod_13;
        }
	//----------------------------------
	if (seleccion == "1"){
			Lista_Nombres = Lista_Comuna_Nom_1;
		        Lista_Codigos = Lista_Comuna_Cod_1;
        }
	//----------------------------------
	if (seleccion == "2"){
			Lista_Nombres = Lista_Comuna_Nom_2;
		        Lista_Codigos = Lista_Comuna_Cod_2;
        }
	//----------------------------------
	if (seleccion == "3"){
			Lista_Nombres = Lista_Comuna_Nom_3;
			Lista_Codigos = Lista_Comuna_Cod_3;
	}
	//----------------------------------
	if (seleccion == "4"){
			Lista_Nombres = Lista_Comuna_Nom_4;
			Lista_Codigos = Lista_Comuna_Cod_4;
	}
	//----------------------------------
	if (seleccion == "5"){
			Lista_Nombres = Lista_Comuna_Nom_5;
		        Lista_Codigos = Lista_Comuna_Cod_5;
	}
	//----------------------------------
	if (seleccion == "6"){
			Lista_Nombres = Lista_Comuna_Nom_6;
		        Lista_Codigos = Lista_Comuna_Cod_6;
        }
	//----------------------------------
	if (seleccion == "7"){
			Lista_Nombres = Lista_Comuna_Nom_7;
			Lista_Codigos = Lista_Comuna_Cod_7;
	}		
	//----------------------------------
	if (seleccion == "8"){
			Lista_Nombres = Lista_Comuna_Nom_8;
			Lista_Codigos = Lista_Comuna_Cod_8;
	}
	//----------------------------------
	if (seleccion == "9"){
			Lista_Nombres = Lista_Comuna_Nom_9;
			Lista_Codigos = Lista_Comuna_Cod_9;
	}
	//----------------------------------
	if (seleccion == "10"){
			Lista_Nombres = Lista_Comuna_Nom_10;
			Lista_Codigos = Lista_Comuna_Cod_10;
	}
	//----------------------------------
	if (seleccion == "11"){
			Lista_Nombres = Lista_Comuna_Nom_11;
			Lista_Codigos = Lista_Comuna_Cod_11;
	}
	//----------------------------------
	if (seleccion == "12"){
			Lista_Nombres = Lista_Comuna_Nom_12;
                        Lista_Codigos = Lista_Comuna_Cod_12;
	}
       if (seleccion == "0"){
			Lista_Nombres = Lista_Comuna_Nom_T;
			Lista_Codigos = Lista_Comuna_Cod_T;
	}
	//----------------------------------
	for (var x=0 ; x< Lista_Nombres.length ; x++)
			addNew(Lista_Nombres[x],Lista_Codigos[x],x,1); 
}
//-->