$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */


    // крутилка
    $('#rotate-image').innerfade({
            animationtype: 'fade',
            speed: 750,
            timeout: 6000,
            type: 'sequence',
            containerheight: 'auto'
    });

    $('#toggler').dropDownBlock($('#drop-down-list'));


    // работа с меню
    /*$('.button').each(function(){

      if ($(this).parent().find('.dropdown').size()){

        $(this).click(function(){
          $('.dropdown').hide();
          $(this).parent().find('.dropdown').slideDown("slow");
          return false;
        });
      }
    }); */

    /* кастомизация поиска */
    $(".search-form select").selectBox();
	
});

// выпадающий список под ссылкой
(function($) {
	$.fn.dropDownBlock = function(block, options) {
		var defaults = { 
			speed: 'fast',
			top: $(this).height(),
			left: 0
		}, 
		opts 	= $.extend(defaults, options),
  		toggler = $(this),
  		block 	= $(block);
  		toggler.css({'outline': 'none'})
  		
  		toggler.click(function(e) {
  			e.preventDefault();
  			$(block).css({
        		'position' 	: 'absolute'
      		});
      		if($(block).is(':visible')) $(block).fadeOut(opts['speed']);
      		else $(block).fadeIn(opts['speed']);      		
      		this.focus();
  		});
  		toggler.blur(function() {
  			//$(block).fadeOut(opts['speed']);
  		});
	};
})(jQuery);


