/*
  Simons en Boom
  Copyright (C) 2008-2011 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.
*/



$(function() {
	$("#work li:eq(6), #work li:eq(13),").addClass("last");
	$("#men").click(function() {
		this.src = this.src.indexOf("_wave")>0
			? this.src.replace(/_wave/, "_up")
			: this.src.replace(/_up/, "_wave");
	});

	// Hover fix for IE 6
	if ($.browser="msie" && $.browser.version=="6.0") {
		$(".button").hover(
			function() {
				$(this).addClass($(this).attr("id")+"Hover");
			},
			function() {
				$(this).removeClass($(this).attr("id")+"Hover");
			}
		);
	}
	
	var i = 1;
	$("a[rel='video']").each(function () {
		var id = "video-"+i;
		var item = $(this).attr("id", id);
		jwplayer(id).setup({
			flashplayer: "/elements/player.swf",
			file: item.attr("href"),
			height: 298,
			image: item.find("img").attr("src"),
			width: 530,
			screencolor: "ffffff",
			controlbar: "none"
		});
		i++;
	});

	$("a.external").click(function() {
		this.blur();
		window.open(this.href);
		return false;
	});

	$("#more a").live("click", function() {
		$("#newsitems").load(this.href+" #newsitems", function() {
			$("#more").fadeIn(500);
		});
		return false;
	});
	$("#more").fadeIn(500);

	$(window).resize();
});

$(window).resize(function() {
	var container = $("#container");
	container.css("left", Math.max(($(window).width()-container.width())/2, 10));

	// Format first image
	$(".work > img:first").addClass("first");

	// Format captions
	$(".captionContainer .caption").each(function() {
		$(this).css("marginTop", -$(this).height());
	});
});

