$(function(){
$( 'form' ).submit( function( e ) {
var form = $(this);
if(form.find("[name='crm_contacto[nombre]']").val() == "")
{
alert("Debe ingresar su nombre completo");
form.find("[name='crm_contacto[nombre]']").focus();
return false;
}
if(form.find("[name='crm_contacto[telefono]']").val() == "")
{
alert("Debe ingresar su teléfono");
form.find("[name='crm_contacto[telefono]']").focus();
return false;
}
if(form.find("[name='crm_contacto[email]']").val() == "")
{
alert("Debe ingresar su correo");
form.find("[name='crm_contacto[email]']").focus();
return false;
}
if(!/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.([a-z]){2,4})$/.test( form.find("[name='crm_contacto[email]']").val() ))
{
alert("Debe ingresar un correo válido");
form.find("[name='crm_contacto[email]']").focus();
return false;
}
if(form.find("[name='crm_consultas[comentario]']").val() == "")
{
alert("Debe ingresar el mensaje");
form.find("[name='crm_consultas[comentario]']").focus();
return false;
}
form.find( '[type="submit"]' ).attr( 'disabled', 'disabled' ).html( 'Enviando...' );
$.post( '/?_ajax_=getDataContacto&action=save', form.formToJson( ), function( data ) {
alert( 'Datos enviados.' );
form.find( '[type="submit"]' ).removeAttr( 'disabled' ).html( 'Enviar' );
}, 'jsonp' );
return false;
});
$.fn.serializeArrayAll = function() {
var rCRLF = /\r?\n/g;
return this.map(function(){
//return this.elements ? jQuery.makeArray( this.elements ) : this;
return jQuery.makeArray( this.elements );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
if(elem.type == "checkbox")
jQuery( this ).is(":checked") ? "" : val = "";
if(elem.type == "select-multiple")
{
if(jQuery( this ).hasClass("empty"))
{
return { name: elem.name, value: "" };
}
}
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
$.fn.formToJson = function ()
{
a = $(this).serializeArrayAll();//$(this).serializeArray();
var o = {};
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
}
})
$(function(){
var tpj=jQuery;
var revapi4;
tpj(document).ready(function() {
if(tpj("#rev_slider_4_1").revolution == undefined){
revslider_showDoubleJqueryError("#rev_slider_4_1");
}else{
revapi4 = tpj("#rev_slider_4_1").show().revolution({
sliderType:"standard",
jsFileLocation:"../../revolution/js/",
sliderLayout:"fullwidth",
dottedOverlay:"none",
delay:9000,
navigation: {
keyboardNavigation:"off",
keyboard_direction: "horizontal",
mouseScrollNavigation:"off",
onHoverStop:"off",
touch:{
touchenabled:"on",
swipe_threshold: 75,
swipe_min_touches: 1,
swipe_direction: "horizontal",
drag_block_vertical: false
}
,
arrows: {
style:"uranus",
enable:true,
hide_onmobile:false,
hide_onleave:false,
left: {
h_align:"left",
v_align:"center",
h_offset:30,
v_offset:0
},
right: {
h_align:"right",
v_align:"center",
h_offset:30,
v_offset:0
}
}
,
bullets: {
enable:false,
hide_onmobile:true,
hide_under:600,
style:"metis",
hide_onleave:true,
hide_delay:200,
hide_delay_mobile:1200,
direction:"horizontal",
h_align:"center",
v_align:"bottom",
h_offset:0,
v_offset:30,
space:5,
tmp:' {{title}}'
}
},
viewPort: {
enable:true,
outof:"pause",
visible_area:"80%"
},
responsiveLevels:[1240,1024,778,480],
gridwidth:[1240,1024,778,480],
gridheight:[500,500,500,400],
lazyType:"none",
parallax: {
type:"mouse",
origo:"slidercenter",
speed:2000,
levels:[2,3,4,5,6,7,12,16,10,50],
},
shadow:0,
spinner:"off",
stopLoop:"off",
stopAfterLoops:-1,
stopAtSlide:-1,
shuffle:"off",
autoHeight:"off",
hideThumbsOnMobile:"off",
hideSliderAtLimit:0,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
debugMode:false,
fallbacks: {
simplifyAll:"off",
nextSlideOnWindowFocus:"off",
disableFocusListener:false,
}
});
}
}); /*ready*/
})
$(function(){
})
$(function(){
});
$(function(){
})
$(function(){
})