
var currentMenu = null;

		// muestra el menú pasado por parámetro
		function showOption(_value){
			document.getElementById('submenu').style.display = "none";
			if(currentMenu != null){
				document.getElementById('menu0' + currentMenu).style.display = "none";
	
if (currentMenu==1) { 
imagen="/barcelonactiva/images/es/home_opcion01_off_tcm85-12277.jpg";
} else if(currentMenu==2) {
imagen="/barcelonactiva/images/es/home_opcion02_off_tcm85-12279.jpg";
} else if(currentMenu==3) {
imagen="/barcelonactiva/images/es/home_opcion03_off_tcm85-12281.jpg";
} else if(currentMenu==4) {
imagen="/barcelonactiva/images/es/home_opcion04_off_tcm85-12283.jpg";
}
document.getElementById('menu_opt_' + currentMenu).style.background = "url("+imagen+")";


			}
			document.getElementById('menu0' + _value).style.display = "block";

if (_value==1) { 
imagen2="/barcelonactiva/images/es/home_opcion01_on_tcm85-12278.jpg";
} else if(_value==2) {
imagen2="/barcelonactiva/images/es/home_opcion02_on_tcm85-12280.jpg";
} else if(_value==3) {
imagen2="/barcelonactiva/images/es/home_opcion03_on_tcm85-12282.jpg";
} else if(_value==4) {
imagen2="/barcelonactiva/images/es/home_opcion04_on_tcm85-12284.jpg";
}


			document.getElementById('menu_opt_' + _value).style.background = "url("+imagen2+")"

			currentMenu = _value;
		}

		var current = 1;

		function canviaDestacat(_opt) {
      // La primera pasa a no activa
      if (current != _opt) {
        treuDestacat(current);
        document.getElementById("destacat_1").className = "";
        document.getElementById("destacat_" + _opt).className = "actiu";
        document.getElementById("destacats").className = "actiu_" + _opt;
        current = _opt;
      }
		}

		function treuDestacat(_opt) {
		  // La primera pasa a activa, treiem la seleccionada
		  document.getElementById("destacat_1").className = "actiu";
      document.getElementById("destacat_" + _opt).className = "";
      document.getElementById("destacats").className = "actiu_1";
		}

/*S'ha modificat aquesta funció per tal que les noves pagines s'obrin heredant les propietats de la finestra mare.
El problema venia perque desde la intranet de porta 22 al obrir nova finestra ho feia amb adreca de direccions i 
no tenia que sortir. El problema era el window.open que sempre per defecte la posaba
JUANMA 07/07/2008 
function prepareTargetBlank(){
   var className = 'external';
   var as = document.getElementsByTagName('a');
   for(i=0;i<as.length;i++){
      var a = as[i];
      r=new RegExp("(^| )"+className+"($| )");
      if(r.test(a.className)){
         a.onclick = function(){
            window.open(this.href);
            return false;
         }
      }
    }
  }*/

function prepareTargetBlank(){
var className = 'external';
var as = document.getElementsByTagName('a');
for(i=0;i<as.length;i++){
	var a = as[i];
	r=new RegExp("(^| )"+className+"($| )");
	if(r.test(a.className)){
		a.target='_blank';
	}
}
}
  

function setPNGs() {
  if (document.getElementById) {
    var menuD = document.getElementById("menuD");
    var menuF = document.getElementById("menuF");

    if (menuD != undefined) {
        menuD.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='/barcelonactiva/images/es/mascaraie_tcm85-12287.png')";
    }
    if (menuF != undefined) {
       document.getElementById("menuF").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='/barcelonactiva/images/es/mascaraie_tcm85-12287.png')";
    }
  }
}
  
window.onload = function() {
  prepareTargetBlank();
  setPNGs();
  
  try {
    if (currentPestanya != undefined) pestanya(currentPestanya);
  } catch (err) {}
  
  if (window.afterOnload) {
    afterOnload();
  }
}
function esEmail(str) {
	
	  // estŕn les expressions regulars suportades?
	  var supported = 0;
	  if (window.RegExp) {
	    var tempStr = "a";
	    var tempReg = new RegExp(tempStr);
	    if (tempReg.test(tempStr)) supported = 1;
	  }
	  if (!supported)
	    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
                   // Suport de dominis de correu de fins a 6 lletres
	  var r2 = new RegExp("^[a-zA-Z0-9\\-\\.\\_]+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,6}|[0-9]{1,3})(\\]?)$");  
	  // @@@ var r2 = new RegExp("^[a-zA-Z0-9\\-\\.\\_]+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");  
	  return (!r1.test(str) && r2.test(str));
}


// 16-04-2008 - OscarG - funcions per habilitar/deshabilitar botons, cursor hourglass, etc...
  function cursor_wait() {
    document.body.style.cursor = 'wait';
  }
  function cursor_clear() {
    document.body.style.cursor = 'default';
  }
  function canviTexte(elementId,valor) {
    document.getElementById(elementId).value = valor;
  }
  function inhabilitarBoto(elementId) {
    document.getElementById(elementId).disabled = true;
  }
  function habilitarBoto(elementId) {
    document.getElementById(elementId).disabled = false;
  }
  function preSubmit(elementId) {
    canviTexte(elementId,"Procesando petición...");
    inhabilitarBoto(elementId);
    cursor_wait();
  }

// 25-08-2009 - Jorge Tarifa - Funció per plegar i desplegar seccions del formulari de Formació ocupacional
    var arrayTables = new Array();
    arrayTables["table_1"] = 1;
    function change(_param) {
      if (arrayTables[_param] == undefined) {
        arrayTables[_param] = 0;
      }
      if ((arrayTables[_param] == 0)) {              // Mostrar
        document.getElementById(_param + "_1").className = "mostrar";
        arrayTables[_param] = 1;
        document.getElementById(_param).className = "desplegable";
      } else {                                       // Esconder
        document.getElementById(_param + "_1").className = "esconder";
        arrayTables[_param] = 0;
        document.getElementById(_param).className = "plegado";
      }      
    }