/* 
 * Guarda todos los scripts usados comunmente en las páginas jsp.
 * and open the template in the editor.
 */


function n_over(cell,link,newColour) {
    if (!newColour) newColour = "#999999";
    if (link) {
        link.oldColor = link.style.color;
        link.style.color='red';
        if (link.status) {
            window.status = link.status;
        }
    }
    if (cell) {
        cell.style.cursor="hand";
        cell.oldColor = cell.style.backgroundColor;
        cell.style.backgroundColor = newColour;
    }
    return true;
}

function n_out(cell,link) {
    if (link) {
        link.style.color = link.oldColor;
        link.style.cursor = "auto";
    }
    window.status="";
    if (cell) {
        cell.style.backgroundColor = cell.oldColor;
    }
    return true;
}

function trim(s) {
   return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}

function enviarFormulario() {
  document.getElementById("volvermodifica").submit();
}

function cargaFicha(ficha){
  fichero="imagenes/documentos/fichas/"+trim(ficha)+".png";
  // Aqui abrimos el fichero
  fin=window.open(fichero,"ficha","_blank");
}

function mostrarcant(form,contador){
    var f = document.getElementById( form );
    document.forms[0].elements['image[]']

    var canti= f.materialescant;

    if (canti.visibility == 'hidden'){
            canti="0";
            canti.style.visibility ='visible'; }
    else {canti.style.visibility = 'hidden'}

}


function submitform(form){
  // Función que varía el valor del input modifica.
  // form: formulario al que pertenece el input.

  var f = document.getElementById( form );
  var confirmar="Est\xE1 intentando modificar este registro.\x0ALos cambios seran permanentes.\x0A\xBFEst\xE1 seguro de continuar?";
  if (confirm(confirmar)) f.submit();

}

