function rand(minVal,maxVal,float)
{
  var randVal = minVal+(Math.random()*(maxVal-minVal));
  return float===true ? randVal : Math.round(randVal);
}


jQuery().ready(function() {
    $("a[rel=fancy], a[class*=iframe]").fancybox({ 
        'padding': 0, 
        'overlayOpacity': 0.65,
        'overlayColor': '#222',
        'width': 400,
        'height': 620
    });
    
    $("a[rel=external]").attr('target', '_blank');
    
    $('a[href*=#]').click(function() {
        var duration = 750;
        var easing = 'easeinout';

        var newHash = this.hash;
        if (newHash.length > 1) {
            var target = $(this.hash).offset().top;
            var oldLocation = window.location.href.replace(window.location.hash, '');
            var newLocation = this;

            if(oldLocation + newHash == newLocation)
            {
                $('html:not(:animated),body:not(:animated)').animate({ 
                    scrollTop: target 
                }, duration, easing, function() {
                    window.location.href=newLocation;
                });
                return false;
            }
        }
    });
    
    var distr = $('#vertrieb .links span:first').siblings('span').andSelf();
    $(distr).each(function() {
        $(this).find('span:first').css('display', 'block').hide();
        $(this).hover(
            function() {
                $(this).find('span:first').fadeIn(250);
            },
            function() {
                $(this).find('span:first').fadeOut(250);
            }
        );
    });
});
