function TJK_hankSpecial(zEl){// v1.0 Copyright (c) 2006 TJKDesign - Thierry Koblentz
if (document.getElementById && document.createElement && document.getElementById(zEl)){
	var zPort=(top.location.port)? ":"+top.location.port :"";
	var strLocation="http://"+top.location.hostname+zPort+top.location.pathname;
	var a = document.getElementById(zEl).getElementsByTagName("a");
	for (var x=0,i=a.length;x<i;x++){
		if(a[x].href && a[x].href==strLocation){
			a[x].className+=" "+"ubiAt";
			a[x].removeAttribute("href");			
		}
			if(strLocation.indexOf(a[x].href)!=-1 && a[x].href!=a[0].href){a[x].className+=" "+"ubiAt";}}}}
function TJK_hank(zMenu,defaultPage,classToApply,leaveItAlone){// v2.0 Copyright (c) 2006 TJKDesign - Thierry Koblentz
if (document.getElementById && document.createElement && document.getElementById(zMenu)){var zPort=(top.location.port)? ":"+top.location.port :"";var strLocation=(top.location.pathname.lastIndexOf("/")+1==top.location.pathname.length) ? top.location.hostname + top.location.pathname+defaultPage : top.location.hostname+zPort+top.location.pathname;var a = document.getElementById(zMenu).getElementsByTagName("a");for (var x=0,i=a.length;x<i;x++){var nothingToDo=(a[x] && a[x].className && a[x].className==leaveItAlone) ? true:false;if(!nothingToDo && a[x] && a[x].href && a[x].href.lastIndexOf("#")+1!=a[x].href.length){
	if (a[x].href.indexOf(strLocation,0)>0 || a[x].href==top.location.protocol + "//" + top.location.hostname + top.location.pathname>0 || a[x].href == top.location.href){
if(classToApply==""){var objNode=a[x];var strLink=objNode.firstChild.data;objNode.parentNode.innerHTML="<em>"+strLink+"</em>";}else{a[x].className+=" "+classToApply;}}}}}}
function TJKpop(){var e = document.getElementById("wrapper");if (e){var a=e.getElementsByTagName("a");for (var i=0;i<a.length;i++){if (a[i].getAttribute("href") != null && a[i].className != "noPop" && a[i].getAttribute("href").indexOf("://") >= 0 && a[i].getAttribute("href").toUpperCase().indexOf(document.domain.toUpperCase()) == -1){a[i].className+=a[i].className?" outlink":"outlink";a[i].title+=" (external link)";/*a[i].onclick=function(){newWin=window.open(this.href,"TJKWin");if(window.focus){newWin.focus()} return false;}*/}}}}
function TJKpopAppPdf(){var zA=document.getElementsByTagName("a");for (var i=0;i<zA.length;i++){if (zA[i].getAttribute("href") != null && zA[i].className != "noPop" && (zA[i].getAttribute("type") == "application/pdf" || zA[i].getAttribute("href").toUpperCase().indexOf(".PDF") >= 0 || zA[i].getAttribute("href").toUpperCase().indexOf("PDF/") >= 0)) {
    zA[i].title+=" (opens in new window)";
    zA[i].target="_blank";
    var addclass = true;
    var xA = zA[i].childNodes;
    for (var j=0; j<xA.length; j++) {
	if (xA[j].tagName == "IMG") {
	    // don't set 'outPDF' class on href's containing img tags
	    addclass = false;
	}
    }
    if (addclass) {zA[i].className="outPDF"};
}}}


// Copyright 2006 Gez Lemon - http://www.juicyStudio.com
function initialise() {
	if (!document.getElementsByTagName || !document.getElementById || !document.createElement || !document.createTextNode)
		return;
	var objAreas = document.getElementsByTagName('textarea');
	var objLabels = document.getElementsByTagName('label');
	var objSpan, strLabel;
	// Attach an event handler for each form
	for (var iCounter=0; iCounter<objAreas.length; iCounter++) {
		strLabel = getLabel(objAreas[iCounter], objLabels);
		objSpan = document.createElement('span');
		objSpan.className = 'increase'; // for IE
		objSpan.appendChild(document.createTextNode('['));
		objSpan.appendChild(addAnchor(objAreas[iCounter], strLabel, 1));
		objSpan.appendChild(document.createTextNode('] ['));
		objSpan.appendChild(addAnchor(objAreas[iCounter], strLabel, 2));
		objSpan.appendChild(document.createTextNode(']'));
		objAreas[iCounter].parentNode.insertBefore(objSpan, objAreas[iCounter]);
	}
}
function addAnchor(objArea, strLabel, iAction)
{
	var objAnchor = document.createElement('a');
	objAnchor.setAttribute('href', '#' + objArea.getAttribute('id'));
	objAnchor.onclick = function(event){return increaseArea(event, objArea, iAction);};
	objAnchor.onkeypress = function(event){return increaseArea(event, objArea, iAction);};
	if (iAction == 1)
		objAnchor.appendChild(document.createTextNode('Increase Area'));
	else
		objAnchor.appendChild(document.createTextNode('Decrease Area'));
	return objAnchor;
}
function getLabel(objField, objLabels)
{
	for (var iCounter=0; iCounter<objLabels.length; iCounter++)
		if (objLabels[iCounter].htmlFor == objField.id)
			return objLabels[iCounter].firstChild.nodeValue;
	return 'unknown';
}
function increaseArea(objEvent, objArea, iAction)
{
	// Allow keyboard navigation over links
	if (objEvent && objEvent.type == 'keypress')
		if (objEvent.keyCode != 13 && objEvent.keyCode != 32)
			return true;
	var iRows = parseInt(objArea.getAttribute('rows'), 10);
	if (iAction == 1)
	{
		if (iRows < 50)
			iRows += 5;
	}
	else
	{
		if (iRows > 5)
			iRows -= 5;
	}
	objArea.setAttribute('rows', iRows);
	return false;
}
// no flickering
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
