function $(id) {return document.getElementById(id);} //--------------------------------------------------------------------------------------------- function calcDetalle(){ var preciobase = parseFloat(document.getElementById('base').value); var unidades = document.getElementById('unidades'); var minimo = document.getElementById('minima'); if (unidades.value == ''){alert('Ingrese las unidades'); unidades.focus(); return false;} var x_precio = 0; var x_unidades= parseInt(unidades.value); var x_minima = parseInt(minimo.value); var descuento = getPrecioSeries('descuento', x_unidades); if (x_unidades == 0){ alert('La cantidad de unidades debe ser mayor a cero'); unidades.focus(); return false; } if (x_unidades < x_minima){ alert('La cantidad de unidades debe ser mayor a la m\u00EDnima especificada'); unidades.focus(); return false; } x_precio = (preciobase * x_unidades) * (1 - (descuento / 100)); document.getElementById('en_total_span').innerHTML = x_precio.toFixed(2);; document.getElementById('aux_total').value = x_precio; document.getElementById('aux_unidades').value = x_unidades; return true; } //--------------------------------------------------------------------------------------------- function getPrecioSeries(serie, unidades){ var precio = 0; var xSerie = document.getElementById(serie).value; if (xSerie != ''){ var aSerie = xSerie.split('|'); var aPares = new Array(); var aLimit = new Array(); for (var i=0; i= aLimit[0] && unidades <= aLimit[1]){precio = aPares[1]; break;} } } return parseFloat(precio); } //--------------------------------------------------------------------------------------------- function solicitarPresupuesto(){ if (calcDetalle()){ hs.htmlExpand($('spimg'), {contentId:'highslide-html'}); return true; } return false; } //--------------------------------------------------------------------------------------------- function checkFormCart(){ var nombre = $('slc_nombre'); var email = $('slc_email'); var telefono = $('slc_telefono'); var direccion = $('slc_direccion'); var logo = $('slc_logo'); var comentario= $('slc_comentario'); var condiciones= $('slc_condiciones'); var captcha= $('captcha-form'); var control= $('control'); if (nombre.value == ''){alert('Complete el nombre'); nombre.focus(); return false;} if (email.value == '') {alert('Complete el email'); email.focus(); return false;} if (telefono.value == '') {alert('Complete el tel\u00E9fono'); telefono.focus(); return false;} if (direccion.value == ''){alert('Complete la direcci\u00F3n'); direccion.focus(); return false;} if (logo.value == ''){alert('Seleccione un logo'); logo.focus(); return false;} if (comentario.value == ''){alert('Complete el comentario'); comentario.focus(); return false;} if (!(condiciones.checked)){alert('Debe de aceptar las condiciones'); condiciones.focus(); return false;} if (captcha.value == ''){alert('Complete el codigo.'); captcha.focus(); return false;} if (captcha.value !=control.value){alert('Codigo incorrecto.'); captcha.focus(); return false;} document.getElementById('frmSolicitar').submit(); return true; }