﻿$(document).ready(
  function ()
  {

  	//search-box
  	$("#q").focus(function ()
  	{
  		if (($(this).val() == 'Поиск') || ($(this).val().length == 0)) $(this).removeClass("empty").val('')
  	})
  	$("#q").blur(function ()
  	{
  		if (($(this).val() == 'Поиск') || ($(this).val().length == 0)) $(this).addClass("empty").val("Поиск")
  	})

  	//regions
  	$(".current-region a").click(
      function ()
      {
      	$("#shadow").fadeIn("fast")
      	$("#regions").fadeIn("fast")
      	return false;
      }
    )
  	$("#shadow").click(
      function ()
      {
      	closeRegions()
      }
    )
  	$("#regions .closer").click(
      function ()
      {
      	closeRegions()
      }
    )
  	$("#landing .popup").click(
      function ()
      {
      	$("#shadow").fadeIn("fast")
      	$("#regions").fadeIn("fast")
      	return false;
      }
    )


  	//slider
  	$(".slider h3").click(
      function ()
      {
      	var x = $(this).parent()
      	if (x.hasClass('opened'))
      	{
      		x.find(".holder").hide()
      		x.removeClass("opened")
      	}
      	else
      	{
      		x.find(".holder").show()
      		x.addClass("opened")
      	}
      	return false
      }
    )

	//dlists
	$('.dlist dt').click(
		function() {
			var dt = $(this)
			var dd = dt.next('dd')
			if (dd.is(":visible"))
			{
				dt.removeClass("opened")
				dd.fadeOut('fast')
			}
			else
			{
				dt.addClass("opened")
				dd.fadeIn('fast')
			}
			return false
		}
	) 

  	//forms

  	/*$("form").not(".search-box form, .connect form").jqTransform({imgPath:"/f/i/forms/"});

  	*/

  	$(".binfo").click(function ()
  	{
  		$(".mcol .mopen").removeClass("mopen");
  		$(this).parents(".mcol li").toggleClass("mopen");
  	})
  	$(".map-buble .close").click(function ()
  	{
  		$(this).parents(".mcol .mopen").removeClass("mopen");
  	})

  	$(".mb-link").click(function ()
  	{
  		$(".mb-serv .mopen").removeClass("mopen");
  		$(this).parents(".mb-serv li").toggleClass("mopen");
  		return false;
  	})
  	$(".map-buble .close").click(function ()
  	{
  		$(this).parents(".mb-serv .mopen").removeClass("mopen");
  		return false;
  	})

  	$(".mm-kol").click(function ()
  	{
  		$(".map-marker-open").removeClass("map-marker-open");
  		$(".map-wrap3").addClass("mw-index");
  		$(this).parents(".map-marker").addClass("map-marker-open");
  		return false;
  	})
  	$(".map-wrap3").click(function ()
  	{
  		$(".mw-index").removeClass("mw-index");
  		$(".map-marker-open").removeClass("map-marker-open");
  	})
  	$(".map-buble-close").click(function ()
  	{
  		$(".mw-index").removeClass("mw-index");
  		$(this).parents(".map-marker-open").removeClass("map-marker-open");
  	})

  	$(".serv-h6 a").click(function ()
  	{
//  		$(this).parents(".services").toggleClass("serv-open");
  		return false;
  	})

  }
)

function closeRegions()
{
  $("#regions").fadeOut("fast")
  $("#shadow").fadeOut("fast")
}

