function returnHeight() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return parseInt(myHeight);
}
function getScroll() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

var oldScroll = 0;

function checkThingy() { // for the heypred text on the left + exclamation mark
	myHeight = returnHeight();
	myScroll = getScroll();
	if(document.body.scrollHeight) myDocument = document.body.scrollHeight;
	else myDocument = document.documentElement.scrollHeight;
	var docbottom = myDocument - myHeight; // bottom
  	if(myScroll < docbottom) document.getElementById("exclaim").style.visibility = "hidden";
  	else document.getElementById("exclaim").style.visibility = "visible";

	var predHeight = parseInt(document.getElementById("predbar").height);
	if(myHeight < predHeight) {
		heightdiff = predHeight - myHeight;
		if(myScroll > oldScroll) { // going down
			if(myScroll <= heightdiff) {
			document.getElementById("fixedbar").style.top = "-"+myScroll+"px";
			document.getElementById("exclaim").style.top = "-"+myScroll+"px";
			} else {
			document.getElementById("fixedbar").style.top = "-"+heightdiff+"px";
			document.getElementById("exclaim").style.top = "-"+heightdiff+"px";
			}
		} else { // going up
			var barTop = parseInt(document.getElementById("fixedbar").style.top);
			if(barTop < 0) {
			scrolldiff = oldScroll - myScroll;
			if(scrolldiff > heightdiff) scrolldiff = heightdiff;
			document.getElementById("fixedbar").style.top = (barTop + scrolldiff)+"px";
			document.getElementById("exclaim").style.top = (barTop + scrolldiff)+"px";
			} else {
			document.getElementById("fixedbar").style.top = 0;
			document.getElementById("exclaim").style.top = 0;
			}
		}
	oldScroll = myScroll;
	}
}

function resetScrolly() {
	document.getElementById("fixedbar").style.top = 0;
	document.getElementById("exclaim").style.top = 0;
	myHeight = returnHeight();
}

var pullouttimer = 0;
var pullouttimeout;

function pullout() {
pullouttimer -= 1;
document.getElementById("albumcover").style.bottom = pullouttimer + "px";
if(pullouttimer > -40) pullouttimeout = setTimeout("pullout()", 5);  
}
function pullin() {
pullouttimer = 0;
clearTimeout(pullouttimeout);
document.getElementById("albumcover").style.bottom = 0;
}

var scrolldowntimer = 0;
var scrolldowntimeout;

function scrolldown(towhere) {
	var howfar = findPos(document.getElementById(towhere))[1];
	window.scrollBy(0,20);
	if(getScroll() <= howfar) scrolldowntimeout = setTimeout(function() {scrolldown(towhere)}, 1);
}