var timeout = null;
$(document).ready(function() {
	$('.scroller-wrapper').height($(document).height() - $('.wrapper .header').height());
	$(window).resize(function() {
		$('.scroller-wrapper').height($(document).height() - $('.wrapper .header').height());
	});
	$('ul.navigation li ul').css({opacity: 0.9});
	$("ul.navigation li").hover(
		function() {
			if ($(this).parent().hasClass('navigation')) {
				$(this).find("ul:eq(0)").slideDown('fast').show();
			} else {
				$(this).find("ul:eq(0)").show('slide', {direction: 'right'}, 1000);
			}
			
			$(this).hover(
				function() {
				},
				function(){
					var _this = this;
					$(_this).parent().find("ul").slideUp('slow');
					// if (timeout) { clearTimeout(timeout); }
					// timeout = setTimeout(function(){ $(_this).parent().find("ul").slideUp('slow'); }, 400);
				}
			);
		},
		function(){
			
		}
	);
	cBoxConfig.initialWidth = 150;
	cBoxConfig.initialHeight = 150;
	cBoxConfig.maxWidth = 850;
	if ($('.preview').length) {
		$('.preview a.item').colorbox(cBoxConfig);
	} else if ($('a[rel=prev]').length){
		$('a[rel=prev]').colorbox(cBoxConfig);
	}
	$('img[rel]').tipTip();
});
