﻿$(document).ready(function(){
  $('a.catalog').click(function(){
    $('.layer, .order_catalog').show();
    return false
  })
  $('a.car').click(function(){
    $('.layer, .order_car').show();
    return false
  })
  $('a.callback').click(function(){
    $('.layer, .order_call').show();
	$("select[name='system_email_to'] option:last").html('Бронирование автомобилей<br/> и обслуживание'); 
    return false
	
  })
  
    $('a.callback2').click(function(){
    $('.layer, .order_call').show();
	$("select[name='system_email_to'] option:last").html('Бронирование автомобилей<br/> и обслуживание'); 
    return false
  })
 
 

  
  
  
  $('a.exit').click(function(){
    $('.layer, .order_catalog, .order_car, .order_call').hide();
    return false
  })
  $('#menu li.slide').hover(function(){
    $('.flow_menu').show();
    $(this).find('a').addClass('hover');
  }, function(){
    $('#menu li, #header').not('.slide').hover(function(){
      $('.flow_menu').hide();
      $('#menu li.slide a').removeClass('hover');
    }, function(){

    })
    $('.flow_menu').hover(function(){
      $(this).show();
    }, function(){
      $('.flow_menu').hide();
      $('#menu li.slide a').removeClass('hover');
    })
  })

  var quotes = $('.quote').length;
  var number = Math.round(Math.random() * quotes);
  $('.quote:not(:eq('+number+'))').hide();
  $('.quote:eq('+number+')').show();
  var i = number + 1;
  if (i == quotes + 1)
  {
    i = 1;
  }
  setInterval(function(){
    if (i == 1)
    {
      $('.quote:eq('+(quotes-1)+')').fadeOut(1000, function(){
        $('.quote:eq(0)').fadeIn(1000);
      });
    }
    else
    {
      var k_prev = i-2;
      var k = i-1
      $('.quote:eq('+k_prev+')').fadeOut(1000, function(){
        $('.quote:eq('+k+')').fadeIn(1000);
      });
    }
    i = i + 1;
    if (i == quotes + 1)
    {
      i = 1;
    }
  }, 10000);

})

function valuetema(email)
{ 
if (email=='292')
{ document.getElementById('titl').value='Бронирование автомобилей и обслуживание'}
if (email=='363')
{ document.getElementById('titl').value='Бронеокна'} 
}
