var count = 1;

function addFoto() {
    var my_div = document.getElementById('imagenes');
    var newdiv = document.createElement('div');
    var divIdName = 'imagen' + count;
    newdiv.setAttribute('id',divIdName);
    var boton = document.getElementById('enviar');
    boton.value = 'Subir Imagenes';
    newdiv.innerHTML = "<p>Imagen</p> " +
    "<p> " +
    "  <input type=\"file\" name=\"imagen[]\" /> <a href=\"#\" onclick=\"removerFoto('imagen" + count + "')\" >remover Foto</a></p>" +
    "</p> " +
    "<p>Titulo</p> " +
    "<p> " +
    "  <input type=\"text\" name=\"titulo[]\" id=\"titulo[]\" class=\"textboxreg\"> " +
    "</p> " +
    "<p>Descripci&oacute;n</p> " +
    "<p> " +
    "  <textarea name=\"descripcion[]\" id=\"descripcion[]\" rows=\"3\" class=\"textboxreg\"></textarea> " +
    "</p> ";
    my_div.appendChild(newdiv);
    count++;
}

function removerFoto(divNum) {
    var d = document.getElementById('imagenes');
    var olddiv = document.getElementById(divNum);
    d.removeChild(olddiv);
}

function iniciaSesion() {
    var my_div = document.getElementById('sesion');
    my_div.innerHTML = "<form id=\"inicia\" name=\"form1\" method=\"post\" action=\"\"> " +
    "Usuario: " +
    "<input type=\"text\" name=\"user\" id=\"user\" class=\"sesionBox\" />" +
    " Password: " +
    "<input type=\"password\" name=\"pass\" id=\"pass\" class=\"sesionBox\"/>" +
    " <input type=\"submit\" name=\"entrar\" id=\"entrar\" value=\"Entrar\" />" +
    "</form>";
    document.getElementById("user").focus();
}