function stop(e) {
	if (!e) e = window.event;
	(e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true;
	(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
	return false;
}

function prevDef(e) {
	if (!e) e = window.event;
	(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
	return false;
}    	  
		
/* */

$(document).ready(function() {

	/* */

	function switchJsIdent(state) {
		if (state == "load") {
			$("body")
				.removeClass("noJs")
				.addClass("readyJs");
		}
		if (state == "ready") {
			$("body")
				.removeClass("noJs")
				.removeClass("readyJs")
				.addClass("activeJs");
		}
	}

	/**
	* render the flash embed for those crazy mp3 soundz ... yeah rock�n roll
	*
	*/
	function insertPlayer(kid) {

		var soundz = ['wind-chime-2.mp3', 'hu_babe.mp3', 'oh_dude.mp3', 'again.mp3', 'script_4me.mp3']

		var playerpath = 'includes/swf/singlemp3player.swf';
		var path = 'includes/soundz/';
		
		switch (activeKid) {
			case "lizzy":
				filename = path + "DanoontjeOnline_Lizzy.mp3";
				break;
			case "daan":
				filename = path + "DanoontjeOnline_Daan.mp3";
				break;
			case "emma":
				filename = path + "DanoontjeOnline_Emma.mp3";
				break;
			case "albert":
				filename = path + "DanoontjeOnline_Albert.mp3";
				break;
			default:
		}
 		
		var mp3html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		mp3html += 'width="1" height="1" ';
		mp3html += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">';
		mp3html += '<param name="movie" value="' + playerpath + '?';
		mp3html += 'showDownload=false&file=' + filename + '&autoStart=true';
		mp3html += '&backColor=ffffff&frontColor=ffffff';
		mp3html += '&repeatPlay=false&songVolume=50" />';
		mp3html += '<param name="wmode" value="transparent" />';
		mp3html += '<embed wmode="transparent" width="1" height="1" ';
		mp3html += 'src="' + playerpath + '?'
		mp3html += 'showDownload=false&file=' + filename + '&autoStart=true';
		mp3html += '&backColor=ffffff&frontColor=ffffff';
		mp3html += '&repeatPlay=false&songVolume=50" ';
		mp3html += 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		mp3html += '</object>';
		return mp3html;

	}

	//-->

	function playsound() {
		$("#player_div").empty();
		$("#player_div").prepend(insertPlayer());
	}

	$(".mouseoverstate").hide();

	$("#tr_lizzy").hover(
	 	function() {
	 		$(".mouseoverstate", "#lizzy").fadeIn("fast")
	 		activeKid = "lizzy"
	 		playsound();
	 	},
		function() {
			$(".mouseoverstate", "#lizzy").fadeOut("fast")
		}
	);

	$("#tr_daan").hover(
	 	function() {
	 		$(".mouseoverstate", "#daan").fadeIn("fast")
	 		activeKid = "daan"
	 		playsound();
	 	}, function() {
	 		$(".mouseoverstate", "#daan").fadeOut("fast")
	 	}
	);

	$("#tr_emma").hover(
	 	function() {
	 		$(".mouseoverstate", "#emma").fadeIn("fast")
	 		activeKid = "emma"
	 		playsound();
	 	}, function() {
	 		$(".mouseoverstate", "#emma").fadeOut("fast")
	 	}
	);

	$("#tr_albert").hover(
	 	function() {
	 		$(".mouseoverstate", "#albert").fadeIn("fast")
	 		activeKid = "albert"
	 		playsound();
	 	}, function() {
	 		$(".mouseoverstate", "#albert").fadeOut("fast")
	 	}
	);



	/* */

	$slides = $("#assorti-slides li");

	$("#assorti-slides li:first").addClass("active");
	$slides.not(":first").hide();

	function nextSlide() {
		var $active = $(".active", "#assorti-slides");
		var fadeTime = 3000;

		$active
			.fadeOut(fadeTime)
			.removeClass("active")

		var $next = $active.next();

		if ($next.length == 0) {
			$next = $("#assorti-slides li:first")
		}

		$next
			.addClass("active")
			.fadeIn(fadeTime);
	}

	var timer = setInterval(nextSlide, 6000);

	/* */

	if ($('.faq-accordion','#content').length != 0 ) {

		$(".faq-accordion li.answer").not(":first").hide();
		$(".faq-accordion li.question:first").addClass("open");

		$(".faq-accordion li.question").bind("click", function() {
			$(".faq-accordion .open").next().slideUp(250).end().removeClass("open");
			$(this).addClass("open").next().slideDown(300);
		})
		
	}
	
	/* */

	switchJsIdent("ready")

    try
    {
        $(document).pngFix();
    }
        catch(err)
    {
    }
})
