var __jsbase = 'kokofeesten.nl/js/';

function getWindowSize()
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return {w: myWidth, h: myHeight};
}

function getScrollCoordinates() {
	x = (document.all)?document.body.scrollLeft:window.pageXOffset;
	y = (document.all)?document.body.scrollTop:window.pageYOffset;
	return {x: x, y: y};
} 

$(document).ready(function(){
	/* Zet de site in het midden. Dit heb ik zo gedaan omdat het mooier eruit ziet bij het wisselen
	 * tussen pagina's met en zonder verticale scrollbalk. */
	$(window).resize(function(){
		var marginleft = Math.max(0, Math.round((getWindowSize().w - $('#main').width()) / 2));
		$('#main').css('margin-left', marginleft+'px');
	});
	$(window).resize();
	
	$("#bookmarks .descr").click(function(){
		alert($(window).width());
	});
	
	/* Zorg dat de sponsorbalk altijd zichtbaar is. */
	/*$(window).scroll(function(){
		y = getScrollCoordinates().y;
		elem = $('#sponsors');
		offset = elem.offset();
		if (y > 192 && elem.css('position') != 'fixed')
		{
			elem.css('position', 'fixed');
			elem.css('left', offset.left+'px');
		}
		else if (y <= 192 && elem.css('position') != 'relative')
		{
			elem.css('position', 'relative');
			elem.css('left', '0px');
		}
	});*/
	
	/* M'n emailadres wat spammer-proof maken. */
	m = 'mai'+'lto'+':'
	a = '@';
	d = 'svk'+'oko.n'+'l';
	e = 'ec'+'ie';
	$(".contactme").attr('href', ''+m+''+e+''+a+''+d+'');
	
	$("a").each(function(index){
		href = $(this).attr('href');
		pattern1 = /^http:\/\//;
		
		if (pattern1.test(href) && !__base_regexp.test(href))
			$(this).addClass('external_link');
	});
});