function initDropFade(){
	var _lt8 = ((navigator.appName.indexOf('Microsoft Internet Explorer') != -1) && (parseInt(navigator.appVersion) < 7)) ? true : false;
	_nav = $('div.navbar');
	var _li = _nav.find('> ul > li:has("div.drop")');
	$('body').append('<div id="jquery-overlay"> </div>');
	var _fader = $('#jquery-overlay');
	_fader.css({
		'position':'absolute',
		'top':0,
		'left':0,
		'backgroundColor':'#000',
		'zIndex':'200',
		'opacity':'0'
	 });
	_li.mouseenter(function(){
		var _btn = $(this).children('div.drop');
		if(_btn.length !=0){
			 $(this).css({
				'zIndex':'1000'
			 });
			var _height = 0;
			var _width = 0;
			var _page = $('body > div:eq(0)');
			var _minWidth = _page.outerWidth();
			if (window.innerHeight) {
				_height = window.innerHeight;
				_width = window.innerWidth;
			}
			else {
				_height = document.documentElement.clientHeight;
				_width = document.documentElement.clientWidth;
			}
			if (_width < _minWidth) {_fader.css('width',_minWidth);} else {_fader.css('width','100%');}
			if (_height > _page.innerHeight()) _fader.css('height',_height); else _fader.css('height',_page.innerHeight());
			_fader.stop().animate({'opacity':'0.6'}, 300);
			_btn.show();
		}
		else{
			_fader.stop().animate({'opacity':'0'}, 150, function() { $(this).width(0) });
		}
	}).mouseleave(function(){
		var _btn = $(this).children('div.drop');
		_li.css({zIndex: 0});
		_fader.stop().animate({'opacity':'0'}, 150, function() { $(this).width(0) });
		_btn.hide();
		
	});
	if(jQuery.browser.msie && jQuery.browser.version < 7){
		$('div.navbar > ul > li').mouseenter(function(){
			$(this).addClass('hover');
		}).mouseleave(function(){
			$(this).removeClass('hover');
		});
	}
};

function prepareSlideSwitch(){
	$('.slideshow').hover(
        function(){
		    $(this).find('.description').show();
	    },
        function(){
		    $(this).find('.description').hide();
	    }
    );
}

function slideSwitch() {
	var $slideshow = $('.slideshow');
    var $active = $slideshow.find('img.active');

    if ( $active.length == 0 ) $active = $slideshow.find('img:last');

    var $next =  $active.next().length ? $active.next()
        : $slideshow.find('img:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2500, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function(){
	initDropFade();
});




