/*
  Realisé
  Copyright (C) 2009 by Systemantics, Bureau for Informatics

  Lutz Issler
  Mauerstr. 10-12
  52064 Aachen
  GERMANY

  Web:    www.systemantics.net
  Email:  mail@systemantics.net

  Permission granted to use the files associated with this
  website only on your webserver.
*/



var quote = 0;
var scroll = null;

$(window).load(function() {
	quote = Math.floor(Math.random()*$("#quotes img").length);
	$("#quotes img").eq(quote).show();
	window.setInterval(
		function() {
			var quotes = $("#quotes img");
			quote = quote==quotes.length-1 ? 0 : quote+1;
			quotes.eq(quote).show();
		},
		3000
	);
	window.setTimeout(
		function() {
			$("#quotes img").hide();
			window.setInterval(
				function() {
					$("#quotes img").hide();
				},
				3000
			);
		},
		2500
	);
});

$(function() {
	$(".up").mousedown(function() {
		window.clearInterval(scroll);
		var jText = $.data(this, "target");
		scroll = window.setInterval(function() {
			jText.scrollTop(jText.scrollTop()-19);
		}, 50);
	});
	$(".up").mouseup(function() {
		window.clearInterval(scroll);
	});
	$(".down").mousedown(function() {
		window.clearInterval(scroll);
		var jText = $.data(this, "target");
		scroll = window.setInterval(function() {
			jText.scrollTop(jText.scrollTop()+19);
		}, 50);
	});
	$(".down").mouseup(function() {
		window.clearInterval(scroll);
	});
	$(".arrow").each(function() {
		$.data(this, "target", $(this).siblings(".text"));
	});
	$("#quickcontact a img").hover(
		function() {
			this.src = this.src.replace('_off.', '_on.');
		},
		function() {
			this.src = this.src.replace('_on.', '_off.');
		}
	);
	if ($.browser.msie && $.browser.version<"8.0") {
		// IE 6+7 interpret nested z-index values wrong, so push
		// all nested divs to the top level for those two browsers
		$(".link, .arrow, .credits").each(function() {
			var jThis = $(this);
			jThis
				.css("top", jThis.offset().top)
				.css("left", jThis.offset().left);
			$("body").append(jThis);
		});
	}
	$("a.external").click(function() {
		window.open(this.href);
		return false;
	});
});
