$(document).ready(function () {
var note = $('#note'),
ts = new Date(2015, 2, 1),
newYear = true;
if((new Date()) > ts){
// The new year is here! Count towards something else.
// Notice the *1000 at the end - time must be in milliseconds
ts = (new Date()).getTime() + 10*24*60*60*1000;
newYear = false;
}
$('#countdown').countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
var message = "";
message += days + " day" + ( days==1 ? '':'s' ) + ", ";
message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
message += seconds + " second" + ( seconds==1 ? '':'s' ) + "
";
if(newYear){
message += "left until the new year!";
}
else {
message += "left to 10 days from now!";
}
note.html(message);
}
});
$('#countdown2').countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
var message = "";
message += days + " day" + ( days==1 ? '':'s' ) + ", ";
message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
message += seconds + " second" + ( seconds==1 ? '':'s' ) + "
";
if(newYear){
message += "left until the new year!";
}
else {
message += "left to 10 days from now!";
}
note.html(message);
}
});
$('#countdown3').countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
var message = "";
message += days + " day" + ( days==1 ? '':'s' ) + ", ";
message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
message += seconds + " second" + ( seconds==1 ? '':'s' ) + "
";
if(newYear){
message += "left until the new year!";
}
else {
message += "left to 10 days from now!";
}
note.html(message);
}
});
// form
$('#form1').validate({
rules: {
name: {
required:true,
},
mail: {
required: true,
email: true,
},
phone: {
required: true,
number:true,
},
},
messages: {
name: {
required: "Введите Ваше имя"
},
mail: {
required: "Введите Ваш e-mail",
email: "Введите ваш E-mail - Введите правильный e-mail"
},
phone: {
required: "Введите Ваш номер телефона",
number:"Введите Ваш номер телефона (только цифры)"
}
},
submitHandler: function(form){
var name = $('#form1').find('input[name="name"]').val();
var phone = $('#form1').find('input[name="phone"]').val();
var mail = $('#form1').find('input[name="mail"]').val();
$.post(
"contact.php",
{
name: name,
phone: phone,
mail: mail
}),
$('#modal_window').animate({opacity: 'show'}, 400);
setTimeout(function(){
$('#modal_window').animate({opacity: 'hide'}, 400);
},3000);
$('input[type="text"]').val('');
}
});
//end form
// form
$('#form2').validate({
rules: {
name: {
required:true,
},
mail: {
required: true,
email: true,
},
phone: {
required: true,
number:true,
},
},
messages: {
name: {
required: "Введите Ваше имя"
},
mail: {
required: "Введите Ваш e-mail",
email: "Введите ваш E-mail - Введите правильный e-mail"
},
phone: {
required: "Введите Ваш номер телефона",
number:"Введите Ваш номер телефона (только цифры)"
}
},
submitHandler: function(form){
var name = $('#form1').find('input[name="name"]').val();
var phone = $('#form1').find('input[name="phone"]').val();
var mail = $('#form1').find('input[name="mail"]').val();
$.post(
"contact.php",
{
name: name,
phone: phone,
mail: mail
}),
$('#modal_window').animate({opacity: 'show'}, 400);
setTimeout(function(){
$('#modal_window').animate({opacity: 'hide'}, 400);
},3000);
$('input[type="text"]').val('');
}
});
//end form
// form
$('#form3').validate({
rules: {
name: {
required:true,
},
mail: {
required: true,
email: true,
},
phone: {
required: true,
number:true,
},
},
messages: {
name: {
required: "Введите Ваше имя"
},
mail: {
required: "Введите Ваш e-mail",
email: "Введите ваш E-mail - Введите правильный e-mail"
},
phone: {
required: "Введите Ваш номер телефона",
number:"Введите Ваш номер телефона (только цифры)"
}
},
submitHandler: function(form){
var name = $('#form1').find('input[name="name"]').val();
var phone = $('#form1').find('input[name="phone"]').val();
var mail = $('#form1').find('input[name="mail"]').val();
$.post(
"contact.php",
{
name: name,
phone: phone,
mail: mail
}),
$('#modal_window').animate({opacity: 'show'}, 400);
setTimeout(function(){
$('#modal_window').animate({opacity: 'hide'}, 400);
},3000);
$('input[type="text"]').val('');
}
});
//end form
$('#footer h2').click(function(){
$('#modal_window1').animate({opacity: 'show'}, 300);
});
$('#modal_window1').click(function(){
$('#modal_window1').animate({opacity: 'hide'}, 300);
});
});