function dosearch() {
	var text = document.getElementById('searchquery').value;
	if (text.length < 1) alert('Please enter a search query.');
	else {
		document.location = '/search/?find=' + text;
	}
}

function boxfocus(box) {
	if (box.getAttribute('used') != "yes") {
		box.setAttribute('defaultvalue',box.value);
		box.value = '';
		box.setAttribute('used',"yes");
		box.style.color = '#FFFFFF';
	}
}
function boxblur(box) {
	if (box.value == "") {
		box.value = box.getAttribute('defaultvalue');
		box.setAttribute('used',"no");
		box.style.color = '#CECECE';
	}
}

function show(lyr) {
	document.getElementById(lyr).style.display = 'block';
}

function hide(lyr) {
	document.getElementById(lyr).style.display = 'none';
}

if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function
(where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling) 
this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function
(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function
(where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

function switchImg(object,update) {
	if (!object.getAttribute('original')) object.setAttribute('original',object.getAttribute('src'));
	object.setAttribute('src','/images/buttons/' + update);
}

function restoreImg(object) {
	object.setAttribute('src',object.getAttribute('original'));
}