$(function(){
	
	// Activate menu
	$('ul#menu').dropdownmenu();

	// Activate newsticker
	$('div.adnewsticker').autoscroll();

	// Activate search
	$('input#search_input').focus(function(){
		if($(this).val() == 'Zoek in Adverteren.ad.nl')
			$(this).val('');
	});
	$('input#search_input').blur(function(){
		if($(this).val() == '')
			$(this).val('Zoek in Adverteren.ad.nl');
	});

	// Remove final line from submenu
	$('ul.submenu>li:last').css('borderBottom','none');

	// Replace img PNG's in IE6
	if ($.browser.msie && $.browser.version < 7) {
		$('img.png').each(function(){
			$(this).css({
				filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.src+"')"
			});
			this.src = '/images/blank.gif';
		});
	}

	// Bijlage listings
	$('div#bijlagen div.bijlagen_list').find('div.bijlage:odd').css('backgroundColor','#e5e5e5');
	$('div#bijlagen div.bijlage_extra').each(function(){
		$(this).attr('__ad__height',$(this).height());
		$(this).css('height',0);
		$(this).hide();
	});
	$('div#bijlagen div.bijlage a.titel').click(function(){
		var div = $(this).parent().next();
		div.show();
		if (div.height() == 0) {
			div.css('height',0).animate({
				height: div.attr('__ad__height')
			});
		} else {
			div.animate({
				height: 0
			});
		}
		return false;
	});

	// sIFR
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({
			sSelector: "div.contentblock h2", 
			sFlashSrc: "/fonts/whitney19.swf",
			sWmode: 'transparent'
		}));
		sIFR.replaceElement(named({
			sSelector: "div#contentheader_small h1", 
			sFlashSrc: "/fonts/whitney52.swf",
			sWmode: 'transparent'
		}));
	};

	// Activate star-rating (enquete)
	$('div.starrating').starrating();

});

if (typeof Shadowbox != 'undefined') {
	// Activate Shadowbox
	Shadowbox.loadSkin('classic', '/javascript/shadowbox');
	$(function(){
		Shadowbox.init({
			animate: false,
			animateFade: false
		});
	});
}

function calculatorSubmit(_action) {
    document.forms['calculatorform'].action = _action + "#calculatorform";
    document.forms['calculatorform'].submit();
}