// SINOPSIS
// Funciones relativas al comportamiento del form de carga de datos de usuario (v2-misdatos.php)
// KNWON BUGS
// BITACORA
// GB 31-8-2009 Creacion

// GLOBALES
var limiteLinks = 10;		// limite a la cantidad de links
var cantidadLinks = 0;		// contador de catidad de links agregados

// SINOPSIS
// Agrega al DOM de la pagina un link
// INPUT
// ASSUMPTIONS & BUGS
// BITACORA
// GB 31-8-2009 Creacion
function agregarLink()
{	
	var boton, botones;
	
	// ubico el ultimo boton para apgarlo
	botones = document.getElementsByClassName('linkButton');
	// alert( botones.length );
	boton = botones[botones.length-1]; 
	boton.style.visibility = "hidden";

	// Agrego agrego la nueva linea al div de links
	// obtengo el div de links
	var div = document.getElementById('linksDiv');
	// creo el proximo div que va adentro
	var newdiv = document.createElement('div');
	// agrega en el innerHTML un campo para ingresar un nombre y link
	newdiv.innerHTML = "URL: (sin http://) <input type='text' name='link[]' class='lbx-form'/>";
	newdiv.innerHTML += " Nombre (ej: 'Facebook') <input type='text' name='nombre_link[]' class='lbx-form'/>";
	newdiv.innerHTML += " <input class='linkButton' type='button' value='Otro masss....!' onclick='agregarLink()' />";
  	div.appendChild(newdiv);
}


function apagarBoton( idBoton )
{
	var boton = document.getElementById( idBoton );
	boton.disabled = true;
}

// SINOPSIS
// Obtienen el valor de un elemento DOM. 
// Enmascara el hecho de que hay elementos que son externos, tipo los tinyMCE, que precisa de funciones especiales.
function getElementValue( id )
{
	return document.getElementById(id).value;
}


