diff -Nup phone\phone.es.inc phone_es\phone.es.inc
--- phone\phone.es.inc	Thu Jan 01 01:00:00 1970
+++ phone_es\phone.es.inc	Wed Apr 16 21:21:04 2008
@@ -0,0 +1,55 @@
+﻿<?php
+// $Id: phone.es.inc $
+
+/**
+ * Verifies that $phonenumber is a valid nine-digit Spanish phone number
+ *
+ * @param string $phonenumber
+ * @return boolean Returns boolean FALSE if the phone number is not valid. 
+ */
+
+function valid_es_phone_number($phonenumber) {
+
+  //$phonenumber = trim($phonenumber);
+
+  // define regular expression
+  $regex = "/
+    \D*           # optional separator 
+    [69]\d{2}     # first group of numbers
+    \D*           # optional separator
+    \d{3}         # second group
+    \D*           # optional separator
+    \d{3}         # third group
+    \D*           # ignore trailing non-digits
+    $/x";
+  // return true if valid, false otherwise
+  return (bool) preg_match($regex, $phonenumber); 
+} 
+
+/**
+ * Convert a valid Spanish phone number into standard (+34) 916 555 777 format
+ * 
+ * @param $phonenumber must be a valid nine-digit number (with optional international prefix)
+ * 
+ */
+function format_es_phone_number($phonenumber) {
+
+  // define regular expression   
+  $regex = "/
+    \D*           # optional separator 
+    ([69]\d{2})   # first group of numbers
+    \D*           # optional separator
+    (\d{3})       # second group
+    \D*           # optional separator
+    (\d{3})       # third group
+    \D*           # ignore trailing non-digits
+    $/x"; 
+    
+  // get digits of phone number
+  preg_match($regex, $phonenumber, $matches);
+  
+  // construct ten-digit phone number
+  $phonenumber = $matches[1] . ' ' . $matches[2] . ' ' . $matches[3];
+  
+  return $phonenumber;
+}
diff -Nup phone\phone.module phone_es\phone.module
--- phone\phone.module	Fri May 11 15:35:30 2007
+++ phone_es\phone.module	Wed Apr 16 00:27:41 2008
@@ -14,6 +14,7 @@
  */
 function phone_field_info() {
   return array(
+    'es_phone' => array('label' => t('Spanish Phone Numbers')),
     'fr_phone' => array('label' => t('French Phone Numbers')),
     'ca_phone' => array('label' => t('US & Canadian Phone Numbers')),
    );
@@ -25,6 +26,11 @@ function phone_field_info() {
 function phone_field_settings($op, $field) {      
   switch ($op) {      
     case 'database columns':
+      if ($field['type'] == 'es_phone'){ 
+      	$columns = array(
+        	'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
+      	);
+      }
       if ($field['type'] == 'fr_phone'){ 
       	$columns = array(
         	'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
@@ -72,7 +78,7 @@ function phone_field_formatter_info() {
   return array(
     'default' => array(
       'label' => 'Default',
-      'field types' => array('fr_phone', 'ca_phone'),
+      'field types' => array('es_phone', 'fr_phone', 'ca_phone'),
     ),
   );
  } 
@@ -100,7 +106,7 @@ function phone_widget_info() {
   return array(
     'phone' => array(
       'label' => t('Textfield'),
-      'field types' => array('fr_phone', 'ca_phone'),
+      'field types' => array('es_phone', 'fr_phone', 'ca_phone'),
     ),
   );
 }
@@ -160,21 +166,23 @@ function phone_widget($op, &$node, $fiel
       return $form;
     
     case 'process form values':
-          if (is_array($node_field)) {
-            foreach ($node_field as $delta => $item) {
+      if (is_array($node_field)) {
+        foreach ($node_field as $delta => $item) {
     	    //format the phone number
-    	      if ($item['value'] != '') 
-	      { 
-    	        if ($field['type'] == 'fr_phone') { 
-	  	  $node_field[0]['value'] = format_phone_number('fr', $node_field[0]['value']);
-	        }
-    	        if ($field['type'] == 'ca_phone') { 
-	          $node_field[0]['value'] = format_phone_number('ca', $node_field[0]['value']);
+    	    if ($item['value'] != '') { 
+    	      if ($field['type'] == 'es_phone') { 
+	  	        $node_field[0]['value'] = format_phone_number('es', $node_field[0]['value']);
+	          }
+    	      if ($field['type'] == 'fr_phone') { 
+	  	        $node_field[0]['value'] = format_phone_number('fr', $node_field[0]['value']);
+	          }
+    	      if ($field['type'] == 'ca_phone') { 
+	            $node_field[0]['value'] = format_phone_number('ca', $node_field[0]['value']);
+	          }
 	        }
 	      }
 	    }
-	  }
-    break;
+      break;
     
     case 'validate':
       if (is_array($node_field)) {
@@ -182,6 +190,9 @@ function phone_widget($op, &$node, $fiel
 
 	    if ($item['value'] != '') 
 	    { 
+              if ($field['type'] == 'es_phone' && !valid_phone_number('es', $item['value'])) {
+                form_set_error($field['field_name'],t('"%value" is not a valid Spanish phone number<br/>Spanish phone numbers should only contains numbers and spaces and be like 999 999 999', array('%value' => $item['value'])));
+              }
               if ($field['type'] == 'fr_phone' && !valid_phone_number('fr', $item['value'])) {
                 form_set_error($field['field_name'],t('"%value" is not a valid French phone number<br>French phone numbers should only contains numbers and spaces and be like 99 99 99 99 99', array('%value' => $item['value'])));
               }
@@ -207,7 +218,7 @@ function valid_phone_number($countrycode
   $countrycode = trim($countrycode); 
   $phonenumber = trim($phonenumber);
 
-  if ($countrycode == 'fr' 
+  if ($countrycode == 'fr' || $countrycode == 'es' 
   	|| $countrycode == 'ca') { 
 	
         //drupal_set_message('langue = ' . $countrycode, 'error');
@@ -236,7 +247,7 @@ function format_phone_number($countrycod
   $countrycode = trim($countrycode); 
   $phonenumber = trim($phonenumber);
 
-  if ($countrycode == 'fr' 
+  if ($countrycode == 'fr'	|| $countrycode == 'es' 
   	|| $countrycode == 'ca') { 
 	
         //drupal_set_message('langue = ' . $countrycode, 'error');
