var vin_ok = false;
// Предупреждение для старых браузеров
var $buoop = {
vs: {i:6.5,f:3,o:9.4,s:3,n:9},
l: "ru"
//text: ""
//test: false
}
$buoop.ol = window.onload;
window.onload=function(){
if ($buoop.ol) $buoop.ol();
var e = document.createElement("script");
e.setAttribute("type", "text/javascript");
e.setAttribute("src", "http://browser-update.org/update.js");
document.body.appendChild(e);
}
function heights() {
var sheight = $(".sidebar").outerHeight();
var pheight = $(".page").outerHeight();
var wheight = $(window).height();
var hheight = $(".header").outerHeight() + $(".nav").outerHeight() + $(".footer").outerHeight() + 12;
var cheight = wheight - hheight;
$(".content").css('min-height',cheight);
if (sheight > pheight) {
$(".page").css('min-height',sheight)
};
};
function smartColumns() {
var colWrap = $(".dlist").outerWidth() - 26;
var colNum = Math.floor(colWrap / 226);
var colFixed = Math.floor(colWrap / colNum) - 20;
$(".dlist .item").css('width',colFixed);
}
function smartGalleries() {
$(".gallery .items").each(function() {
var colWrap = $(this).width() - 66;
var colWidth = $(this).find(".item").outerWidth();
var colNum = Math.floor(colWrap/colWidth);
var colAmount = colNum - 1;
var colX = Math.floor( (colWrap-(colNum*colWidth)) / colAmount );
$(this).find(".item").css('margin-right',colX);
if($(".best").length) {
$(this).find(".item:lt(" + (colNum) + ")").show();
$(this).find(".item:gt(" + (colAmount) + ")").hide();
};
if($("div.all").length) {
$(this).find(".item").css('margin-bottom',colX*0.7);
$(".all").css('margin-bottom',-((colX*0.7)+14));
};
});
}
$(window).load(function() {
try {
$(".nav ul li:first-child span").css('border-left','0').css('padding-left','10px');
$(".nav ul li:last-child span").css('border-right','0').css('padding-right','10px');
$("ul.files li ul li:last-child").css('background-image','url(/images/embed/files-tree-last.gif)');
$(".faq .item:last-child").css('border','0');
}catch(e){};
});
$(document).ready(function() {
setTimeout( function() {
heights();
}, 10);
$(window).bind("resize", resizeWindow);
function resizeWindow( e ) {
heights();
};
// Очистка инпутов формы авторизации
$(".search input[type='text'], .subscribe input, .aside input").each(function() {
var defaultValue = this.value;
$(this).focus(function() {
if(this.value == defaultValue) {
this.value = '';
}
});
$(this).blur(function() {
if(this.value == '') {
this.value = defaultValue;
}
});
});
$(".sp .switch").click(function() {
$(".txt").toggle();
return false;
});
$(".text p img").each(function() {
var idesc = $(this).attr('alt');
var iwidth = $(this).width();
var ifloat = $(this).css('float');
if (idesc != '') {
$(this).after('' + idesc + '');
$(this).next("span.description").css('width',iwidth);
if (ifloat == 'left') {
$(this).next("span.description").css('float','left').css('clear','left').css('margin-right','1.75em');
} else if (ifloat == 'right') {
$(this).next("span.description").css('float','right').css('clear','right').css('margin-left','1.75em');
} else {
};
};
});
$(".text table tbody tr:nth-child(even)").addClass("even");
$(".text table tbody tr:nth-child(odd)").addClass("odd");
$(".colors a").click(function() {
var image = $(this).attr('href');
$(".colors a").removeClass('active');
$(this).addClass('active');
$(".image img").attr('src',image);
return false;
});
if($(".dlist").length) {
smartColumns();
$(window).resize(function () {
smartColumns();
});
};
$(".pagination .disabled").click(function() {
return false;
});
if($(".gallery").length) {
smartGalleries();
$(window).resize(function () {
smartGalleries();
});
};
if($(".photos .scrollable").length) {
$(".photos .scrollable").scrollable({prev: ".photos .navigator .prev", next: ".photos .navigator .next"});
var active = $(".photos .items .active");
var position = $(".photos .items div").index(active);
var api = $(".photos .scrollable").data("scrollable");
api.seekTo(position - 3, 0);
};
if($(".videos .scrollable").length) {
$(".videos .scrollable").scrollable({prev: ".videos .navigator .prev", next: ".videos .navigator .next", vertical: true});
var vactive = $(".videos .items .active");
var vposition = $(".videos .items div").index(vactive);
var vapi = $(".videos .scrollable").data("scrollable");
vapi.seekTo(vposition);
};
$("ul.dd .multiple .scrollable").each(function() {
var prv = $(this).parent().find('.controls .prev');
var nxt = $(this).parent().find('.controls .next');
$(this).scrollable({prev: prv, next: nxt});
});
if($(".txt .type").length) {
var userAgent = navigator.userAgent.toLowerCase();
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
if($.browser.chrome) {
$(".type").css('background-position','-72px -40px');
} else if ($.browser.safari) {
$(".type").css('background-position','-36px -76px');
} else if ($.browser.opera) {
$(".type").css('background-position','-90px -22px');
} else if ($.browser.msie) {
$(".type").css('background-position','-18px -94px');
} else if ($.browser.mozilla) {
$(".type").css('background-position','-54px -58px');
} else {
$(".type").css('background-position','0 0');
};
};
if($("ul.files").length) {
$("ul.files li.folder a.opener").click(function() {
$(this).next('ul').toggle();
$(this).parent().toggleClass('opened');
return false;
});
};
$(".nav a.dealer").click(function() {
var navPosition = Math.round($(".nav").offset().top);
var navHeight = Math.round($(".nav").height());
var positionTop = navPosition + navHeight + 6;
var margin = $(".header").width() / 2;
$(".login").css('top',positionTop).css('margin-right',-margin);
$(".login").toggle();
return false;
});
$(".parts table .name a").hover(function() {
var previewHeight = $(this).next('span').outerHeight() / 2;
$(this).next('span').css('top','50%').css('margin-top',-previewHeight);
$(this).next('span').show();
}, function() {
$(this).next('span').hide();
});
$(".parts table .name a").click(function() {
$(this).next('span').toggle();
return false;
});
$("ul.dd li h2 a").click(function() {
$(this).toggleClass('opened');
$(this).parent().next('.dd-item').toggle();
return false;
});
$('.equipment .thumbs a').live('hover click', function(e) {
e.preventDefault();
$(this).parent().find('a').removeClass('active');
var l = $(this).attr('href');
var xl = $(this).attr('rel');
$(this).closest('.item').find('.viewer > a > img').attr('src',l);
$(this).closest('.item').find('.viewer > a').attr('href',xl);
$(this).addClass('active');
});
$('form.ds input[type=text]').live('keyup', function() {
var form = $(this).parents('form');
if (window.currentSearchTimeoutId != undefined) {
clearTimeout(window.currentSearchTimeoutId);
};
window.currentSearchTimeoutId = setTimeout(function() {
$('#parts').css('opacity', '0.5');
var data1 = $(form).serialize();
$.ajax({
type: "POST",
url: "/ajax/goods.php",
data: data1,
success: function(msg){
$('#parts').css('opacity', '1');
$("#parts").html(msg);
}
});
}, 800);
});
/* $('#parts td.add input').live('click', function(e) {
$('#parts').css('opacity', '0.5');
$('#part_submit_container').remove();
$('.parts').append('');
});*/
/*$('#cart td.number input').live('keyup', function() {
var form = $(this).parents('form');
if (window.currentCartTimeoutId != undefined) {
clearTimeout(window.currentCartTimeoutId);
};
window.currentCartTimeoutId = setTimeout(function() {
$('#parts').css('opacity', '0.5');
$(form).submit();
}, 800);
});*/
$('#cart .remove').live('click', function() {
$('#parts').css('opacity', '0.5');
});
$('#order').live('click', function() {
$('#parts').css('opacity', '0.5');
$(this).parents('form').append('');
});
$('#own1, #own2').click(function() {
$('.private, .public').hide();
var rel = $(this).attr('rel');
$('.'+rel).show();
});
$('.-instructions').change(function() {
var allChecked = false;
// alert(vin_ok);
/*if (vin_ok==false){
$("#send").attr("disabled", "disabled");
return true;
}else{
$("#send").attr("disabled", false);
}*/
$('.-instructions').each(function(i, o) { allChecked = allChecked || !$(o).attr('checked'); });
allChecked = !allChecked;
if (allChecked) {
$('#send').removeClass('disabled').removeAttr('disabled');
$('#send').parent().removeClass('disabled');
} else {
$('#send').addClass('disabled').attr('disabled', 'disabled');
$('#send').parent().addClass('disabled');
}
});
if($('#registration_sale_date').length) $('#registration_sale_date').mask("~.99.9999");
if($('.dealFrm #start').length) $('.dealFrm #start').mask("99.99.9999");
if($('.dealFrm #sale').length) $('.dealFrm #sale').mask("99.99.9999");
if($('#new_registration #registration_bd').length) $('#new_registration #registration_bd').mask("99.99.9999");
$('.nav .wrappLMenu').hover(function(){
$(this).prev().addClass('hover');
},function(){
$(this).prev().removeClass('hover');
});
$('.dilList a').click(function(){
linkClass = $(this).attr('class')
$('.dillers').hide();
$('#'+linkClass).show();
return false;
});
$(".gall").fancybox({
'titlePosition' : 'inside'
});
$('#byImgGall a').click(function(){
var rel = $(this).attr('rel'),
link = $(this).attr('href');
$('#byImgGall a').removeClass('active');
$(this).addClass('active');
$('#byBigImg a').attr('href', rel);
$('#byBigImg img').attr('src', link);
return false;
});
/*$('.dealFrm .addFrm a').click(function(){
var txt = $(this).parent().prev().html();
$(this).parent().prev().append('