var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);

function cambio_tipo(form,op)
	{
		var listObj = form.edit_field;
		var indice = 0;
		listObj.length = 0;	
		for (var i = 0; i < campos_relacionados.length; i++)
		{

				var campo=campos_relacionados[i].replace(op+">>","");
				var campo_relacion = campos_relacionados[i].replace(">>"+campo,"");

				if (campo_relacion==op)
					{
						listObj.options[indice] = new Option(campo);
						listObj.options[indice].value=campo;
			 			indice++;
					}
		}
	}

function cambio_formulario(doc,op)
	{
		
		var txt='<table class="form_main">';
		
		for (n=0;n<elementos_formulario.length;n++) {
			//	alert (op+" = "+opciones[n]);
					if (opciones[n]==op)
						txt += elementos_formulario[n];
		}
		txt+='</table>'
		
		escribe(doc,"camposrelacionados",txt);
	}

function agregar_campo(ruta,op)
	{
		window.location.href=ruta+"&opcion="+op;
	}

function escribe(doc,capa,texto)
	{
		
		if (NS4)
			{
				if (doc.getElementById)
					doc.getElementById(capa).innerHTML=texto;
				else
					{
						doc.layers[capa].document.open();
						doc.layers[capa].document.write(texto);
						doc.layers[capa].document.close();
					}
			}
		else
			{
				doc.all.tags("DIV")[capa].innerHTML=texto;
			}
	}

