/**
 *
 */
function goTo(url)
{
	document.location.href = url;
}

/**
*	externalLinks - target blank aan link klappen
*/
function externalLinks()
{
	if (!document.getElementsByTagName) return;
	
	var anchors = document.getElementsByTagName("a");
	
	var i;
	for(i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		
		if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}
window.onload = externalLinks;

/**
*	in_array - kijk of een waarde voorkomt in een array
*/
function in_array (needle, haystack, start)
{  
	if(start == '')
		start = 0;

	var result = haystack.indexOf(needle, start);
	if ( result > -1 )
		return true;
	else
		return false;
}

/**
*
*/
$(document).ready(function()
{
	// --- intro hover
	$('.bedrijf').hover(function()
	{
		$(this).find('div.bedrijf_img').css('backgroundPosition', 'left bottom');
		$(this).find('a.bedrijf_btn').css('backgroundPosition', 'left bottom');
	}, function()
	{
		$(this).find('div.bedrijf_img').css('backgroundPosition', 'left top');
		$(this).find('a.bedrijf_btn').css('backgroundPosition', 'left top');
	});
	
	// --- intro click
	$('.bedrijf').click(function() { window.location = ROOT_PATH+$(this).find('.bedrijf_img').attr('id').substr(8).replace(" ", "_").replace("& ", "en_")+'/'; });
	
	// --- random header animatie
	headerAnimate(Math.floor(Math.random()*4));
	
	// --- footer popup
	$('div.logo').hover(function()
	{
		$('object').hide();
		
		if(ROLL_OUT == true)
			$(this).find('div.logo_popup').fadeIn(200);
	}, function()
	{
		if(ROLL_OUT == true)
			$(this).find('div.logo_popup').fadeOut(200);
		
		$('object').show();
	});
	
	// --- footer click
	$('div.logo').click(function()
	{
		window.location = ROOT_PATH+$(this).find('div.logo_popup').find('img').attr('alt').substr(9).replace(" ", "_").replace("& ", "en_")+'/';
	});
});

$(window).scroll(function()
{
	var pos = $(document).scrollTop();
	
	if(pos > 36)
	{
		$('#logo').css({'marginTop': pos+'px'});
	}else
	{
		$('#logo').css({'marginTop': '0px'});
	}
});

document.write('<script type="text/javascript" src="'+ROOT_PATH+'js/animate.js"></script>');
