// Archivo JScript
function highlite(obj,img,href){
    //obj.style.backgroundColor='#b2b2b2';
	obj.className='menu_on';	
	document.getElementById(href).className='menu_on';
	document.getElementById(img).src='./img/flecha_on.gif'
}

function delite(obj,img,href){
	//obj.style.backgroundColor='#cccccc';
	obj.className='menu_off';
	document.getElementById(href).className='menu_off';
	document.getElementById(img).src='./img/flecha_off.gif'
}



//  FUNCIONES VALREG 

/********************************************************************
   Validate 3.13                                           2002-10-10

   Collection of validate functions.

   // Markus Gemstad
   gemstad@hotmail.com
   http://www.gemstad.com (references, samples etc)

********************************************************************/
/** Errormessages ***************************************************/

var sErrIsEmpty                 = " is required.\n";
var sErrFormat                  = "Err!";
var sErrNotChoosen              = " is not choosen.\n";

var sErrValidateZipcode         = " must contain a zipcode in the formats \"123 45\" or \"12345\".\n";
var sErrValidateEmail           = " is not a valid e-mail address.\n";
/*******************************************************************/

function validateZipcode(sZipcode, sName, bAllowEmpty) {
   // Valid format    Length
   // ======================
   // 12345           5
   // 123 45          6

   var sErrorMsg = "";
   var objRegExp;

   sZipcode = trim(sZipcode);

   if(!bAllowEmpty && sZipcode.length == 0) // If empty
   {
      sErrorMsg = "- " + sName + sErrIsEmpty;
   }
   else if(sZipcode.length > 0) // else check zipcode
   {
      if(sZipcode.length == 5) // 12345
      {
         objRegExp = new RegExp("[0-9]{5}");
         if(sZipcode.search(objRegExp) == -1) // If invalid
            sErrorMsg = "- " + sName + sErrValidateZipcode;
      }
      else if(sZipcode.length == 6) // 123 45
      {
         objRegExp = new RegExp("[0-9]{3} [0-9]{2}");
         if(sZipcode.search(objRegExp) == -1) // If invalid
            sErrorMsg = "- " + sName + sErrValidateZipcode;
      }
      else // If another length
         sErrorMsg = "- " + sName + sErrValidateZipcode;
   }
   return sErrorMsg;
}
function validateEmail(sEmail, sName, bAllowEmpty) {
   /* Written by Paolo Wales (paolo@taize.fr) starting on a basis by Samrat Sen.

   Notes:
   
   'exclude' checks 5 conditions:
   
   a) characters that should not be in the address
   b) characters that should not be at the start
   c) & d) characters that shouldn't be together
   e) there's not more than one '@'
   
   'check' checks there's at least one '@', later followed by at least one '.'
   'checkend' checks the address ends with a period followed by 2 or 3 alpha characters.
   N.B. Javascript 1.2 only works with version 4 browsers and higher. */
   
   var exclude   =/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
   var check     =/@[\w\-]+\./;
   var checkend  =/\.[a-zA-Z]{2,4}$/;   
   var sErrorMsg = "";
   sEmail = trim(sEmail);
 
   if(!bAllowEmpty && sEmail == "")
   {
      sErrorMsg = "- " + sName + sErrIsEmpty;
   }
   else if(sEmail != "")
   {
      if(((sEmail.search(exclude) != -1) || 
          (sEmail.search(check)) == -1) || 
          (sEmail.search(checkend) == -1))
      {
         sErrorMsg = "- " + sName + sErrValidateEmail;
      }
   }
   return sErrorMsg;
}
function ltrim(sValue) {
   while(1) {
      if(sValue.substring(0, 1) != " ")
         break;
      sValue = sValue.substring(1, sValue.length);
   }
   return sValue;
}
function rtrim(sValue) {
   while(1) {
      if(sValue.substring(sValue.length - 1, sValue.length) != " ")
         break;
      sValue = sValue.substring(0, sValue.length - 1);
   }
   return sValue;
}
function trim(sValue) {
   var sTemp = ltrim(sValue);
   return rtrim(sTemp);
}


// -----------------------------------------------------------------------
