function isEmail(str)
{
  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("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
		
  return (!r1.test(str) && r2.test(str));
}
		
function chequeo()
{
  vari = isEmail(document.envio.MAILFROM.value);
  nombre = document.envio.NOMBRE.value;  
  
  if (!vari)
	alert('Su correo electrónico no parece válido.\nIntrodúzcalo en el campo indicado.');
  else if(!nombre)
    alert('Introduzca su nombre.');
  else if(!document.envio.acepta.checked)
	alert('Tiene que aceptar la política de privacidad');    
  else
	document.envio.submit();
}

function js_Ventana(www,ancho,alto,titulo,target)
{
  var destino=www+'#'+target;
  var ventana=window.open(destino,titulo,'status=no,location=0,0, scrollbars=no, resizable=no,width='+ancho+',height='+alto);
  ventana.opener.top.name="opener";
  ventana.focus();
}
function popup(id)
{
  var ventana=window.open("otras/popimg.asp?idfoto="+id,"pop","status='no',location=0,0, scrollbars=no, resizable=no,width=640,height=480");
  ventana.opener.top.name="opener";
  ventana.focus();
}

/****** Menú superior *******/
function mostrar_submenu(id, idsub)
{    
  document.getElementById('submenu_sup').style.display='none';
  document.getElementById('ico_load_menu').style.display='';  
  var cache = Math.round(Math.random()*1000);
  ajax('load','ajax.asp?funcion=mostrar_submenu&idseccion='+id+'&idsub='+idsub+'&cache='+cache,'submenu_sup',submenu_ok);
}
function submenu_ok()
{	
  document.getElementById('ico_load_menu').style.display='none';	
  document.getElementById('submenu_sup').style.display='';  
}

/****** Menú lateral izq *******/
var id_izq=0;
function mostrar_submenu_izq(id)
{    
  id_izq=id;
  document.getElementById('submenu_izq'+id).style.display='none';
  document.getElementById('ico_load_menu_izq'+id).style.display='';
  var cache = Math.round(Math.random()*1000);
  ajax('load','ajax.asp?funcion=mostrar_submenu_izq&idseccion='+id+'&cache='+cache,'submenu_izq'+id,submenu_izq_ok);
}
function submenu_izq_ok()
{	
  document.getElementById('ico_load_menu_izq'+id_izq).style.display='none';	
  document.getElementById('submenu_izq'+id_izq).style.display='';
}

/********* Parte de experiencia *********/
function mostrar_exp_clientes(id)
{    
  document.getElementById('exp_clientes_option').style.display='none';
  document.getElementById('ico_clientes_load').style.display='';
  var cache = Math.round(Math.random()*1000);
  ajax('load','ajax.asp?funcion=mostrar_exp_clientes&idseccion='+id+'&cache='+cache,'exp_clientes_option',mostrar_exp_clientes_ok);
}
function mostrar_exp_clientes_ok()
{	
  document.getElementById('ico_clientes_load').style.display='none';
  document.getElementById('exp_clientes_option').style.display='';
}

/********** Mostrar imagenes cliente **********/
function mostrar_img_clientes(id)
{    
  if(id!='0')
  {
    document.getElementById('img_clientes').style.display='none';
    document.getElementById('img_clientes_load').style.display='';
    var cache = Math.round(Math.random()*1000);
    ajax('load','ajax.asp?funcion=mostrar_img_clientes&idnoticia='+id+'&cache='+cache,'img_clientes',mostrar_img_clientes_ok);
  }
}
function mostrar_img_clientes_ok()
{	
  document.getElementById('img_clientes_load').style.display='none';
  document.getElementById('img_clientes').style.display='';  
}

/********** Mostrar imagen grande **********/
function img_grande_cliente(img)
{    
  document.getElementById('img_grande_exp').style.display='none';
  document.getElementById('img_cliente_load_g').style.display='';
  var cache = Math.round(Math.random()*1000);
  ajax('load','ajax.asp?funcion=img_grande_clientes&img='+img+'&cache='+cache,'img_grande_exp',img_grande_cliente_ok);
}
function img_grande_cliente_ok()
{	
  document.getElementById('img_cliente_load_g').style.display='none';
  document.getElementById('img_grande_exp').style.display='';  
}

/********* Scroll experiencia **********/
function scroll_der_exp(pos_max)
{  
  var scroll=document.getElementById('scroll_exp_des').style;
  var pos = parseInt(scroll.left);
  if(pos_max!=pos){
    if(!pos)
      pos=0;
    pos -= 92;
    scroll.left = pos + "px";
    pos_ant=pos;
  }
}
function scroll_izq_exp()
{
  var scroll=document.getElementById('scroll_exp_des').style;
  var pos = parseInt(scroll.left);
  if(pos!=0 && !isNaN(pos)){
    pos += 92;//suma de padding: 0 8px 0 9px;
    scroll.left = pos + "px";
    pos_ant=pos;
  }
}

/****** Mostrar_mapa *******/
function mostrar_mapa(mapa)
{      
  document.getElementById('inf_mapa').style.display='none';
  document.getElementById('mapa_donde').style.display='none';
  document.getElementById('ico_carga_mapa').style.display='';  
  var cache = Math.round(Math.random()*1000);
  ajax('load','ajax.asp?funcion=ver_mapa&mapa='+mapa+'&cache='+cache,'mapa_donde',mapa_ok);
}
function mapa_ok()
{	
  document.getElementById('ico_carga_mapa').style.display='none';	
  document.getElementById('mapa_donde').style.display='';  
}