document.login = document.getElementById('login');
document.login.openw = 160;
document.login.openh = 242;
document.login.background = '/gif/p-login-green.gif';

$(function(){

	var toFix = $('#login').add('#quotes').add('#Euan').add('#rantings');

	var tops = [];
	toFix.each(function(){
		tops.push($(this).offset().top - parseInt($(this).css('margin-top')));
	});
	
	toFix.each(function(index){
		$(this).css({
			position:'fixed',
			top:tops[index],
			left:$(this).offset().left - parseInt($(this).css('margin-left'))
		});
	});

	var deepest = 0;
	var lefts = [];
	$('puna\\\:column').each(function(){
		var e = $(this);
		lefts.push(e.position().left);
		var h = e.height();

		if (h > deepest)
			deepest = h;
	});

	var content = $('puna\\\:content');
	var top = content.offset().top;
	content.css({
		position:'absolute',
		left:content.offset().left,
		top:top,
		width:content.width(),
		height:content.height()
	});
	
	$('puna\\\:column').each(function(index){
		$(this).css({
			position:'absolute',
			top:0,
			left:lefts[index],
			minHeight:deepest,
			backgroundPosition:(lefts[index] + 118) + 'px ' + $(this).offset().top + 'px',
			backgroundAttachment:'fixed'
		});
		var t = $("<div class='fadetop'></div>");
		$(this).append(t);
		var adjust = 0;
		if (index == 0)
			adjust = 5;
		t.css({
			top:top,
			left:lefts[index] + 150 + adjust,
			width:$(this).width() + adjust * 2
		});
	});

	$('puna\\\:quote').css({position: 'fixed', width:'100%'});	
});