function toPage(page) {
	location.href = page;
}


/* Center Popup Window --------------------------- */
function centerWindow(page,sWidth,sHeight){
		popWindow = window.open(page,'','toolbar=no,menubar=no,status=no,scrollbars=yes,resizeable=no,width='+sWidth+',height='+sHeight);		
		popWindow.moveTo(((screen.width/2)-(sWidth/2)),((screen.height/2)-((sHeight/2)+20)))
		}
		
		
/* Rollovers not using CSS ----------------------- 
List of javascript style attributes: http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html
*/
function rollOv(which) {
	document.getElementById(which).style.backgroundPosition = "0 -28px";
}

function rollOu(which) {
	document.getElementById(which).style.backgroundPosition = "0 0";
}


/* Code found at http://www.askthecssguy.com/examples/linkboxes/index.html */
/* OnLoad JS -----------------------
function by Simon Willison */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

/* Linkarea JS/CSS ----------------------- 
function by Robert Nyman */
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];		
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}	
	}
	return (arrReturnElements)
}

function addClassName(oElm, strClassName){
	var strCurrentClass = oElm.className;
	if(!new RegExp(strClassName, "i").test(strCurrentClass)){
		oElm.className = strCurrentClass + ((strCurrentClass.length > 0)? " " : "") + strClassName;
	}
}


function removeClassName(oElm, strClassName){
	var oClassToRemove = new RegExp((strClassName + "\s?"), "i");
	oElm.className = oElm.className.replace(oClassToRemove, "").replace(/^\s?|\s?$/g, "");
}

/* Requires customizing for specific needs to work with the three functions above */
function hm_hiLiteArea() {
	var boxes = getElementsByClassName(document, "div", "linkarea");
	for (var i=0; i<boxes.length; i++){
		var fullstories = getElementsByClassName(document, "p", "fullstory");
		for (var k=0; k<fullstories.length; k++){
			fullstories[k].parentNode.tabIndex = k+1;
			fullstories[k].style.display = "none";
			fullstories[k].parentNode.onmouseover = function() {
				addClassName(this, "hm_hiLite_hover");
			}
			fullstories[k].parentNode.onmouseout = function() {
				removeClassName(this, "hm_hiLite_hover");
			}
			fullstories[k].parentNode.onclick = function() {
				var destin = this.getElementsByTagName("a");
				window.location = destin[0].href;
			}
			fullstories[k].parentNode.onkeypress = fullstories[k].parentNode.onclick;
		}
	}
}
