﻿/*

	Lost Boys 2005.
	
	De inhoud van dit bestand is in opdracht vervaardigd en eigendom van onze opdrachtgever.
	Niet hergebruiken zonder toestemming.
	Neem voor vragen contact op met Lost Boys, www.lostboys.nl.

	The contents of this file have been produced for and are the property of our client.
	Do not reuse without permission.
	Any questions? Please contact Lost Boys, www.lostboys.nl.

*/
Basket = function () {
	this.basket = document.getElementById("basket");
	this.basketarea = document.getElementById("basketarea");

	this.isOpen = false;
	this.openHeight = this.basketarea.getElementsByTagName("table")[0].offsetHeight+document.getElementById("change").offsetHeight;

	this.opener = new Animator(0, this.openHeight, this.method(this.setHeight), this.method(this.finish));
	this.closer = new Animator(this.openHeight, 0, this.method(this.setHeight), this.method(this.finish));

	var basket = this;
	var header = this.basket.getElementsByTagName("h5")[0];
	header.onmouseover = function (e) {
		if (!basket.isOpen) {
			basket.show();
		}
		if (e) e.stopPropagation(); else window.event.cancelBubble = true;
	}
	this.basket.onmouseout = function (e) {
		var o = (e) ? e.relatedTarget : window.event.toElement;
		if (isChild(basket.basket, o)) return;
		if (basket.isOpen) {
			basket.hide();
		}
	}
}
Basket.prototype.show = function (e) {
	if (this.animator) return;
	this.isOpen = true;
	this.animator = this.opener;
	this.opener.start();
}
Basket.prototype.hide = function () {
	if (this.animator) return;
	this.isOpen = false;
	this.animator = this.closer;
	this.closer.start();
}
Basket.prototype.finish = function () {
	this.animator = null;
}
Basket.prototype.setHeight = function (x) {
	this.basketarea.style.height = x+"px";
}