function BellSearch() {
	this.loaded = false;
	this.elements = Array();
	this.elmSelectAll = null;
}
BellSearch.prototype = {
	load: function () {
		var oForm;
		if ((oForm = document.getElementById('searchForm'))) {
			this.elements = oForm.elements;
			this.elmSelectAll = document.getElementById('selectall');
			this.loaded = true;
		}
	},
	check: function () {
		if (this.loaded) {
			var bAllSelected = true;
			for (var i=0;i<this.elements.length;i++) {
				var elm = this.elements[i];
				if (elm.type.toLowerCase() == 'checkbox' && elm.id != 'selectall') {
					if (elm.id == 'news' || elm.id == 'stock' || elm.id == 'stones') {
						if (elm.checked) {
							bAllSelected = false;
							break;
						}
					} else {
						if (!elm.checked) {
							bAllSelected = false;
							break;
						}
					}
				} else if (elm.type.toLowerCase() == 'select-one') {
					if (elm.value != 0) {
						bAllSelected = false;
						break;
					}
				}
			}
			this.elmSelectAll.checked = bAllSelected;
		}
	},
	selectAll: function () {
		if (this.loaded) {
			if (this.elmSelectAll.checked) {
				for (var i=0;i<this.elements.length;i++) {
					var elm = this.elements[i];
					if (elm.type.toLowerCase() == 'checkbox') {
						if (elm.id == 'news' || elm.id == 'stock' || elm.id == 'stones') {
							if (this.elmSelectAll.checked)
								elm.checked = false;
						} else {
							elm.checked = this.elmSelectAll.checked;
						}
					} else if (elm.type.toLowerCase() == 'select-one') {
						elm.value = 0;
					}
				}
			} else {
				this.check();
			}
		}
	},
	checkType: function (id) {
		this.checkGroup('type', id);
	},
	checkMaterial: function (id) {
		this.checkGroup('material', id);
	},
	checkModel: function (id) {
		this.checkGroup('model', id);
	},
	checkGroup: function (group, id) {
		var me = document.getElementById(group+id);
		if (!me.checked) {
			var i = 1;
			var bEmpty = true;
			var elm;
			while ((elm = document.getElementById(group+i))) {
				if (id != i) {
					if (elm.checked)
						bEmpty = false;
				}
				++i;
			}
			if (bEmpty)
				me.checked = true;
		}
		this.check();
	}
}

// globals, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xMac,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
  var i=xUA.indexOf('opera');
  if(i!=-1){
    var v=parseInt(xUA.charAt(i+6));
    xOp7Up=v>=7;
    xOp6Dn=v<7;
  }
}
else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
  xIE4Up=parseFloat(navigator.appVersion)>=4;
  xIE4=xUA.indexOf('msie 4')!=-1;
  xIE5=xUA.indexOf('msie 5')!=-1;
}
else if(document.layers){xNN4=true;}
xMac=xUA.indexOf('mac')!=-1;
// xClientWidth, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xClientWidth(){
  var w=0;
  if(xOp6Dn) w=window.innerWidth;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)
    w=document.documentElement.clientWidth;
  else if(document.body && document.body.clientWidth)
    w=document.body.clientWidth;
  else if(xDef(window.innerWidth,window.innerHeight,document.height)) {
    w=window.innerWidth;
    if(document.height>window.innerHeight) w-=16;
  }
  return w;
}
// xClientHeight, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xClientHeight(){
  var h=0;
  if(xOp6Dn) h=window.innerHeight;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
    h=document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    h=document.body.clientHeight;
  else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
    h=window.innerHeight;
    if(document.width>window.innerWidth) h-=16;
  }
  return h;
}

function xDef(){
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}


function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);

dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
