﻿function borrar_letras_usuario(elemento)
{
    if (document.getElementById(elemento).value == 'Usuario ...')
    {
        document.getElementById(elemento).value = '';
    }
}
function poner_letras_usuario(elemento)
{
    if (EnBlanco(document.getElementById(elemento).value))
    {
        document.getElementById(elemento).value = 'Usuario ...';
    }
}

function borrar_letras_password(elemento)
{
    if (document.getElementById(elemento).value == 'Password ...')
    {
        document.getElementById(elemento).value = '';
    }
}
function poner_letras_password(elemento)
{
    if (EnBlanco(document.getElementById(elemento).value))
    {
        document.getElementById(elemento).value = 'Password ...';
    }
}
function comprobarCamposEnTabla() {
    var faltan_campos = true;
    for (i = 0; i < comprobarCamposEnTabla.arguments.length - 1; i += 2) {
        if (EnBlanco(document.getElementById(comprobarCamposEnTabla.arguments[i]).value)) {
            faltan_campos = false;
            document.getElementById('celda_' + comprobarCamposEnTabla.arguments[i + 1] + '_1').style.backgroundColor = '#ffebe8';
            document.getElementById('celda_' + comprobarCamposEnTabla.arguments[i + 1] + '_2').style.backgroundColor = '#ffebe8';
            document.getElementById(comprobarCamposEnTabla.arguments[i]).style.border = '1px solid #cc0000';
        }
        else {
            document.getElementById('celda_' + comprobarCamposEnTabla.arguments[i + 1] + '_1').style.backgroundColor = '#F1F1F1';
            document.getElementById('celda_' + comprobarCamposEnTabla.arguments[i + 1] + '_2').style.backgroundColor = '#F1F1F1';
            document.getElementById(comprobarCamposEnTabla.arguments[i]).style.border = '1px solid #dfdfdf';
        }
    }

    return faltan_campos;
}

function comprobarCamposEnTablaValor0() {
    var faltan_campos = true;
    for (i = 0; i < comprobarCamposEnTablaValor0.arguments.length - 1; i += 2) {
        if (document.getElementById(comprobarCamposEnTablaValor0.arguments[i]).value == 0) {
            faltan_campos = false;
            document.getElementById('celda_' + comprobarCamposEnTablaValor0.arguments[i + 1] + '_1').style.backgroundColor = '#ffebe8';
            document.getElementById('celda_' + comprobarCamposEnTablaValor0.arguments[i + 1] + '_2').style.backgroundColor = '#ffebe8';
            document.getElementById(comprobarCamposEnTablaValor0.arguments[i]).style.border = '1px solid #cc0000';
        }
        else {
            document.getElementById('celda_' + comprobarCamposEnTablaValor0.arguments[i + 1] + '_1').style.backgroundColor = '#F1F1F1';
            document.getElementById('celda_' + comprobarCamposEnTablaValor0.arguments[i + 1] + '_2').style.backgroundColor = '#F1F1F1';
            document.getElementById(comprobarCamposEnTablaValor0.arguments[i]).style.border = '1px solid #dfdfdf';
        }
    }

    return faltan_campos;
}

function comprobarCamposEnTablaValorN() {
    var faltan_campos = true;
    var valor = comprobarCamposEnTablaValorN.arguments[0];
    for (i = 1; i < comprobarCamposEnTablaValorN.arguments.length - 1; i += 2) {
        if (document.getElementById(comprobarCamposEnTablaValorN.arguments[i]).value == valor) {
            faltan_campos = false;
            document.getElementById('celda_' + comprobarCamposEnTablaValorN.arguments[i + 1] + '_1').style.backgroundColor = '#ffebe8';
            document.getElementById('celda_' + comprobarCamposEnTablaValorN.arguments[i + 1] + '_2').style.backgroundColor = '#ffebe8';
            document.getElementById(comprobarCamposEnTablaValorN.arguments[i]).style.border = '1px solid #cc0000';
        }
        else {
            document.getElementById('celda_' + comprobarCamposEnTablaValorN.arguments[i + 1] + '_1').style.backgroundColor = '#F1F1F1';
            document.getElementById('celda_' + comprobarCamposEnTablaValorN.arguments[i + 1] + '_2').style.backgroundColor = '#F1F1F1';
            document.getElementById(comprobarCamposEnTablaValorN.arguments[i]).style.border = '1px solid #dfdfdf';
        }
    }

    return faltan_campos;
}

function comprobarCampos() {

    var faltan_campos = true;
    for (i = 0; i < comprobarCampos.arguments.length - 1; i += 2) {
        if (EnBlanco(document.getElementById(comprobarCampos.arguments[i]).value)) {
            faltan_campos = false;
            document.getElementById(comprobarCampos.arguments[i + 1]).className = 'campo_obligatorio';
        }
        else {
            document.getElementById(comprobarCampos.arguments[i + 1]).className = 'display_none';
        }
    }

    return faltan_campos;
}

function comprobarCamposValor0() {
    var faltan_campos = true;
    for (i = 0; i < comprobarCamposValor0.arguments.length - 1; i += 2) {
        if (document.getElementById(comprobarCamposValor0.arguments[i]).value == 0) {
            faltan_campos = false;
            document.getElementById(comprobarCamposValor0.arguments[i + 1]).className = 'campo_obligatorio';
        }
        else {
            document.getElementById(comprobarCamposValor0.arguments[i + 1]).className = 'display_none';
        }
    }

    return faltan_campos;
}

function comprobarValorEditor(instanceName, span) {
    // Get the editor instance that we want to interact with.
    var oEditor = FCKeditorAPI.GetInstance(instanceName);

    // Get the editor contents as XHTML.
    // alert(oEditor.GetXHTML(false));

    if (EnBlanco(oEditor.GetXHTML(false))) // "true" means you want it formatted.
    {
        document.getElementById(span).className = 'campo_obligatorio';
        return false;
    }
    else {
        document.getElementById(span).className = 'display_none';
    }
}

function mostrarElemento(elemento) {
    document.getElementById(elemento).style.display = 'block';
    //document.getElementById(elemento).className = 'display_block';
}

function ocultarElemento(elemento) {
    document.getElementById(elemento).style.display = 'none';
    //document.getElementById(elemento).className = 'display_none';
}


function boton_over(i) {

    var elemento1 = 'boton_' + i + '_n';
    var elemento2 = 'boton_' + (parseInt(i) + parseInt('1')) + '_n';
    var elemento3 = 'boton_' + (parseInt(i) + parseInt('2')) + '_n';

    document.getElementById(elemento1).className = 'boton_4_n';
    document.getElementById(elemento2).className = 'boton_5_n';
    document.getElementById(elemento3).className = 'boton_6_n';
}

function boton_out(i) {

    var elemento1 = 'boton_' + i + '_n';
    var elemento2 = 'boton_' + (parseInt(i) + parseInt('1')) + '_n';
    var elemento3 = 'boton_' + (parseInt(i) + parseInt('2')) + '_n';

    document.getElementById(elemento1).className = 'boton_1_n';
    document.getElementById(elemento2).className = 'boton_2_n';
    document.getElementById(elemento3).className = 'boton_3_n';
}
function boton_over2(i) {

    var elemento1 = 'boton_' + i + '_g';
    var elemento2 = 'boton_' + (parseInt(i) + parseInt('1')) + '_g';
    var elemento3 = 'boton_' + (parseInt(i) + parseInt('2')) + '_g';

    document.getElementById(elemento1).className = 'boton_4_n';
    document.getElementById(elemento2).className = 'boton_5_n';
    document.getElementById(elemento3).className = 'boton_6_n';
}

function boton_out2(i) {

    var elemento1 = 'boton_' + i + '_g';
    var elemento2 = 'boton_' + (parseInt(i) + parseInt('1')) + '_g';
    var elemento3 = 'boton_' + (parseInt(i) + parseInt('2')) + '_g';

    document.getElementById(elemento1).className = 'boton_1_n';
    document.getElementById(elemento2).className = 'boton_2_n';
    document.getElementById(elemento3).className = 'boton_3_n';
}

function comprobarCampoEmail() {


  var x =0;
  var campos = document.getElementById(comprobarCampoEmail.arguments[0]).value.split(';');
 
  var campo_email = false;
  for(i=0 ; i<campos.length; i++)
  {
  
        if (Email(campos[i])) {
            campo_email = true;
          
        } else {
           x++;
        }
    }
  
    if(x==0)
    {
       
       return true;
    }else
    {
    
     return false;
    }
   
}