function smjs1(obj){if(obj.value=='Поиск по сайту')obj.value=''}
function smjs2(obj){if(obj.value=='')obj.value='Поиск по сайту'}

pic01=new Image();pic01.src="/main/images/vp02.png";
pic02=new Image();pic02.src="/main/images/vp03.png";
pic03=new Image();pic03.src="/main/images/vp04.png";
pic04=new Image();pic04.src="/main/images/vp11.png";
pic05=new Image();pic05.src="/main/images/vp12.png";
pic06=new Image();pic06.src="/main/images/vp13.png";
pic07=new Image();pic07.src="/main/images/vp21.png";
pic08=new Image();pic08.src="/main/images/vp22.png";
pic09=new Image();pic09.src="/main/images/vp23.png";
pic10=new Image();pic10.src="/main/images/vp31.png";
pic11=new Image();pic11.src="/main/images/vp32.png";
pic12=new Image();pic12.src="/main/images/vp33.png";

var keys = new Array(8,78,148,183,323,393,498,533,638,673);

$(document).ready(function() {
	
var cf=1;

$('#qsf').bind('focus', function(){smjs1(this)});
$('#qsf').bind('blur', function(){smjs2(this)}); 

$('tbody tr:odd').addClass('odd');
$('tbody tr:even').addClass('even');

$('table tr td:not(:last-child)').addClass('tablr');

$('#tisers').coinslider({ width: 727, height: 340, spw: 1, sph: 1, sDelay: 0, navigation: true, delay: 3000, effect: 'random', hoverPause: true });

$('#mm1').click(function(event){
	event.preventDefault();
	$.cookie('mm','1', { path: '/' });
	
		$('#tm11').delay(200).fadeIn(200);
		$('#tm12').fadeOut(200);
		$('#tm13').fadeOut(200);
		$('#tm14').fadeOut(200);
		$("#mm1,#mm2,#mm3,#mm4").removeClass('tmact');
		$(this).addClass('tmact');
	})

$('#mm2').click(function(event){
	event.preventDefault();
	$.cookie('mm','2', { path: '/' });
		$('#tm12').delay(200).fadeIn(200);
		$('#tm11').fadeOut(200);
		$('#tm13').fadeOut(200);
		$('#tm14').fadeOut(200);
		$("#mm1,#mm2,#mm3,#mm4").removeClass('tmact');
		$(this).addClass('tmact');	
	})

$('#mm3').click(function(event){
	event.preventDefault();
	$.cookie('mm','3', { path: '/' });
		$('#tm13').delay(200).fadeIn(200);
		$('#tm11').fadeOut(200);
		$('#tm12').fadeOut(200);
		$('#tm14').fadeOut(200);
		$("#mm1,#mm2,#mm3,#mm4").removeClass('tmact');
		$(this).addClass('tmact');	
	})

$('#mm4').click(function(event){
	event.preventDefault();
	$.cookie('mm','4', { path: '/' });
		$('#tm14').delay(200).fadeIn(200);
		$('#tm11').fadeOut(200);
		$('#tm12').fadeOut(200);
		$('#tm13').fadeOut(200);
		$("#mm1,#mm2,#mm3,#mm4").removeClass('tmact');
		$(this).addClass('tmact');	
	})

cokt=1;
if($.cookie('mm')){cokt=$.cookie('mm')}

$("#mm1,#mm2,#mm3,#mm4").removeClass('tmact');
$('#mm'+cokt).addClass('tmact');
	$('#tm11').hide();
	$('#tm12').hide();
	$('#tm13').hide();
	$('#tm14').hide();
	$('#tm1'+cokt).show();



$('.do').mouseenter(function(){
	
	$(this).find('.om').delay(100).slideDown(500,'easeOutExpo');
$(this).find('.log').css('z-index',100);

	})

$('.do').mouseleave(function(){

	$(this).find('.om').stop(true,true).slideUp(200);

	})

$('.lroot').mouseenter(function(){
	$(this).addClass('lroot2');
	$(this).parent().find('.lbi').css('display','block');
	$(this).parent().find('.lb2').delay(100).slideDown(500,'easeOutExpo');
	})

$('.lroot').parent().mouseleave(function(){
	$('.lroot').removeClass('lroot2');
	$(this).parent().find('.lbi').css('display','none');
	$(this).parent().find('.lb2').stop(true,true).slideUp(200);
	})

$('#history').mouseup(function(e){
	for(i=0;i<=(keys.length-1); i++){
		pcl=e.pageX - this.offsetLeft;
		if((pcl>(keys[i]-15))&&(pcl<(keys[i]+15))){
			$('#progress').stop(true,true).animate({
				width: keys[i]+"px"
				}, 500, 'easeOutExpo');
			$('#hspipka').stop(true,true).animate({
				left: (keys[i]-10)+"px"
				},500, 'easeOutExpo');
			$('#historyarr').css('background-position',(keys[i]-10)+"px 0");
			$('#historyarr').fadeOut(0, function(){
				$('#historyarr').stop(true,true).fadeIn(500);
				});
			$('.hisma').stop(true,true).fadeOut(250);
			$('#hism'+i).delay(250).fadeIn(250);

			}}
	})

$('.v_el').mouseenter(function(e){
	$(this).css('background','#f6f6f6');
	$(this).find('.v_name').css('text-decoration','none');
	$(this).find('input').toggleClass('recall1');
	})

$('.v_el').mouseleave(function(e){
	$(this).css('background','#ffffff');
	$(this).find('.v_name').css('text-decoration','underline');
	$(this).find('input').toggleClass('recall1');
	})

$('.v_el').click(function(){
	if(cf){$(this).find('.v_el2').stop(true,true).slideToggle(500,'easeOutExpo');
	$(this).find('.v_but').stop(true,true).fadeToggle(500,'easeOutExpo');

$(this).find('.v_but').click(function(ev){
		cf=0;
		$('#dialog').jqm({ajax:'form.php'})
		$('#dialog').jqmShow();		
		})
		
	}else{
	
$(this).find('.v_but').unbind('click');


	cf=1;
	}
	})

$('.jqmClose').click(function(){
	cf=1;
	})


var params = {
		changedEl: "#section",
		visRows: 5,
		scrollArrows: false
	}
	cuSel(params);

var params = {
		changedEl: "#section2",
		visRows: 6,
		scrollArrows: false
	}
	cuSel(params);

var params = {
		changedEl: "#section3",
		visRows: 17,
		scrollArrows: false
	}
	cuSel(params);

$('.gbov').mouseenter(function(e){
	$(this).css('background','#f6f6f6');
	})

$('.gbov').mouseleave(function(e){
	$(this).css('background','#ffffff');
	})

$('.gbov').click(function(){
	$(this).find('.gbov2').stop(true,true).slideToggle(500,'easeOutExpo');
	})

$('#contol li').click(function(){
	
	$('#contacts1ov').fadeOut(200);
	$('#contacts2ov').fadeOut(200);
	$('#contacts3ov').fadeOut(200);
	$('#contacts4ov').fadeOut(200);
	$('#contacts5ov').fadeOut(200);
	$('#contacts6ov').fadeOut(200);
	$('#contacts7ov').fadeOut(200);
	$('#contacts8ov').fadeOut(200);
//	$('#contacts9ov').fadeOut(200);
	
	$('#contacts'+this.value+'ov').delay(200).fadeIn(500);
	
	if(this.value==2||this.value==8){$('#contacts2bg').delay(200).fadeIn(500);}else{$('#contacts2bg').delay(200).fadeOut(500);}

	if($(this).find('.ctpmore').css('display')=='none'){
	$('#contol .ctpmore').stop(true,true).slideUp(200,'easeOutExpo');
	$('#contol').find('span').removeClass('openol');
	$(this).find('.ctpmore').delay(200).stop(true,true).slideToggle(500,'easeOutExpo');
	$(this).find('span').toggleClass('openol');}
	})

$('.alog a').click(function(e){
	e.preventDefault();
	$('#autos').css('background','none');
	$('#pipkoline').css('display','block');
	$('.alog a').css('background-position','top');
	$(this).css('background-position','bottom');
		$('#pipkoline').stop(true,true).animate({
		left: (15+(116*$(this).attr('accesskey')))+"px"
		},500, 'easeOutExpo');
	$('.ablock').fadeOut(100,'easeOutExpo');
	$('#ablock'+(parseInt($(this).attr('accesskey'))+1)).stop(true,true).delay(100).fadeIn(400,'easeOutExpo');
	$('.amenz').slideUp(250,'easeOutExpo');
	$('#amenu'+$(this).attr('accesskey')).stop(true,true).delay(250).slideDown(250,'easeOutExpo');
	});

$('#we a').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0});

$('#we #we1').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Гойхман Владимир<br/>Директор по координации и развитию'});
$('#we #we2').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Разин Евгений Валентинович<br/>Директор по послепродажному обслуживанию'});
$('#we #we3').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Зайцев Юрий Леонидович<br/>Директор по экономической безопасности'});
$('#we #we4').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Пронина Наталья<br/>Директор по правовым вопросам'});
$('#we #we5').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Борисова Татьяна<br/>Директор по информационным технологиям'});
$('#we #we6').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Зарецкая Людмила Валентиновна<br/>Руководитель службы по работе с клиентами'});
$('#we #we7').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Смирнов Вадим Владимирович<br />Генеральный директор ТП «Нижегородец»'});

$('#we #we8').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Куприянова Альбина Валентиновна<br/>Главный бухгалтер'});
$('#we #we9').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Крайнов Сергей Васильевич<br/>Директор службы пассажирских перевозок'});
$('#we #we10').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Норкин Евгений<br/>Директор по маркетингу и продажам'});
$('#we #we11').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Свительский Сергей Алексеевич<br/>Директор по административно-хозяйственным вопросам'});
$('#we #we12').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Зыкова Елена<br/>Руководитель отдела рекламы'});
$('#we #we13').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Труфина Ольга<br/>Руководитель отдела учета и контроля'});
$('#we #we14').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Фейзрахманов Рустам<br/>Руководитель отдела тюнинга'});
$('#we #we16').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Панягина Наталья<br/>Директор по экономическим вопросам'});
$('#we #we17').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Бибишкин Дмитрий<br/>Директор направления «Запасные части»'});

$('#we #we29').fancybox({'hideOnContentClick':true,'showCloseButton':false,'transitionIn':'fade','transitionOut':'fade','overlayOpacity':0.2,'speedIn':400,'speedOut':200,'titlePosition':'over','padding':0,'title':'Фахуртдинов Руслан<br/>Руководитель отдела государственной регистрации автомобилей'});


$('.galler').jqGalViewII();

$('#bosses area').click(function(e){e.preventDefault();});

});



$(window).load(function() {
$("#makeMeScrollable").smoothDivScroll({ 
			autoScroll: "onstart" , 
			autoScrollDirection: "backandforth", 
			autoScrollStep: 1, 
			autoScrollInterval: 20,	
			startAtElementId: "startAtMe", 
			visibleHotSpots: "always"
		});
});
