function show_content(time) {
	if ($("#overlay").length>0) {
		$('#overlay').animate({opacity: 0}, time, function() {
			$('#overlay').hide();
			$('#wrap').fadeOut(time/2).flash(function() { this.StopPlay(); });
			$.getScript('http://www.staatstheater-cottbus.de/js/functions.js');
		});
	}
}

function load_content(url,time) {
	time=time||2000;
	$.ajax({
		type: 'GET',
		url: url,
		dataType: 'html',
		success: function(data) {
			var tag_open = data.indexOf('<div id="top">')+14;
			var tag_close = data.lastIndexOf('</div>');
			var new_data = data.substring(tag_open, tag_close);
			$('#top').html(new_data);
			$("#skip").hide();
			show_content(time);
		}
	});	
}

$(window).load(function () {
	if ($("#wrap").length>0 && $.flash.available) {
		var text = $("#wrap").html();
		$("#wrap").html("");
		$("#wrap").flash({swf:"http://www.staatstheater-cottbus.de/flash/Intro_staatstheater_23-09-2010.swf",height:300,width:1024,wmode:'transparent'}).append(text);

	} else {
		load_content('http://www.staatstheater-cottbus.de/start.html',500);
	}
	$("#skip").click(function() {
		load_content('http://www.staatstheater-cottbus.de/start.html',500);
		return false;					
	});
});
