function openWindow(url) {
	window.open(url);
}

function openCleanWindow(url, width, height) {
	window.open('image.php?url='+url+'&width='+width+'&height='+height+'', 'Melville', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+'');
}

function search() {
	document.getElementById('searchForm').submit();
}

function browseSeason(id) {
	if (id != 0) {
		window.location.href = 'catalogue.php?category=' + id;
	}
}

function showmaillist() {
	var maillistEl = document.getElementById('maillistsignup');
	if (maillistEl.style.display == "inline") maillistEl.style.display = "none";
	else if (maillistEl.style.display == "none") maillistEl.style.display = "inline";
}

function maillistSubmit() {
	var maillistEl = document.getElementById('maillistsignup');
	var maillistForm = document.getElementById('maillistform');
	maillistForm.setAttribute("target", "_blank");
	maillistForm.submit();	
	var maillistInput = document.getElementById('ea');
	maillistEl.style.display = "none";
}

var initHeight = 0;
function $() {
	var elements = new Array();
	for (var i=0;i<arguments.length;i++) {
		var element = arguments[i];
		if (typeof element == 'string') element = document.getElementById(element);
		if (arguments.length == 1) return element;
		elements.push(element);
	}
	return elements;
}

var BoxHeights = {
	maxh: 0,
	boxes: Array(),
	num: 0,
	op_test: false,
	equalise: function() {
		this.num = arguments.length;
		for (var i=0;i<this.num;i++) if (!$(arguments[i])) return;
		this.boxes = arguments;
		this.maxheight();
		for (var i=0;i<this.num;i++) $(arguments[i]).style.height = this.maxh+"px";
		initHeight = this.maxh;
	},
	maxheight: function() {
		var heights = new Array();
		for (var i=0;i<this.num;i++) {
			if (navigator.userAgent.toLowerCase().indexOf('opera') == -1) {
				heights.push($(this.boxes[i]).scrollHeight);
			} else {
				heights.push($(this.boxes[i]).offsetHeight);
			}
		}
		heights.sort(this.sortNumeric);
		this.maxh = heights[this.num-1];
	},
	sortNumeric: function(f,s) {
		return f-s;
	}
}

