﻿var tbt;
var tbe;
var tbv = false;

function VarsTB()
{
	if (tbv == false)
	{
		tbt = 'Search site...';
		tbe = getElm('ixss');
		tbv = true;
	}
}

function FocusTB()
{
	VarsTB();
	if (gv(tbe).toLowerCase() == tbt.toLowerCase()) { tbe.value = ''; }
}

function BlurTB()
{
	VarsTB();
	if (gv(tbe).toLowerCase() == '') { tbe.value = tbt; }
}

function yearSelect(y)
{
	var u = location.href;
	if (u.Contains('?') == true)
	{
		u = u.split('?')[0];
	}
	if (y > 0) { u += '?year=' + y; }
	location.href = u;
}

//CLICK ELEMENT(event, element object, url[, target])
//evt - the event object, so the function can be exited if the click originates from a genuine A tag
//elm - the element to be searched for a link
//url - the destination url
//target - optional, "_self" by default, ie the same window
function clkElm(evt, elm, url, trgt)
{

	if (!elm) { return; }

	var et = evt.target || evt.srcElement;
	var tn = et.tagName;
	var pn = et.parentNode.tagName;
	if (tn.toLowerCase() == 'a' || pn.toLowerCase() == 'a') { return; }

	if (url)
	{
		var t = "_self";
		if (trgt) { t = trgt; }
		window.open(url, t);
	}
	else { return; }

}
