function setActive(node) {
	$(node).addClass('active');
}

function setInactive(node) {
	$(node).removeClass('active');
}

function hideSubs() {
	$('.sub_wrapper').each(function() {
		$(this).addClass('hidden');
	});
}

$(document).ready(function() {
		$('#main_nav li.top, .sub_menu li.top').each( function() {
				$(this).hover(function() {
						hideSubs();
						$(this).find('.sub_wrapper').each(function() {
								$(this).removeClass('hidden');
						});
						drawSideShadows(this);
				}, function() {
					hideSubs();
				});
		});
		$('#main_nav li, .sub_menu li').each ( function() {
				$(this).hover( 
					function() {
						$(this).addClass('hvr');
					}, function () {
						$(this).removeClass('hvr');
					}
				);
		});
});

function drawSideShadows(node) {
	if (!node || node.shadows_done) {
		return;
	}
	$(node).find('.rc_shadow .ls img, .rc_shadow .rs img').each(function () {
		var h = $(this.parentNode).height();
		//document.title = h;
		this.style.height = h+'px';
	});
	$(node).find('.rc_shadow .t .s img, .rc_shadow .b .s img').each(function() {
		var w = $(this.parentNode).width();
		this.style.width = w + 'px';
	});
	node.shadows_done = true;
}

$(document).ready(function() {setTimeout(function() {drawSideShadows($('.sub_menu').get(0))}, 100);});
$(document).ready(function() {
	$("a[rel='colorbox']").each( function() {
		var title = $(this).find('img').attr('alt');
 		$(this).colorbox({height:'100%',scalePhotos:false, scrolling:true, title:title, current:''});
	}); 
	$("a[rel='colorbox_video']").each( function() {
 		$(this).colorbox({title:'', inline:true, current:'', href:"#"+$(this).attr('video_href')});
 		
	}); 
});
/*
$(document).ready(function() {
		$('.sub_menu li.top').each( function() {
				$(this).hover(function() {
						hideSubs();
						$(this).find('.sub_wrapper').each(function() {
								$(this).removeClass('hidden');
						});
				}, function() {
					hideSubs();
				});
		});
		$('.sub_menu li').each ( function() {
				$(this).hover( 
					function() {
						$(this).addClass('hvr');
					}, function () {
						$(this).removeClass('hvr');
					}
				);
		});
});*/

