/* REQUIRES: jquery.js */
$(document).ready(function(){
	$('body').addClass('domenabled');
	// Show vacancy
	showVacancy();
	/* Lightbox */
	// Act on the event
	$(function(){
		$("a[rel='lightbox']").lightBox();
	});
	/* Wine tabs */
	if($('ul.tabs').length > 0){
		$('ul.tabs').tabs('div.panes > div');
	}
	// Blink
	setTimeout(blink,800);
	$('#barfly').mouseenter(function(){
		clearTimeout(timer);
	});
	/* New Window */
	openInNewWindow();
});

function showVacancy(){
	var vacancy = $('#vacancy');
	$(vacancy).animate({
		top:0
	}, 500).delay(1000).fadeIn(1500).delay(4000).animate({
		top:-184
	}, 500, function(){
		$('#show').toggle(function(){
			$(vacancy).animate({
				top:0
			});
		}, function(){
			$(vacancy).animate({
				top:-184
			});
		});
	});
}

function blink() {
	$('#barfly').toggle();
	timer = setTimeout(blink,800);
}

function openInNewWindow() {
	$("a[rel='external']").each(function() {
		$(this).attr({
			//target: "_blank",
			href: "javascript:window.open('" + $(this).attr("href") + "');void(0);", 
			title: "Link opent in een nieuw venster"
		});
	});
}

