$(document).ready(function() {
var $ = jQuery;
$('#button1').click(function(e) {
e.preventDefault();
var error1 = true;
var error2 = true;
var name = $('#name1').val();
var telephone = $('#telephone1').val();
var nameValid = /^[a-zA-Zа-яА-ЯёЁіІїЇ _]+$/;
var telephoneValid = /^[0-9()-+. ]+$/;
if (nameValid.test(name)) {
var error1 = false;
$('.name1').css({
color: '#000',
background: 'url(images/name.jpg) 0 50% no-repeat #fff'
});
} else {
$('.name1').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (telephoneValid.test(telephone)) {
var error2 = false;
$('.telephone1').css({
color: '#000',
background: 'url(images/tell.jpg) 0 50% no-repeat #fff'
});
} else {
$('.telephone1').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (error1 == false && error2 == false) {
$.post("send.php", $("#form1").serialize(), function(result) {
if (result == 'sent') {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thankss',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
$('#name1,#telephone1').val('');
} else {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thankss',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
}
});
}
});
$('#button2').click(function(e) {
e.preventDefault();
var error1 = true;
var error2 = true;
var name = $('#name2').val();
var telephone = $('#telephone2').val();
var nameValid = /^[a-zA-Zа-яА-ЯёЁіІїЇ _]+$/;
var telephoneValid = /^[0-9()-+. ]+$/;
if (nameValid.test(name)) {
var error1 = false;
$('.name2').css({
color: '#000',
background: 'url(images/name.jpg) 0 50% no-repeat #fff'
});
} else {
$('.name2').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (telephoneValid.test(telephone)) {
var error2 = false;
$('.telephone2').css({
color: '#000',
background: 'url(images/tell.jpg) 0 50% no-repeat #fff'
});
} else {
$('.telephone2').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (error1 == false && error2 == false) {
$.post("send.php", $("#form2").serialize(), function(result) {
if (result == 'sent') {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
$('#name2,#telephone2').val('');
} else {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
}
});
}
});
$('#button3').click(function(e) {
e.preventDefault();
var error1 = true;
var error2 = true;
var name = $('#name3').val();
var telephone = $('#telephone3').val();
var nameValid = /^[a-zA-Zа-яА-ЯёЁіІїЇ _]+$/;
var telephoneValid = /^[0-9()-+. ]+$/;
if (nameValid.test(name)) {
var error1 = false;
$('.name3').css({
color: '#000',
background: 'url(images/name.jpg) 0 50% no-repeat #fff'
});
} else {
$('.name3').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (telephoneValid.test(telephone)) {
var error2 = false;
$('.telephone3').css({
color: '#000',
background: 'url(images/tell.jpg) 0 50% no-repeat #fff'
});
} else {
$('.telephone3').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (error1 == false && error2 == false) {
$.post("send.php", $("#form3").serialize(), function(result) {
if (result == 'sent') {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
$('#name3,#telephone3').val('');
} else {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
}
});
}
});
$('#button4').click(function(e) {
e.preventDefault();
var error1 = true;
var error2 = true;
var name = $('#name4').val();
var telephone = $('#telephone4').val();
var nameValid = /^[a-zA-Zа-яА-ЯёЁіІїЇ _]+$/;
var telephoneValid = /^[0-9()-+. ]+$/;
if (nameValid.test(name)) {
var error1 = false;
$('.name4').css({
color: '#000',
background: 'url(images/name.jpg) 0 50% no-repeat #fff'
});
} else {
$('.name4').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (telephoneValid.test(telephone)) {
var error2 = false;
$('.telephone4').css({
color: '#000',
background: 'url(images/tell.jpg) 0 50% no-repeat #fff'
});
} else {
$('.telephone4').css({
color: '#900000',
background: 'url(images/uncheck.jpg) 0 50% no-repeat #fff'
});
}
if (error1 == false && error2 == false) {
$.post("send.php", $("#form4").serialize(), function(result) {
if (result == 'sent') {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
$('#name4,#telephone4').val('');
} else {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#thanks',
afterLoad: function() {
setTimeout(function() {
$.fancybox.close();
}, 2000);
}
})
}
});
}
});
$(document).ready(function() {
$('.order').click(function() {
$.fancybox({
padding: 0,
margin: 0,
width: 444,
height: 287,
type: 'inline',
href: '#pop-up',
showCloseButton: false,
hideOnContentClick: true,
centerOnScroll: true,
overlayColor: '#000',
autoDimensions: true,
})
return false;
})
});
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide",
animationLoop: false,
itemWidth: 780,
controlNav: false
,slideshowSpeed: 4000
,animationLoop: true
,minItems:1
,maxItems:1
,prevText: ""
,nextText: ""
});
});
$(window).load(function() {
$('.flexslider2').flexslider({
animation: "fade",
animationLoop: false,
itemWidth: 1000,
controlNav: false
,slideshowSpeed: 4000
,animationLoop: true
,minItems:1
,maxItems:1
,prevText: ""
,nextText: ""
});
});
$(function($) {
$.localScroll({
duration: 1000,
hash: true });
});
});