﻿// Archivo JScript

function changeButtonValue(btn, newValue)
{
    btn.value = newValue;
    btn.className = "botonProcessing";
}

//------------------- for clearing and replacing text in form input fields and textareas -------------------//
function clearText(thefield) 
{
    //Buscar una subvención o ayuda...
//    alert(thefield.defaultValue);
    
    if (thefield.defaultValue=="Buscar una subvención o ayuda...") 
    { 
        thefield.value = "";
        thefield.className = "campoTxt textoDefault";
    }
    else
        thefield.className = "campoTxt";
}
function replaceText(thefield) 
{
    if (thefield.value=="") 
    { 
        thefield.value = "Buscar una subvención o ayuda...";
        thefield.className = "campoTxt textoDefault";
    }
    else
        thefield.className = "campoTxt";
}

function updateClassName(thefield, className)
{
    thefield.className = className;
}

function defaultEnter(evento, btn)
{
    var oASCII;

    if(evento.keyCode)
        oASCII = evento.keyCode;
    else
        oASCII = evento.which;
    
    if(oASCII == 13)
    {
        document.getElementById(btn).click();
        return false;
    }
}

function sendBusqueda(_txtSearch)
{
    var _search = document.getElementById(_txtSearch).value;
    window.location = "resultadoBusqueda.aspx?search=" + _search;
    
    return false;
}



function checkOpciones(arrOpciones)
{
    var arrayOpciones = arrOpciones.split(",");

    for(var q = 0; q < arrayOpciones.length; q++)
        document.getElementById(arrayOpciones[q]).checked = true;                
}

function showElement(element)
{
    var _ele = document.getElementById(element);
    
    if(_ele.style.display == 'none')
        _ele.style.display = 'block';
    else
        _ele.style.display = 'none';        
}
