/**************************************************/
$(document).ready(function(){

	$(".h-menu li:first-child").addClass("li-first");
	$(".h-menu li:last-child").addClass("li-last");
	$(".f-menu li:last-child").addClass("li-last");
	$(".done-table tbody tr:odd").addClass("tr-odd");
	$(".done-table-order tr:last-child").addClass("tr-last");
	$(".price-table .pt-item:odd").addClass("pt-odd");
	$(".price-table .pt-item:first").addClass("pt-first");
	$(".price-table .pt-item:last").addClass("pt-last");

	$(".price-table-1 .pt-item:first").addClass("pt-first");
	$(".price-table-1 .pt-item:last").addClass("pt-last");
	$(".price-table-2 .pt-item:first").addClass("pt-first");
	$(".price-table-2 .pt-item:last").addClass("pt-last");

	$(".service .service-price").each( function(){
		$(this).find(".sp-item:odd").addClass("sp-odd");
		$(this).find(".sp-item:first").addClass("sp-first");
		$(this).find(".sp-item:last").addClass("sp-last");
	});

});

/**************************************************/

$(document).ready(function() {
    $('.photoshow').before('<div id="nav" class="nav">').cycle({
        fx:     'fade',
        autostop: '1',
		speed:  2000,
        pager:  '#nav',
        before: function() { if (window.console) console.log(this.src); }
    });
    $('#pshow-slide-m').cycle({
        fx:     'fade',
		    timeout: 999000,
				prev:    '#pshow-prev',
        next:    '#pshow-next',
		    manualTrump: false
    });
    $('#pshow-slide').cycle({
        fx:     'fade',
		    timeout: 8000,
				pauseOnPagerHover: true,
				pause:true,
				prev:    '#pshow-prev',
        next:    '#pshow-next',
		    manualTrump: false
    });
    $('.akcii').before('<div id="akciinav" class="akciinav">').cycle({
	    timeout: 0,
		random: '0',
        pager:  '#akciinav',
        before: function() { if (window.console) console.log(this.src); }
    });
});

/**************************************************/

$(document).ready(function(){
	$('select.dropdown').sSelect();
});

/**************************************************/

// add z-index
$(document).ready(function(){
	var counter = 200;
	$('.online-order .rel').each(function(i) {
		$(this).attr('style', 'z-index: ' + counter);
		counter -= 1;
    });
	$('.forma-date').each(function(i) {
		$(this).attr('style', 'z-index: ' + counter);
		counter -= 1;
    });
});

/**************************************************/

$(document).ready(function(){
	$(".mains-item").hover(
	  function () {
		$(this).addClass("mains-item-act");
	  },
	  function () {
		$(this).removeClass("mains-item-act");
	  }
	);
});

/**************************************************/

$(document).ready(function(){
  $("a[rel^='prettyPhoto']").prettyPhoto({showTitle:false});
});

/**************************************************/

$(document).ready(function(){
	$(".make-items .mi-in").hide();
    $(".make-items h6 a").click(function (e) {
      e.preventDefault();
      if ($(this).parent().hasClass('mi-opened')) {
		$(this).parent().removeClass('mi-opened');
		$(this).parent().next(".mi-in").slideUp();
      }
      else {
		$(this).parent().addClass('mi-opened');
		$(this).parent().next(".mi-in").slideDown();
      }
    });
});

/**************************************************/

$(document).ready(function(){
    $(".service-close .service-in").hide();
    $(".service-open .service-in").slideDown();
    $(".service-open h3").addClass('sp-opened');

    $(".service h3 a").click(function (e) {
      e.preventDefault();
      if ($(this).parent().hasClass('sp-opened')) {
		$(this).parent().removeClass('sp-opened');
		$(this).parent().next(".service-in").slideUp();
      }
      else {
		$(this).parent().addClass('sp-opened');
		$(this).parent().next(".service-in").slideDown();
      }
    });
});

/**************************************************/

$(document).ready(function(){
	$('.forma form').validate({
		ignore: ":hidden",
		highlight: function(element, errorClass){
			$(element).addClass(errorClass);
			$(element.form).find("label[for=" + element.id + "]").addClass('error-lb');
		},
		unhighlight: function(element, errorClass){
			$(element).removeClass(errorClass);
			$(element.form).find("label[for=" + element.id + "]").removeClass('error-lb');
		},
		errorContainer: '.err-cont',
		submitHandler: function(form){

			form.submit();
			return;
			$.post('modal/question_success.html', $(form).serialize(), function(data){
				$('.css-style').html(data);
			});
		}
	});
});

$(document).ready(capcha);
function capcha() { 
	/*
	$("#sncapcha-image").click( function(){
		$(this).attr("src","http://www.dip.ru/wp-content/themes/diplomers/secpic/secpic.php?" + Math.random());
	});
	*/
	//$('#capcha-code').focus();
}

