<!--

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

/************************************************
DESCRIPTION: Validates required fields for 
    Tell a Friend

PARAMETERS:
    form - form to validate

RETURNS:
    True if valid, alert window with errors if false.
*************************************************/
function validateSend(eform) {
    // Set variables
    var isErr = false; // for any type of error
    var errMessage = "";
    var errField = ""; // if there is an error, focus on the first required form field error
    
    // Get form values
    var fromEmail = eform.fromEmail.value;
	var toEmail = eform.toEmail.value;

    
    if (validateIsEmpty(fromEmail)) {  // email field is empty 
        isErr = true;
        errMessage = errMessage + "Denos su direcci\363n de correo electr\363nico.\r\n";
        if (errField.length <= 0) errField = "fromEmail";
    } else {
        fromEmail = trimString(fromEmail);
        var x = fromEmail.search(/ /);
        var y = fromEmail.search(/,/);
        var z = fromEmail.search(/;/);
        
        if ((x != -1) || (y != -1) || (z != -1)) { // Check for more than one email address
            isErr = true;
            errMessage = errMessage + "You are only allowed to enter one e-mail address at a time.\r\n";
            if (errField.length <= 0) errField = "fromEmail";
	        } 
        if (fromEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { // Check for valid email address
            isErr = true;
            errMessage = errMessage + "Please supply your valid e-mail address.\r\n";
            if (errField.length <= 0) errField = "fromEmail";
	        } 
    }
    
    if (validateIsEmpty(toEmail)) {  // email field is empty
        isErr = true;
		errMessage = errMessage + "Denos la direcci\363n de correo electr\363nico a donde debemos enviar la informaci\363n.\r\n";
        if (errField.length <= 0) errField = "toEmail";
    } else {
        toEmail = trimString(toEmail);
        var x = toEmail.search(/ /);
        var y = toEmail.search(/,/);
        var z = toEmail.search(/;/);
        
        if ((x != -1) || (y != -1) || (z != -1)) { // Check for more than one email address
            isErr = true;
            errMessage = errMessage + "You are only allowed to enter one e-mail address at a time.\r\n";
            if (errField.length <= 0) errField = "toEmail";
	        } 
        if (toEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { // Check for valid email address
            isErr = true;
            errMessage = errMessage + "Denos la direcci\363n de correo electr\363nico a donde debemos enviar la informaci\363n.\r\n";
            if (errField.length <= 0) errField = "toEmail";
	        } 
    }
    
    if (isErr) {
		alert(errMessage);
		eval("eform." + errField + ".focus()");        
		return false;
		}    
    return true;
}

/************************************************
DESCRIPTION: Checks if a string is empty

PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid (empty), otherwise false (not empty).
*************************************************/
function validateIsEmpty(strValue) { 
    strValue = trimString(strValue);
    if(strValue.length > 0) return false;
    return true;
}

/************************************************
DESCRIPTION: Removes leading and trailing spaces.

PARAMETERS: Source string from which spaces will
    be removed;

RETURNS: Source string with whitespaces removed.
*************************************************/
function trimString (str) {
    str = this != window? this : str;
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
    }

// Added as a method to the String.prototype
String.prototype.trim = trimString;



-->