$.fn.wait = function(time, type) {
	time = time || 1000;
	type = type || "fx";
	return this.queue(type, function() {
		var self = this;
		setTimeout(function() {
			$(self).dequeue();
		}, time);
	});
};

$(function() {
	$(".balloon").hide();
	$(".balloon").wait('1000');
	$(".balloon").fadeIn(1000);

	$("#intro_text").wait('3000').fadeTo(3000,0.0);
	
	$("a.dissolve").click(function() {
		newloc = $(this).attr("href");
		$("#rightcol").fadeTo(1000,0,gotoloc);
		return false;
	});

	
	// fadein: see js_fadein.js
	
	function gotoloc() {
		document.location = newloc;
	}

	$("#pattern #accordion").accordion({
		collapsible: true,
		autoHeight: false
	});
	
	$("#pattern #accordion div:first").hide().wait('500').slideDown(750);
	
	
//	Voor het maken van mix-previews
//	$("#mesh td").each(function(x) {
//		var artnr = $(this).attr('alt');
//		var size = $("#tile_size").attr('alt');
//		if (artnr) {
//			var rand = Math.floor(Math.random()*25) * size;
//			var url = "/img_mixes/" + artnr + "_mix.jpg";
//			$(this).append("<div class=\"img\" style=\"background: url("+url+") -"+rand+"px 0px no-repeat;\"></div>");
//		}
//	});	
	
});
