/*
* jQuery Untils - v1.1 - 2/18/2010
* http://benalman.com/projects/jquery-untils-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){$.each({nextUntil:"nextAll",prevUntil:"prevAll",parentsUntil:"parents"},function(a,b){$.fn[a]=function(e,f){var c=$([]),d=this.get();if(a.indexOf("p")===0&&d.length>1){d=d.reverse()}$.each(d,function(){$(this)[b]().each(function(){var g=$(this);if(g.is(e)){return false}else{if(!f||g.is(f)){c=c.add(this)}}})});return this.pushStack(c,a,e+(f?","+f:""))}})})(jQuery);
jQuery.preloadImages = function() {
jQuery.each (arguments,function (e) {
jQuery("").attr("src", this);
});
};
function jcarouselInitCallback() {
var jcarousel = this;
$(".jcarousel-clip").each(function(){
if (!$(this).hasClass("loadded"))
$(this).addClass("loadded").prepend('
');
});
}
function gotoLink(highlightElem) {
return;
//var elem = $(highlightElem).next('ul');
//elem = getCurrentCarouselItem(elem);
}
function getCurrentCarouselItem(ulElem){
$(ulElem).children("li.jcarousel-item").each(function(){
var leftPos = $(this).offset().left;
if( leftPos >= 0){
var id = $(this).attr('id').split("-");
currSlide = id[1];
return false;
}
});
return currSlide;
}
function onAfterAnimation(carousel, item, idx, state) {
carousel.container.find(".jcarousel-item a").removeClass("active");
var link = carousel.container.find(".jcarousel-list .jcarousel-item-" + idx + " a");
link.addClass("active");
/*
$(carousel.container).find(".hightlight").unbind("click mouseover mouseout").click(function(){
carousel.container.find(".jcarousel-item a.active").click();
//console.log(link);
//link.click();
}).mouseover(function(){
carousel.container.find(".jcarousel-item a.active").mouseover()
console.log(carousel.container.find(".jcarousel-item a.active"))
//link.mouseover();
}).mouseout(function(){
carousel.container.find(".jcarousel-item a.active").mouseout()
//link.mouseout();
});
*/
};
$.validator.setDefaults({
submitHandler: function(f) {
var form = f;
$(form).ajaxSubmit(function(){
try {
var text = "Спасибо за интерес к нашей компании. В течение часа наши консультанты свяжутся в вами.";
// GA
if (_gaq) {
// Calculator
if ("webform-client-form-76" == $(form).attr("id")) {
_gaq.push(['_trackPageview', '/virtual/forms/calc/send']);
// Feedback forms
} else if ("webform-client-form-83" == $(form).attr("id")) {
text = "Наш специалист свяжется с вами.";
} else {
_gaq.push(['_trackPageview', '/virtual/forms/feedback/send' + window.location.pathname]);
}
}
$(form).append('');
$(form).find(".again a").click(function(){
var form = $(this).parents("form");
form.find(".again").remove();
form.find("input.form-submit").show();
form.resetForm();
form.removeClass("disabled");
form.find(":disabled").removeAttr("disabled");
form.find("label").show();
form.find("label.error").remove();
return false;
});
$(form).find("input.form-submit").hide();
$(form).addClass("disabled");
$(form).find("input, textarea").attr("disabled", "disabled");
} catch(e) {}
});
}
});
var itemVisibleInCallback = {
onAfterAnimation: onAfterAnimation
};
function search_block_open() {
$("#search-theme-form").css('display', 'block');
$("#edit-search-theme-form-1").focus();
}
function search_block_close() {
$("#search-theme-form").fadeOut(200);
}
$(document).ready(function(){
// Tables
$("table tr:last-child").addClass("last");
// Forms
var formElements = "input:text, input:password, textarea";
$(formElements).each(function(n,e){
if ($(e).val()) {
$("label[for=" + $(this).attr("id") + "]").each(function(n, e){
if (!$(e).hasClass("error")) {
$(e).fadeOut(200);
}
});
};
});
$(formElements).focus(function(){
$("label[for=" + $(this).attr("id") + "]").each(function(n, e){
if (!$(e).hasClass("error")) {
$(e).fadeOut(200);
}
});
});
$(formElements).blur(function(){
if (!$(this).val()) {
$("label[for=" + $(this).attr("id") + "]").each(function(n, e){
if (!$(e).hasClass("error")) {
$(e).fadeIn(200);
}
});
};
});
/*
$(".webform-client-form input[type='submit']").bind("click", function() {
$(this).parents(".webform-client-form").validate({
submitHandler: function(form) {
$(form).ajaxSubmit();
$(form).append('');
// GA
if (_gaq) {
// Calculator
if ("webform-client-form-76" == $(form).attr("id")) {
_gaq.push(['_trackPageview', '/virtual/forms/calc/send']);
// Feedback forms
} else {
_gaq.push(['_trackPageview', '/virtual/forms/feedback/send' + window.location.pathname]);
}
}
$(form).find(".again a").click(function(){
var form = $(this).parents("form");
form.find(".again").remove();
form.find("input.form-submit").show();
form.resetForm();
form.removeClass("disabled");
form.find(":disabled").removeAttr("disabled");
form.find("label").show();
form.find("label.error").remove();
return false;
});
$(form).find("input.form-submit").hide();
$(form).addClass("disabled");
$(form).find("input, textarea").attr("disabled", "disabled");
}
});
});
*/
/*
$(".webform-client-form").validate({
submitHandler: function(form) {
$(form).ajaxSubmit();
$(form).append('');
// GA
if (_gaq) {
// Calculator
if ("webform-client-form-76" == $(form).attr("id")) {
_gaq.push(['_trackPageview', '/virtual/forms/calc/send']);
// Feedback forms
} else {
_gaq.push(['_trackPageview', '/virtual/forms/feedback/send' + window.location.pathname]);
}
}
$(form).find(".again a").click(function(){
var form = $(this).parents("form");
form.find(".again").remove();
form.find("input.form-submit").show();
form.resetForm();
form.removeClass("disabled");
form.find(":disabled").removeAttr("disabled");
form.find("label").show();
form.find("label.error").remove();
return false;
});
$(form).find("input.form-submit").hide();
$(form).addClass("disabled");
$(form).find("input, textarea").attr("disabled", "disabled");
return false;
}
});
*/
$(".webform-client-form").each(function(){
$(this).validate();
})
$("#block-menu-secondary-links .content > ul > li").each(function(num){
if (num < 2) {
$(this).addClass("services");
}
});
// Search
$("#search-link-open").click(function(){
search_block_open();
return false;
});
$("#search-link-close").click(function(){
search_block_close();
return false;
});
$(".search-link").click(function(){
search_block_open();
return false;
});
// Tooltips
options = {
track: true,
delay: 0,
showURL: false,
showBody: " - ",
fade: 250,
top: -35,
left: -4,
bodyHandler: function() {
return $(this).find("label").html().toLowerCase();
}
};
if ($.browser.msie) {
options.fade = 0;
}
var selector = ".views-field-field-price-value, "
+ ".views-field-field-manufacturability-value, "
+ ".views-field-field-ecology-value, "
+ ".views-field-field-thermal-insulation-value, "
+ ".views-field-field-insulation-value, "
+ ".views-field-field-safety-value ";
$(selector).tooltip(options);
// Consultant
options.bodyHandler = function(){
if ($("div.block.block-arwm_consult").hasClass("fixed")) {
return 'Убрать вниз сайта';
} else {
return 'Прижать к низу экрана';
}
};
$(".block-arwm_consult .content .switcher").tooltip(options);
// Partners
options.bodyHandler = function() {
return $(this).next().find(".field-content").html();
};
$(".view-partners .views-field-field-image-thumb-fid").each(function(){
if ($(this).next().length && $(this).next().is("div")) {
$(this).tooltip(options);
}
});
options.extraClass = 'multiline';
// Works` tooltip
options.bodyHandler = function(){return $(".view-id-works .jcarousel-item .active .description").html();};
$(".view-id-works .hightlight").tooltip(options);
// Glossary tooltips
$(".glossary-term abbr").each(function(obj) {
$(this).attr("title", "");
});
delete options.bodyHandler;
$(".glossary-term").tooltip(options);
// Blockquote
$("blockquote img").parent("blockquote").addClass("image");
$("blockquote img").parent("p").parent("blockquote").addClass("image");
// ESC
$(document).keypress(function(event){
if (27 == event.keyCode) {
// Search block
search_block_close();
}
});
// Empty click
$(document).click(function(event) {
target = $(event.target);
if (target.is('#search') || target.parents('#search').length) {
return;
} else {
search_block_close();
}
});
// Отступы
$("#content h2").nextUntil("h2, .h2, div").addClass("wrap");
$("#content h3").addClass("wrap").nextUntil("h2, .h2, h3, .h3").addClass("wrap-2");
// Eggs
$("#made-in").dblclick(function(){
$("body").css("background-image", "url(/sites/all/themes/default/images/bg-repeat1.png)");
});
//IE css fix:
//if($.bworser.msie) $('#block-block-5').css('paddingLeft','0px');
});
jQuery.extend(jQuery.validator.messages, {
required: "Это поле необходимо заполнить",
remote: "Пожалуйста, введите правильное значение",
email: "Неверный адрес",
url: "Пожалуйста, введите корректный URL",
date: "Пожалуйста, введите корректную дату",
dateISO: "Пожалуйста, введите корректную дату в формате ISO",
number: "Пожалуйста, введите число",
digits: "Пожалуйста, вводите только цифры",
creditcard: "Пожалуйста, введите правильный номер кредитной карты",
equalTo: "Пожалуйста, введите такое же значение ещё раз",
accept: "Пожалуйста, выберите файл с правильным расширением",
maxlength: jQuery.validator.format("Пожалуйста, введите не больше {0} символов"),
minlength: jQuery.validator.format("Пожалуйста, введите не меньше {0} символов"),
rangelength: jQuery.validator.format("Пожалуйста, введите значение длиной от {0} до {1} символов"),
range: jQuery.validator.format("Пожалуйста, введите число от {0} до {1}"),
max: jQuery.validator.format("Пожалуйста, введите число, меньшее или равное {0}"),
min: jQuery.validator.format("Пожалуйста, введите число, большее или равное {0}")
});
/*
playback timings (ms):
LoadShardBlock: 85.189 (3)
esindex: 0.006
captures_list: 102.614
CDXLines.iter: 14.059 (3)
PetaboxLoader3.datanode: 75.397 (4)
exclusion.robots: 0.243
exclusion.robots.policy: 0.231
RedisCDXSource: 0.516
PetaboxLoader3.resolve: 639.702
load_resource: 683.943
*/