// JavaScript Document



function AbrirFormularios (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=550, height=365, top=85, left=140";
window.open(pagina,"",opciones);
}
function AbrirSGAE (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=550, height=215, top=85, left=140";
window.open(pagina,"",opciones);
}
function AbrirBuscador (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=550, height=315, top=85, left=140";
window.open(pagina,"",opciones);
}
function AbrirQuien (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=726, height=572, top=85, left=140";
window.open(pagina,"",opciones);
}

function open_page(page) {
    window.open(page);
}


function checkEnter(e){ //e is event object passed from function invocation
var characterCode// literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
AbrirBuscador('buscador.html')
//return false
}
else{
//return true
}
}

function hide_menu(id){
    document.getElementById(id).style.display = "none";
}
function show_menu(id) {    
    document.getElementById(id).style.display = "block";
}
function trial(id){
    document.getElementById(id).className = "stateChecked";
}
function trialChecked(id){
    document.getElementById(id).className = "stepbriefingChecked";
}
function changeToGray(texto,linea){
    document.getElementById(texto).className = "stepbriefing";
    document.getElementById(linea).className = "stateOff";
}
function changeToOn(texto,linea){
    document.getElementById(texto).className = "stepbriefingOn";
    document.getElementById(linea).className = "stateOn";
}
function changeToChecked(texto,linea){
	
    document.getElementById(texto).className = "stepbriefingChecked";
    document.getElementById(linea).className = "stateChecked";
}
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
function borrar(in1, in2, in3){
document.getElementById(in1).value = "";

}


//BRIEFING VALIDATION FUNCTIONS

// Contact Details Form

function validarSeccion1() {

    var lang = document.getElementById('lang');

    if (lang != null) {

        if (lang.value == 'EN')
            return validator_section1_en();
        else
            return validator_section1_es();
    } else {
       // por defecto el lenguaje utilizado es el castellano.
       return validator_section1_es();
    }
}


function validator_section1_es() {


    var errores = 'Hacen falta campos por llenar:\n';
    var numErrores = 0;
    if (document.briefingForm.nombre.value == '') {
        errores = errores + '- Nombre es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.apellido.value == '') {
        errores = errores + '- Apellido es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.empresa.value == '') {
        errores = errores + '- Empresa es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.telefono.value == '') {
        errores = errores + '- Telefono es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.email.value == '') {
        errores = errores + '- Email es obligatorio\n';
        numErrores = 1;
    } else {
        if (!valEmail(document.briefingForm.email.value)) {
            errores = errores + '- Email debe ser un Email valido\n';
            numErrores = 1;
        }
    }

    if (document.briefingForm.url.value == '') {
        errores = errores + '- URL es obligatorio\n';
        numErrores = 1;
    }

    //Validacion combo objetivo de contacto

    var objcontacto = $find('objetivoContacto');

    if (objcontacto != null) {

        if (objcontacto.get_value() == '0') {
            errores = errores + '- Debe escoger algun Objetivo de Contacto\n';
            numErrores = 1;
        }
    }

    if (numErrores == 1) {
        alert(errores);
        return (false);
    } else {
        return (true);
    }

}




function validator_section1_en() {

    var errores = 'Some required fields are empty:\n';
    var numErrores = 0;
    if (document.briefingForm.nombre.value == '') {
        errores = errores + '- Please provide a first name\n';
        numErrores = 1;
    }
    if (document.briefingForm.apellido.value == '') {
        errores = errores + '- Please provide surname(s)\n';
        numErrores = 1;
    }
    if (document.briefingForm.empresa.value == '') {
        errores = errores + '- Please provide company name\n';
        numErrores = 1;
    }
    if (document.briefingForm.telefono.value == '') {
        errores = errores + '- Please provide telephone number\n';
        numErrores = 1;
    }
    if (document.briefingForm.email.value == '') {
        errores = errores + '- Please provide e-mail address\n';
        numErrores = 1;
    } else {
        if (!valEmail(document.briefingForm.email.value)) {
            errores = errores + '- E-mail must be a valid e-mail address\n';
            numErrores = 1;
        }
    }

    if (document.briefingForm.url.value == '') {
        errores = errores + '- Please provide a URL\n';
        numErrores = 1;
    }
   

    //Validacion combo objetivo de contacto

    var objcontacto = $find('objetivoContacto');

    if (objcontacto != null) {

        if (objcontacto.get_value() == '0') {
            errores = errores + '- Please select a reason for contact\n';
            numErrores = 1;
        }
    }
    
    
    if (numErrores == 1) {
        alert(errores);
        return (false);
    } else {
        return (true);
    }


}






// Briefing - Brand Form

function validator_section2_es() {


    var errores = 'Hacen falta campos por llenar:\n';
    var numErrores = 0;
    if (document.briefingForm.nombreComercial.value == '') {
        errores = errores + '- Nombre Comercial es obligatorio\n';
        numErrores = 1;
    } /**/
    if (document.briefingForm.valorMarca1.value == '') {
        errores = errores + '- Valor de marca es obligatorio\n';
        numErrores = 1;
    }


    if (

    document.briefingForm.brand_ms_accidjazz.checked == false &&
	document.briefingForm.brand_ms_mellowpop.checked == false &&
	document.briefingForm.brand_ms_dance.checked == false &&
	document.briefingForm.brand_ms_party.checked == false &&
	document.briefingForm.brand_ms_navidad.checked == false &&
	document.briefingForm.brand_ms_rhythmnblues.checked == false &&
	document.briefingForm.brand_ms_heavyrock.checked == false &&
	document.briefingForm.brand_ms_rock.checked == false &&
	document.briefingForm.brand_ms_latin.checked == false &&
	document.briefingForm.brand_ms_easylistening.checked == false &&
	document.briefingForm.brand_ms_triphop.checked == false &&
	document.briefingForm.brand_ms_jazzrock.checked == false &&
	document.briefingForm.brand_ms_punk.checked == false &&
	document.briefingForm.brand_ms_AOR.checked == false &&
	document.briefingForm.brand_ms_pop.checked == false &&
	document.briefingForm.brand_ms_classical.checked == false &&
	document.briefingForm.brand_ms_soul.checked == false &&
	document.briefingForm.brand_ms_lounge.checked == false &&
	document.briefingForm.brand_ms_country.checked == false &&
	document.briefingForm.brand_ms_rocknnroll.checked == false &&
	document.briefingForm.brand_ms_funk.checked == false &&
	document.briefingForm.brand_ms_ambient.checked == false &&
	document.briefingForm.brand_ms_reggaeska.checked == false &&
	document.briefingForm.brand_ms_glamrock.checked == false &&
	document.briefingForm.brand_ms_blues.checked == false &&
	document.briefingForm.brand_ms_instrupop.checked == false &&
	document.briefingForm.brand_ms_jazz.checked == false &&
	document.briefingForm.brand_ms_swingRNB.checked == false &&
	document.briefingForm.brand_ms_ballads.checked == false &&
	document.briefingForm.brand_ms_disco.checked == false &&
	document.briefingForm.brand_ms_techno.checked == false &&
	document.briefingForm.brand_ms_house.checked == false &&
	document.briefingForm.brand_ms_chillout.checked == false &&
	document.briefingForm.brand_ms_fusion.checked == false &&
	document.briefingForm.brand_ms_folk.checked == false &&
	document.briefingForm.brand_ms_opera.checked == false &&
	document.briefingForm.brand_ms_carnavalbrasil.checked == false &&
	document.briefingForm.brand_ms_mariachi.checked == false &&
	document.briefingForm.brand_ms_popmexicano.checked == false &&
	document.briefingForm.brand_ms_bossanova.checked == false &&
	document.briefingForm.brand_ms_caribe.checked == false &&
	document.briefingForm.brand_ms_popularbrasilenia.checked == false &&
	document.briefingForm.brand_ms_reggaeton.checked == false &&
	document.briefingForm.brand_ms_celta.checked == false &&
	document.briefingForm.brand_ms_italiano.checked == false &&
	document.briefingForm.brand_ms_oriental.checked == false &&
	document.briefingForm.brand_ms_musicacanaria.checked == false &&
	document.briefingForm.brand_ms_euskera.checked == false &&
	document.briefingForm.brand_ms_forro.checked == false &&
	document.briefingForm.brand_ms_portuguesa.checked == false &&
	document.briefingForm.brand_ms_rockargentino.checked == false &&
	document.briefingForm.brand_ms_sertanejo.checked == false &&
	document.briefingForm.brand_ms_bigband.checked == false &&
	document.briefingForm.brand_ms_jazzpop.checked == false &&
	document.briefingForm.brand_ms_jazzblues.checked == false &&
	document.briefingForm.brand_ms_flamenco.checked == false &&
	document.briefingForm.brand_ms_nuevoflamenco.checked == false &&
	document.briefingForm.brand_ms_hits.checked == false &&
	document.briefingForm.brand_ms_novedades.checked == false &&
	document.briefingForm.brand_ms_bandassonoras.checked == false &&
	document.briefingForm.brand_ms_tango.checked == false &&
	document.briefingForm.brand_ms_infantil.checked == false &&
	document.briefingForm.brand_ms_comercial.checked == false &&
	document.briefingForm.brand_ms_OTROS.checked == false) {
        errores = errores + '- Debe escoger al menos un estilo musical\n';
        numErrores = 1;
    }
    if (numErrores == 1) {
        alert(errores);
        return (false);
    } else {
        return (true);
    }

 }

 function validator_section2_en() {

     var errores = 'Some required fields are blank:\n';
     var numErrores = 0;
     if (document.briefingForm.nombreComercial.value == '') {
         errores = errores + '- Please provide a trading name\n';
         numErrores = 1;
     } /**/
     if (document.briefingForm.valorMarca1.value == '') {
         errores = errores + '- Please specify a brand value\n';
         numErrores = 1;
     }
     if (

    document.briefingForm.brand_ms_accidjazz.checked == false &&
	document.briefingForm.brand_ms_mellowpop.checked == false &&
	document.briefingForm.brand_ms_dance.checked == false &&
	document.briefingForm.brand_ms_party.checked == false &&
	document.briefingForm.brand_ms_navidad.checked == false &&
	document.briefingForm.brand_ms_rhythmnblues.checked == false &&
	document.briefingForm.brand_ms_heavyrock.checked == false &&
	document.briefingForm.brand_ms_rock.checked == false &&
	document.briefingForm.brand_ms_latin.checked == false &&
	document.briefingForm.brand_ms_easylistening.checked == false &&
	document.briefingForm.brand_ms_triphop.checked == false &&
	document.briefingForm.brand_ms_jazzrock.checked == false &&
	document.briefingForm.brand_ms_punk.checked == false &&
	document.briefingForm.brand_ms_AOR.checked == false &&
	document.briefingForm.brand_ms_pop.checked == false &&
	document.briefingForm.brand_ms_classical.checked == false &&
	document.briefingForm.brand_ms_soul.checked == false &&
	document.briefingForm.brand_ms_lounge.checked == false &&
	document.briefingForm.brand_ms_country.checked == false &&
	document.briefingForm.brand_ms_rocknnroll.checked == false &&
	document.briefingForm.brand_ms_funk.checked == false &&
	document.briefingForm.brand_ms_ambient.checked == false &&
	document.briefingForm.brand_ms_reggaeska.checked == false &&
	document.briefingForm.brand_ms_glamrock.checked == false &&
	document.briefingForm.brand_ms_blues.checked == false &&
	document.briefingForm.brand_ms_instrupop.checked == false &&
	document.briefingForm.brand_ms_jazz.checked == false &&
	document.briefingForm.brand_ms_swingRNB.checked == false &&
	document.briefingForm.brand_ms_ballads.checked == false &&
	document.briefingForm.brand_ms_disco.checked == false &&
	document.briefingForm.brand_ms_techno.checked == false &&
	document.briefingForm.brand_ms_house.checked == false &&
	document.briefingForm.brand_ms_chillout.checked == false &&
	document.briefingForm.brand_ms_fusion.checked == false &&
	document.briefingForm.brand_ms_folk.checked == false &&
	document.briefingForm.brand_ms_opera.checked == false &&
	document.briefingForm.brand_ms_carnavalbrasil.checked == false &&
	document.briefingForm.brand_ms_mariachi.checked == false &&
	document.briefingForm.brand_ms_popmexicano.checked == false &&
	document.briefingForm.brand_ms_bossanova.checked == false &&
	document.briefingForm.brand_ms_caribe.checked == false &&
	document.briefingForm.brand_ms_popularbrasilenia.checked == false &&
	document.briefingForm.brand_ms_reggaeton.checked == false &&
	document.briefingForm.brand_ms_celta.checked == false &&
	document.briefingForm.brand_ms_italiano.checked == false &&
	document.briefingForm.brand_ms_oriental.checked == false &&
	document.briefingForm.brand_ms_musicacanaria.checked == false &&
	document.briefingForm.brand_ms_euskera.checked == false &&
	document.briefingForm.brand_ms_forro.checked == false &&
	document.briefingForm.brand_ms_portuguesa.checked == false &&
	document.briefingForm.brand_ms_rockargentino.checked == false &&
	document.briefingForm.brand_ms_sertanejo.checked == false &&
	document.briefingForm.brand_ms_bigband.checked == false &&
	document.briefingForm.brand_ms_jazzpop.checked == false &&
	document.briefingForm.brand_ms_jazzblues.checked == false &&
	document.briefingForm.brand_ms_flamenco.checked == false &&
	document.briefingForm.brand_ms_nuevoflamenco.checked == false &&
	document.briefingForm.brand_ms_hits.checked == false &&
	document.briefingForm.brand_ms_novedades.checked == false &&
	document.briefingForm.brand_ms_bandassonoras.checked == false &&
	document.briefingForm.brand_ms_tango.checked == false &&
	document.briefingForm.brand_ms_infantil.checked == false &&
	document.briefingForm.brand_ms_comercial.checked == false &&
	document.briefingForm.brand_ms_OTROS.checked == false) {
         errores = errores + '- Please select at least one musical style\n';
         numErrores = 1;
     }
     if (numErrores == 1) {
         alert(errores);
         return (false);
     } else {
         return (true);
     }
}

function validarSeccion2() {

    var lang = document.getElementById('lang');

    if (lang != null) {

        if (lang.value == 'EN')
            return validator_section2_en();
        else
            return validator_section2_es();
    } else {
        // por defecto el lenguaje utilizado es el castellano.
        return validator_section2_es();
    }
}

// Briefing - Delivery Point Form

function validator_section3_es() {

    var errores = 'Hacen falta campos por llenar:\n';
    var numErrores = 0;
    if (document.briefingForm.NumPdR.value == '') {
        errores = errores + '- Numero de PdR es obligatorio\n';
        numErrores = 1;
    } /**/

    //Validacion combo objetivo de contacto

    var location = $find('ubicacionPdR');

    if (location != null) {

        if (location.get_value() == '0') {
            errores = errores + '- Debe escoger alguna ubicacion\n';
            numErrores = 1;
        }
    }


    if (document.briefingForm.disponesSolucionMusical.value == '') {
        errores = errores + '- Dispones de alguna solucion musical es obligatorio\n';
        numErrores = 1;
    }

    if (document.briefingForm.disponesSolucionMusical.value == 'si') {
        if (document.briefingForm.cambioContenidoMusical.checked == false &&
	document.briefingForm.cambioTecnicos.checked == false &&
	document.briefingForm.cambioInnovacion.checked == false &&
	document.briefingForm.cambioSoporte.checked == false &&
	document.briefingForm.cambioOtro.checked == false) {
            errores = errores + '- Debe escoger al menos un motivo de cambio\n';
            numErrores = 1;
        }

        if (document.briefingForm.solucionMusical.value == '') {
            errores = errores + '- Fabricante de la solucion musical que tienen actualmente es obligatorio\n';
            numErrores = 1;
        }
    }
    if (document.briefingForm.vasConteo.checked == false &&
	document.briefingForm.vasVideo.checked == false &&
	document.briefingForm.vasLeds.checked == false &&
	document.briefingForm.vasAroma.checked == false &&
	document.briefingForm.vasAire.checked == false &&
	document.briefingForm.vasOtros.checked == false) {
        errores = errores + '- Debe escoger al menos un Servicios de Valor Añadido (SVA)\n';
        numErrores = 1;
    }
    if (document.briefingForm.horarioPdR.value == '') {
        errores = errores + '- Horario de los PdR es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.horarioOficina.value == '') {
        errores = errores + '- Horario de las oficinas centrales es obligatorio\n';
        numErrores = 1;
    }
    if (numErrores == 1) {
        alert(errores);
        return (false);
    } else {
        return (true);
    }

 }

 function validator_section3_en() {

     var errores = 'Some required fields are blank:\n';
     var numErrores = 0;
     if (document.briefingForm.NumPdR.value == '') {
         errores = errores + '- Please indicate number of delivery points\n';
         numErrores = 1;
     } /**/

     //Validacion combo objetivo de contacto

     var location = $find('ubicacionPdR');

     if (location != null) {

         if (location.get_value() == '0') {
             errores = errores + '- Please select at location of delivery points\n';
             numErrores = 1;
         }
     }

     if (document.briefingForm.disponesSolucionMusical.value == '') {
         errores = errores + '- Please indicate if you have any musical solution \n';
         numErrores = 1;
     }

     if (document.briefingForm.disponesSolucionMusical.value == 'si') {
         if (document.briefingForm.cambioContenidoMusical.checked == false &&
	document.briefingForm.cambioTecnicos.checked == false &&
	document.briefingForm.cambioInnovacion.checked == false &&
	document.briefingForm.cambioSoporte.checked == false &&
	document.briefingForm.cambioOtro.checked == false) {
             errores = errores + '- Please select at least one reason to change\n';
             numErrores = 1;
         }

         if (document.briefingForm.solucionMusical.value == '') {
             errores = errores + '- Please specify the manufacturer of your current music solution \n';
             numErrores = 1;
         }

     }
     
    
     if (document.briefingForm.vasConteo.checked == false &&
	document.briefingForm.vasVideo.checked == false &&
	document.briefingForm.vasLeds.checked == false &&
	document.briefingForm.vasAroma.checked == false &&
	document.briefingForm.vasAire.checked == false &&
	document.briefingForm.vasOtros.checked == false) {
         errores = errores + '- Please select at least one value-added service (VAS)\n';
         numErrores = 1;
     }
     if (document.briefingForm.horarioPdR.value == '') {
         errores = errores + '- Please indicate the timetable of the delivery point(s)\n';
         numErrores = 1;
     }
     if (document.briefingForm.horarioOficina.value == '') {
         errores = errores + '- Please indicate the timetable of the main offices\n';
         numErrores = 1;
     }
     if (numErrores == 1) {
         alert(errores);
         return (false);
     } else {
         return (true);
     }
 }


 function validarSeccion3() {

     var lang = document.getElementById('lang');

     if (lang != null) {

         if (lang.value == 'EN')
             return validator_section3_en();
         else
             return validator_section3_es();
     } else {
         // por defecto el lenguaje utilizado es el castellano.
         return validator_section3_es();
     }

 }


 // Briefing - Target Form

 function validator_section4_es() {

     var errores = 'Hacen falta campos por llenar:\n';
     var numErrores = 0;


     if (document.briefingForm.targetEdadDesde.value == '' || document.briefingForm.targetEdadHasta.value == '') {
         errores = errores + '- Edad es obligatorio\n';
         numErrores = 1;
     } /**/

     if ((document.briefingForm.targetEdadDesde.value != '') || (document.briefingForm.targetEdadHasta.value != '')) {
         if (document.briefingForm.targetEdadDesde.value > document.briefingForm.targetEdadHasta.value) {
             errores = errores + '- El rango de edad no es valido\n';
             numErrores = 1;
         }
     } /**/

     if (document.briefingForm.targetSexo.value == '') {
         errores = errores + '- Sexo es obligatorio\n';
         numErrores = 1;
     } /**/


     //Validacion combo 'targetEstilo'
     var styleTarget = $find('targetEstilo');

     if (styleTarget != null) {

         if (styleTarget.get_value() == '0') {
             errores = errores + '- Estilo es obligatorio\n';
             numErrores = 1;
         }
     }

     //Validacion combo Nivel Economico
     var statusTarget = $find('targetNivelEconomico');

     if (statusTarget != null) {

         if (statusTarget.get_value() == '0') {
             errores = errores + '- Nivel socio economico es obligatorio\n';
             numErrores = 1;
         }
     }

     if (numErrores == 1) {
         alert(errores);
         return (false);
     } else {
         return (true);
     }
 }

 function validator_section4_en() {

     var errores = 'Some required fields are blank:\n';
     var numErrores = 0;


     if (document.briefingForm.targetEdadDesde.value == '' || document.briefingForm.targetEdadHasta.value == '') {
         errores = errores + '- Please indicate age\n';
         numErrores = 1;
     } /**/

     if ((document.briefingForm.targetEdadDesde.value != '') || (document.briefingForm.targetEdadHasta.value != '')) {
         if (document.briefingForm.targetEdadDesde.value > document.briefingForm.targetEdadHasta.value) {
             errores = errores + '- The age range is not valid \n';
             numErrores = 1;
         }
     } /**/

     if (document.briefingForm.targetSexo.value == '') {
         errores = errores + '- Please indicate gender\n';
         numErrores = 1;
     } /**/


     //Validacion combo 'targetEstilo'
     var styleTarget = $find('targetEstilo');

     if (styleTarget != null) {

         if (styleTarget.get_value() == '0') {
             errores = errores + '- Please indicate style\n';
             numErrores = 1;
         }
     }

     //Validacion combo Nivel Economico
     var statusTarget = $find('targetNivelEconomico');

     if (statusTarget != null) {

         if (statusTarget.get_value() == '0') {
             errores = errores + '- Please indicate socio-economic level\n';
             numErrores = 1;
         }
     }

     if (numErrores == 1) {
         alert(errores);
         return (false);
     } else {
         return (true);
     }
     
     
    
  }


 function validarSeccion4() {

    var lang = document.getElementById('lang');

    if (lang != null) {

        if (lang.value == 'EN')
            return validator_section4_en();
        else
            return validator_section4_es();
    } else {
        // por defecto el lenguaje utilizado es el castellano.
        return validator_section4_es();
    }
}


function validator_section5_es() {

    var errores = 'Hacen falta campos por llenar:\n';
    var numErrores = 0;
    if (document.briefingForm.refMarca.value == '') {
        errores = errores + '- Al menos una Referencia de Marca es obligatoria\n';
        numErrores = 1;
    } /**/
    if (document.briefingForm.refEstilo.value == '') {
        errores = errores + '- Al menos una Referencia de Estilo es obligatoria\n';
        numErrores = 1;
    }

    if (document.briefingForm.refMusica.value == '') {
        errores = errores + '- Al menos una Referencia de Musica es obligatoria\n';
        numErrores = 1;
    }
    if (document.briefingForm.refIdiomas.value == '') {
        errores = errores + '- Idiomas es obligatorio\n';
        numErrores = 1;
    }
    if (document.briefingForm.refOtrosReferentes.value == '') {
        errores = errores + '- Otros Referentes es obligatorio\n';
        numErrores = 1;
    }
    if (numErrores == 1) {
        alert(errores);
        return (false); //cambiar a false
    } else {
        return (true);
    }

 }

 function validator_section5_en() {

     var errores = 'Some required fields are blank:\n';
     var numErrores = 0;
     if (document.briefingForm.refMarca.value == '') {
         errores = errores + '- Please indicate at least one reference brand\n';
         numErrores = 1;
     } /**/
     if (document.briefingForm.refEstilo.value == '') {
         errores = errores + '- Please indicate at least one reference style\n';
         numErrores = 1;
     }

     if (document.briefingForm.refMusica.value == '') {
         errores = errores + '- Please indicate at least one music reference\n';
         numErrores = 1;
     }
     if (document.briefingForm.refIdiomas.value == '') {
         errores = errores + '- Please indicate language(s)\n';
         numErrores = 1;
     }
     if (document.briefingForm.refOtrosReferentes.value == '') {
         errores = errores + '- Please indicate other references\n';
         numErrores = 1;
     }
     if (numErrores == 1) {
         alert(errores);
         return (false);
     } else {
         return (true);
     }
 }

function validarSeccion5(){
    var lang = document.getElementById('lang');

    if (lang != null) {

        if (lang.value == 'EN')
            return validator_section5_en();
        else
            return validator_section5_es();
    } else {
        // por defecto el lenguaje utilizado es el castellano.
        return validator_section5_es();
    }
}

function validarSeccion6() {

    var l = "ES";
    var errores = 'Hacen falta campos por llenar:\n';
    var message = '- Debe indicar si posee equipo informatico\n';
    
    var lang = document.getElementById('lang');

    if (lang != null)
        l = lang.value;
           
    if(l == 'EN'){
        errores = 'Some required fields are blank:\n';
        message = 'You must indicate if you have computer equipment\n';
    }
    
    
    var numErrores = 0;

    if (document.briefingForm.equipoInformatico.value == '') {
        errores = errores + message;
        numErrores = 1;
    } /**/
    

    if (numErrores == 1) {
        alert(errores);
        return (false); //cambiar a false
    } else {
        return (true);
    }
}

/*
MM_validateForm('nombre','','R');
return document.MM_returnValue;
if(return document.MM_returnValue == null ){
changeToChecked('textDatos','lineDatos'); 
changeToOn('textMarca','lineMarca'); 
hide_menu('f1'); 
show_menu('f2');}*/


function displayPanel() {
    
    var combo = document.getElementById('disponesSolucionMusical');
    var panel = document.getElementById('panelSolucionMusical');

    if (combo.value == 'si')
        panel.style.display = 'inline';
    else
        panel.style.display = 'none';

}

function keyValidator(ev) {
  
    var key = ev.keyCode; //codigo de tecla. 

    if ((key < 48 || key > 57) && key != 45 && key != 9)
    //si no es numero 
        if (!(key == 8 || key == 39 || key == 40 || key == 37 ||
               key == 46 || (key >= 96 && key <= 105)))
        window.event.returnValue = false; //anula la entrada de texto. 


    //Determinar si se está presionando SHIFT, ALT o CTRL
    if (ev.shiftKey || ev.altKey || ev.ctrlKey)
        window.event.returnValue = false; //cancela la ejecución del evento
}



function valEmail(valor) {

    re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
    if (!re.exec(valor)) {
        return false;
    } else {
        return true;
    }
}