//convierte a formato de monedas
function money(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

//valida formulario de contacto
function checkForm( form ) {
 var errorCount = 0;
// If the form is empty, display message
    if( isEmpty( form.nombre ) ) {
		document.getElementById('nombre').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('nombre').className = "formCaption";
    }	
// If the email address is not 'valid' display a message
    if( notValidEmail( form.correo1 ) ) {
		document.getElementById('correo1').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('correo1').className = "formCaption";
    }
	if( isEmpty( form.direccion ) ) {
		document.getElementById('direccion').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('direccion').className = "formCaption";
    }		
//If telfono Oficina is empty
	if( isEmpty( form.telefono ) ) {
		document.getElementById('telefono').className = "formCaptionError";
        errorCount++;
    } else {
		document.getElementById('telefono').className = "formCaption";
    }

// Otherwise, if everything is ok...return true and let the email send.
	if (errorCount) return false;
		else return true;
}
// Checks to see if form element is empty
function isEmpty( str) {
    strRE = new RegExp( );
    strRE.compile( '^[s ]*$', 'gi' );
    return strRE.test( str.value );
}
// Checks to see if email address is 'valid'
function notValidEmail( str ) {
    mailRE = new RegExp( );
    mailRE.compile( '^[._a-z0-9-]+@[.a-z0-9-]+[.]{1}[a-z]{2,4}$', 'gi' );
    return !(mailRE.test( str.value ));
}
//
