//<!--

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function openWindow(_url, _name, _features) {
  top.window[_name] = window.open(_url, _name, _features);
  if (top.window[_name] != null) {
    top.window[_name].focus();
  }  
}

function argFromURL(url) {
  var args = String(url).split("#");
  if (args.length > 1) {
    return args[1];
  } 
  else {
    return ""; 
  }  
}

function changeImage(imgDocID,imgObjName) {
  document.images[imgDocID].src = eval( imgObjName + ".src")
}
	
function showContextPopUp(srcElement, chosenid, refid, refsite, thisalias, thisid) {
  var featuresString = "left=100,top=100,height=500,width=460,scrollbars=yes,resizable=yes";
  _url = srcElement.getAttribute("href");
  openWindow(_url, "contextsearch", featuresString);
}


function showPopUp(srcElement, windowName, features) {
  var featuresString;
  
  if (features != null) {
    featuresString = features;
  }
  else {
    featuresString = "left=100,top=100,height=477,width=607,scrollbars=yes,resizable=yes";
  }
  _url = srcElement.getAttribute("href");
  openWindow(_url, "popup", featuresString);
}

function showZoomImg(fullname) {                                                                               
  var featuresString = "left=100,top=100,height=500,width=500,scrollbars=yes,resizable=yes,viewbar=yes";
  var _url = aspLink + "?alias=" + viewAlias + "&page_alias=imageview&image=" + fullname;
  top.window["imageview"] = window.open(_url,"imageview",featuresString);
  top.window["imageview"].focus();
  }


function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('content').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'absolute';
				footerElement.style.top = (windowHeight - footerHeight) + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}

/*----------------------------------------------------------------------------*/
/* Anchor updating                                                            */

function focusAnchor() {
	this.blur();
}

function updateAnchors() {
	var anchors = document.getElementsByTagName('a');
	for (var i = 0; i < anchors.length; i++)
	{
		anchors[i].onfocus = focusAnchor;
	}
}

/*----------------------------------------------------------------------------*/

function addEvent(obj, evType, fn) { 
	if (obj.addEventListener) { 
		obj.addEventListener(evType, fn, true); 
		return true; 
	}	
	else if (obj.attachEvent) { 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} 
	else { 
		return false; 
	} 
}

addEvent(window, 'load', updateAnchors);

//-->

