$(function(){
	/* 
	 * jquery 1.2.1
	 * @author: arjen
	 * 
	 */ 
	
	// Image replacement
	$('#mainMenu>ul>li>a').ImageReplace({hover: 1});
	//$('body').ImageReplace()
	//$('#binnenkort h2, #nieuws h2').ImageReplace();
   // $('#bodyHome #subColumn1').css({marginTop:'15px'});
	
    // dropmenu
	if (typeof(DickerFisch) != 'undefined')
		var mainDropmenu = new DickerFisch('#mainMenu',{Effect:0, NavTimeout:150});
        
	
	// anchors (external/popup)
	$("a[rel='external']").click(function(){window.open(this.href); return false});
	var oPopWin = null;
	$("a[rel='popup']").click(function(){
		sHref = $(this).attr('href');
		if (sHref.substr(-1) != '/')
			sHref += '/';
		sHref += '?popup=true';
		if (oPopWin && oPopWin.open && !oPopWin.closed) oPopWin.close();
		oPopWin = window.open(sHref, 'winName', 'width=500, height=500'); return false
	});
	

	// nieuws items clickable
	$('#subColumn2 #nieuws li, #nieuwsOpsomming li').addClass('clickable');
	$('#subColumn2 #nieuws li, #nieuwsOpsomming li').hover(function(){
		$(this).addClass('over');
		$(this).attr('title', $(this).find('a').attr('title'));
	}, function(){
		$(this).removeClass('over');
		$(this).removeAttr('title');
	});	
	$('#subColumn2 #nieuws li, #nieuwsOpsomming li').click(function(){
		document.location.href = $(this).find('a').attr('href');
	});


	// preload some images
	$('<img>').attr("src", '/images/nieuwsitem_leesmeer_over.gif');
	
	// selectbox replacement
	if (jQuery.SelectBox)
		$('#formCalendar select').selectbox();
	
	
	// voorstelling items img clickable:
	$('#voorstellingenOverzicht li.voorstellingenOverzicht-item h3 a, #voorstellingenOverzicht li.voorstellingenOverzicht-item h4.kop a').each(function(){
		a = $(this).attr('href');
		i = $(this).parents('li').find('img');
		i.wrap('<a href="'+a+'" class="voorstellingLink"></a>');
	});
	
	// hover state
	$('#voorstellingenOverzicht li a.voorstellingLink').hover(
		function(){
			$(this).parents('li.voorstellingenOverzicht-item').find('a.voorstellingLink').addClass('over');
		},
		function(){
			$(this).parents('li.voorstellingenOverzicht-item').find('a.voorstellingLink').removeClass('over');
		}	
	);
	
	
	
	
});

