(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);

$(document).ready(function() {
	if (window.location.hash) {
		$("#questions").addClass("shrunk");
		$(window.location.hash).addClass("active");
	}
	($body = $("body")).addClass("script").append('<img id="background" /><img id="background2" />');
	$("h2").wrapInner('<a href="#" />').find("a").live("click", function(event) {
		window.location.hash = (($div = $(this).closest("div")).hasClass("active")) ? "" : $div.attr("id");
		event.preventDefault();
	});
	$title = $("h1").children("img");
	$background2 = $("#background2");
	($background = $("#background")).load(function() {
		$background2.fadeOut(function() {
			$(this).attr("src", $background.attr("src"));
		});
	});
	size();
});

$(function() {
	$(window).bind("hashchange", function() {
		$("div.active").removeAttr("class");
		if (window.location.hash.length < 2)
			$("#questions").removeClass("shrunk");
		else {
			$("#questions").addClass("shrunk");
			$(window.location.hash).addClass("active");
		}
	});
});
$(window).resize(size);

roundvalue = 50;
function size() {
	roundedwidth = Math.ceil(($width = $(window).width()) / roundvalue) * roundvalue;
	roundedheight = Math.ceil(($height = $(window).height()) / roundvalue) * roundvalue;
	$background2.show();
	$background.attr("src", "image.php?background.jpg&image=background.jpg&width=" + roundedwidth + "&height=" + roundedheight + "&cropratio=" + roundedwidth + ":" + roundedheight);
	$body.css("fontSize", (($height > 450) ? $height / 50 : 9));
	$title.attr("src", (($.browser.msie && parseInt($.browser.version) < 7) ? "image.php?title.png&image=title.png&width=" + $title.width() + "&color=fff" : "image.php?title.png&image=title.png&width=" + $title.width()));
}