var imloaded = false;
var bodyloaded = false;
var ie = document.all;
function fixbody() {
	if (!imloaded || !bodyloaded) {
		window.setTimeout("fixbody()", 50);
		return;
	}
	var w = pl.width;
	var h = pl.height;
	var bw = document.body.clientWidth;
	var bh = document.body.clientHeight;
	var cn = document.body.className;
	var ncn = ((bw/bh > w/h) ? "h" : "v");
	if (cn != ncn) {
		setcookie("wall", ncn)
		if (!ie) document.body.className = ncn;
		else {
			var im = document.getElementById("ieimg");
			if (ncn == "v") {
				nw = Math.ceil(w * (bh/h) + 1);
				nh = Math.ceil(h * (bh/h) + 1)
			} else {
				nw = Math.ceil(w * (bw/w) + 1);
				nh = Math.ceil(h * (bw/w) + 1);
			}
			im.style.width = nw + "px";
			im.style.height = nh + "px";
			im.style.left = Math.floor((bw - nw) / 2) + "px";
			im.style.top = Math.floor((bh - nh) / 2) + "px";
		}
	}
}
var pl = new Image();
pl.src = "/img/wall.jpg";
pl.onload = function() { imloaded = true; fixbody() };
window.onresize = fixbody;

if (getcookie("wall")) {
	bodyloaded = true;
	imloaded = true;
	pl.width = 1600;
	pl.height = 1000;
}

var firstcontent = true;
function showcontent(w) {
	var speed = 0;
	if (firstcontent) {
		fadeout('thecontent', 0.2);
		window.setTimeout(function() {
			$('whatbuttons').style.opacity = 0;
			$('whatbuttons').style.display = "block";
			fadein('whatbuttons', 0.5);
		}, 200)
		window.setTimeout(function() {
			$('thecontent').innerHTML = $(w).innerHTML;
			fadein('thecontent', 0.2);
		}, 400);
		firstcontent = false;
		return;
	}
	$('thecontent').innerHTML = $(w).innerHTML;
//	fadein('thecontent', 0.5);
	
}

addevent(window, "load", function() {
	bodyloaded = true;
	fixbody();
})

var im;
im = new Image(); im.src = "/img/what_bigcoffee.jpg";
im = new Image(); im.src = "/img/what_bigjuice.jpg";
im = new Image(); im.src = "/img/what_bigsandwich.jpg";

