// Copyright © 2006 Web Maintenance - WebMaintenance.co.uk
var ContainsList;
var currentTop=0;
var vInterval = null;
var direction;	// 1 = up

if (get_cookie("CurrentTop") != "") {
	currentTop=parseInt(get_cookie("CurrentTop"));
	if((currentTop>10) || (currentTop<-800)) {
		document.cookie="CurrentTop=0";
		currentTop=0;
	}
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { 
      offset += search.length
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function init() {
	// Check if functionality available
	if(!document.getElementById)return;

	up=document.getElementById("ContainsUpArrow");
	down=document.getElementById("ContainsDownArrow");
	down.onmouseover=function(){scrollObjects(0);}
	down.onmouseout=function(){ScrollStop();}
	up.onmouseover=function(){scrollObjects(1);}
	up.onmouseout=function(){ScrollStop();}
	ContainsList = document.getElementById("ContainsList");
	document.getElementById("ContainsMenu").style.height="160px";
	ContainsList.style.top=currentTop+"px";
}

function scrollObjects(dir) {
	if((!dir && currentTop<=-950) || (dir && currentTop>=0))return;
	if(vInterval)return;
	direction=dir;
	vInterval=setInterval("animate()",30);
}
function ScrollStop(){
		clearInterval(vInterval);
		vInterval=null;
		document.cookie="CurrentTop="+currentTop;
}
function animate() {
	if(!direction) {
		currentTop-=1;
	} else {
		currentTop+=1;
	}
	ContainsList.style.top=currentTop+"px";

	//document.getElementById("ContainsDownArrow").innerHTML="<p>"+get_cookie("CurrentTop")+"</p>";
	if((currentTop>=10) || (currentTop<=-800)) {
		clearInterval(vInterval);
		vInterval=null;
	}
}
