function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validemail(form) {
  var field = form.correo;
  var str = field.value;
  if (window.RegExp) {
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp(reg1str);
    var reg2 = new RegExp(reg2str);
    if (!reg1.test(str) && reg2.test(str)) {
      return true;
    }
    field.focus();
    field.select();
    return false;
  } else {
    if(str.indexOf("@") >= 0)
      return true;
      field.focus();
      field.select();
    return false;
  }
}
 


function trim(cadena){ 
	for(i=0; i<cadena.length; ){
		if(cadena.charAt(i)==" ")
		cadena=cadena.substring(i+1, cadena.length);
	else break; }
	for(i=cadena.length-1; i>=0; i=cadena.length-1){
		if(cadena.charAt(i)==" ") cadena=cadena.substring(0,i);
		else break; }
	return cadena;
}


<!-- ---------------------------  CONTACTO ---------------------------------- //--> 

function comprobarContacto() {
  var f = document.formcontacto;
  
      if (f.nombre.value=='') {
   alert("Please write down your name.");
 document.formcontacto.nombre.focus();
 return false;
  }
  
  
  if (f.correo.value=='') {
   alert("Please provide us an e-mail address. We'll need it to communicate with you.");
 document.formcontacto.correo.focus();
 return false;
  }
   if (!validemail(f)) {
   alert("The e-mail address is incorrect.");
 document.formcontacto.correo.select();
 return false;
  }
  
    if (f.validarcorreo.value=='') {
   alert("The two e-mail addresses you entered did not match each other.");
 document.formcontacto.validarcorreo.focus();
 return false;
  }
  
  if (f.correo.value!=f.validarcorreo.value) {
   alert("The two e-mail addresses you entered did not match each other.");
 document.formcontacto.validarcorreo.select();
 return false;
  }
  
     if (f.mensaje.value=='') {
   alert("Por favor, write down your message.");
 document.formcontacto.mensaje.focus();
 return false;
  }
  
  if (f.mensaje.value=='' || f.mensaje.value.length < 11) {
   alert("The message must contains at least 10 characters.");
    document.formcontacto.mensaje.focus();
 return false;
  }
  
 f.action = 'contactar_post.php';
 f.submit();
 
 
 
}
<!-- ---------------------------  PEDIDOS ---------------------------------- //--> 

function comprobarPedido() {
  var f = document.formpedidos;
  
   if (f.nombre.value=='') {
   alert("Please write down your name.");
 document.formpedidos.nombre.focus();
 return false;
  }
   if (f.direccion.value=='') {
   alert("Please write down your address.");
 document.formpedidos.direccion.focus();
 return false;
  }
  if (f.cp.value=='') {
   alert("Please write down your zip code.");
 document.formpedidos.cp.focus();
 return false;
  }
   if (f.localidad.value=='') {
   alert("Please write down your city or location.");
 document.formpedidos.localidad.focus();
 return false;
  }
   if (f.localidad.value=='') {
   alert("Please write down your province.");
 document.formpedidos.localidad.focus();
 return false;
  }
       if (f.telefono.value=='') {
   alert("Por favor, write down a telephone.");
 document.formpedidos.telefono.focus();
 return false;
  }
  
    if (f.correo.value=='') {
   alert("Please provide us an e-mail address. We'll need it to communicate with you.");
 document.formpedidos.correo.focus();
 return false;
  }
  
   if (!validemail(f)) {
   alert("The e-mail address is incorrect.");
 document.formpedidos.correo.select();
 return false;
  }

 f.action = 'pedidos2.php';
 f.submit();
 
}