/*************************************************/
/************ Telémaco Sistemas S.L **************/
/*************************************************/

/******* Funciones envio formulario correo *********/

function isEmail(str) {
  // are regular expressions supported?
  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,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function chequeo()
{
    mail 		= isEmail(document.envio.MAILFROM.value);
    nombre 		= document.envio.NOMBRE.value;
    empresa 	= document.envio.EMPRESA.value;
    direccion	= document.envio.DIRECCION.value;
    poblacion	= document.envio.POBLACION.value;
    pais	 	= document.envio.PAIS.value;
    telf	 	= document.envio.TELF.value;
  
  	if(!nombre)
		alert('Falta informar nombre.');
	else if(!empresa)
		alert('Falta informar empresa.');  
	else if (!mail)
		alert('Su correo electrónico no parece válido.\nIntrodúzcalo en el campo indicado.');
	else if(!direccion)
		alert('Falta informar dirección.');
	else if(!poblacion)
		alert('Falta informar población.'); 
	else if(!pais)
		alert('Falta informar país.');     
	else if(!telf)
		alert('Falta informar teléfono.');   		
	else
		document.envio.submit();
}

/*******************************/


function cambiarImagen(img){
  document.getElementById('art_img').src = img;
  document.getElementById('ampliar').href= img;
}


/*************** Funcion paginar *******************/
function paginar()
{
  document.fpaginacion.INDICE.value = document.fpaginacion.selectpag.value;
  document.fpaginacion.submit();
}
		
