var maxHeight = 400;



$(function(){



    $(".dropdown > li").hover(function() {

    

         var $container = $(this),

             $list = $container.find("ul"),

             $anchor = $container.find("a"),

             height = $list.height() * 1.1,       // make sure there is enough room at the bottom

             multiplier = height / maxHeight;     // needs to move faster if list is taller

        

        // need to save height here so it can revert on mouseout            

        $container.data("origHeight", $container.height());

        

        // so it can retain it's rollover color all the while the dropdown is open

        $anchor.addClass("hover");

        

        // make sure dropdown appears directly below parent list item    

        $list

            .show()

            .css({

                paddingTop: $container.data("origHeight")

            });

        

        // don't do any animation if list shorter than max

        if (multiplier > 1) {

            $container

                .css({

                    height: maxHeight,

                    overflow: "hidden"

                })

                .mousemove(function(e) {

                    var offset = $container.offset();

                    var relativeY = ((e.pageY - offset.top) * multiplier) - ($container.data("origHeight") * multiplier);

                    if (relativeY > $container.data("origHeight")) {

                        $list.css("top", -relativeY + $container.data("origHeight"));

                    };

                });

        }

        

    }, function() {

    

        var $el = $(this);

        

        // put things back to normal

        $el

            .height($(this).data("origHeight"))

            .find("ul")

            .css({ top: 0 })

            .hide()

            .end()

            .find("a")

            .removeClass("hover");

    

    });

    

    // Add down arrow only to menu items with submenus

	/*

    $(".dropdown > li:has('ul')").each(function() {

        $(this).find("a:first").append("<img src='img/down-arrow.png' />");

    });

    */

    

});





















////////////////////////////////////////////////////////////////////////////////////////////////



function randomXToY(minVal,maxVal,floatVal) {

  var randVal = minVal+(Math.random()*(maxVal-minVal));

  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);

}





function _chgIMG(_nm_,_path_) {

	document.images[_nm_].src=_path_;

}



var dom = (document.getElementById)? true : false;

var n=false;





function getelem(id){

 var elem=(dom)?document.getElementById(id):document.all[id]

 return elem

}



function hsh(id){

 var celm=getelem(id);

 celm.style.display=(celm.style.display=="none")?"block":"none";

 return true;

} 







function menuHover(ElementId) {

	el=document.getElementsById(ElementId);

	//el.style.

}





	hs.graphicsDir = 'http://www.nazaimke.ru/sources/template/js/krdn/graphics/';

		hs.align = 'center';

		hs.transitions = ['expand', 'crossfade'];

		hs.outlineType = 'rounded-white';

		hs.fadeInOut = true;

		//hs.dimmingOpacity = 0.75;

	

		// Add the controlbar

		hs.addSlideshow({

			//slideshowGroup: 'group1',

			interval: 5000,

			repeat: false,

			useControls: true,

			fixedControls: 'fit',

			overlayOptions: {

				opacity: .75,

				position: 'bottom center',

				hideOnMouseOut: true

			}

		});

	 
