// JavaScript Document

function init() {
	init_optionnav();
	init_navmain();
	init_employee_form();

	Cufon.replace($('#nav-main li a.cufon'),{ hover: true });
	try { applyFilter(); } catch(e) {}
}

function init_optionnav() {
	if(window.print) {
		document.getElementById("print-btn").style.display = 'inline';
		document.getElementById("print-btn").onclick  = function () { window.print(); return false; }
	}
	if(history.length > 1) {
		document.getElementById("prev-page-btn").style.display = "inline";
		document.getElementById("prev-page-btn").onclick  = function () { history.go(-1); return false; }
	}

	if(document.getElementById("prev-page-btn").style.display == "inline" && document.getElementById("print-btn").style.display == "inline" ){
		document.getElementById("option-pipe").style.display = "inline";
	}
}

function init_navmain() {
	
	$('#nav-main li.closed a.cufon').click( function() {
		$(this).unbind('click');
		$(this).siblings('ul').show('slow')
		$(this).parent('li').removeClass('closed');
		$(this).parent('li').addClass('open');
		$(this).click( function() {
			$(this).unbind('click');
			$(this).siblings('ul').hide('slow');
			$(this).parent('li').addClass('closed');
			$(this).parent('li').removeClass('open');
			init_navmain();
			return false;
		});
		return false;
	});
	$('#nav-main li.open a.cufon').click( function() { return false; });

}

function init_employee_form() {
	$("#medewerker_contact span.error").siblings("input,textarea").addClass("error");
}


/* SHORT GENERIC ONLOAD BY BROTHERCAKE
----------------------------------------------------------------*/
if(typeof window.addEventListener != 'undefined') {
	window.addEventListener('load', init, false);
} else if(typeof document.addEventListener != 'undefined') {
	document.addEventListener('load', init, false);
} else if(typeof window.attachEvent != 'undefined') {
	window.attachEvent('onload', init);
}


function change_image(img_id, img) {

	var img_to_change = document.getElementById(img_id);
	
	if (img_to_change) {
		img_to_change.src = img; 
	}
}

