	$(document).ready(function(){



    $("#money-block a").hover(
      function () {
	var _item = $(this);
	var _id = _item.attr("id");
        $('#money-meter').addClass(_id);
	$('#tariff-arrow-'+_id).addClass("tariff-arrow-sel");
	return false;

      }, 
      function () {
	var _item = $(this);
	var _id = _item.attr("id");
        $('#money-meter').removeClass(_id);
	$('#tariff-arrow-'+_id).removeClass("tariff-arrow-sel");
	return false;
      }
    );
    
    $("#money-block a:not(.money-form-btn)").click(function () { 
	var _item = $(this);
	var _id = _item.attr("id");
        $('#'+_id+'-info').fadeIn("fast");
	return false;
    });
   
    $("a.money-x-btn").click(function () {
	var parentEl = $($(this).parents().get(1));
        parentEl.fadeOut("fast");
	return false;
    });
    
    function mytogle(_this){
      var _id = _this.attr("id");
      var _idE = _id.split("-");
      _id = '#'+_idE[2];
      
      if ($(_id).attr("class") ==  "hide"){
	  $('body').addClass("body-dgray-color");
	  $('.show').slideUp("slow",function () {$('.show').removeClass("show"); $('.top-alt-box').removeClass("top-alt-box-sel"); return false;});
	  $('.show').addClass("hide");
	  $('#top-menu a').fadeOut("fast");
	  $('#container').slideUp();
	  $(_id).slideDown("slow",function () {$(_id).removeClass("hide"); $(_id).addClass("show"); $(_this).addClass("top-alt-box-sel");  return false;});
      } else if ($(_id).attr("class") ==  "show"){
	  $('body').removeClass("body-dgray-color");
	  $('#top-menu a').fadeIn("fast");
	  $('#container').slideDown();
	  $(_id).slideUp("slow",function () {$(_id).removeClass("show"); $(_id).addClass("hide");$(_this).removeClass("top-alt-box-sel"); return false;});
      }
    }
    
    $("#alt-box-prosto-btn, #alt-box-garant-btn, #alt-box-form-btn").click(function () {
      mytogle($(this));
      return false;
    });

    if ( document.location.href.indexOf( "general/form" ) >= 0 ) {
      var x = document.location.search.match( /t=(\d)/ );
      var y;
      if( x && ( y = document.getElementById("sel-tarif") ) ) {
        y.options[ x[1] ].selected = true;
      }
    $(".money-form-btn").click(function () {
      var _this = $(this);
      var n = _this.attr("href").match(/\d$/)[0];
      document.getElementById("sel-tarif").options[n].selected = true;
      /*
      var _title = _this.attr("title");
      var _id = _this.attr("id");
      var _idE = _id.split("-");
      _selname = "#sel-tarif option:contains('"+_title+"')";
      $(_selname).attr({selected: "selected"});
      mytogle($("#alt-box-form-btn"));
      */
      return false;
    });
    }
    
    
});
	
	