function makeArray() {
  var args = makeArray.arguments;
  for (var i = 0; i < args.length; i++) {
    this[i] = args[i];
  }
  this.length = args.length;
}

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function getString(date) {
  var months = new makeArray("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  var day = new makeArray(" First to Sabbath{sunday)", " Second to Sabbath(monday)", " Third to Sabbath(tuesday)", " Fourth to Sabbath(wednesday)", " Fifth to Sabbath(thursday)", " Preparation Day(friday)", " THE SABBATH");
  return "<B>" + day[date.getDay()] + "</B>" + ", " + months[date.getMonth()] + " " + date.getDate();
}

function printTodaysDate() {
	var cur = new Date();
	fixDate(cur);
	var str = getString(cur);
	document.write(str);
}

// Open a new window slightly less than full screen
function popupFull(url){
	var popWin = window.open(url,'popWin','location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,width='+(screen.availWidth-115)+',height='+(screen.availHeight-230));
	popWin.moveTo(57,35);
	popWin.focus();
}


// Open a new small window for help  text instructions screen
function popupSmall(url){
	var popWin = window.open(url,'popWin','location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,width='+(screen.availWidth-300)+',height='+(screen.availHeight-230));
	popWin.moveTo(57,35);
	popWin.focus();
}

// Add mouseovers to items in the navbars
startList = function() {
	if (document.all&&document.getElementById) {
		// handle right navigation
		navRoot = document.getElementById("rightColumn");
		for (i=0; i<navRoot.all.length; i++) {
			node = navRoot.all[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
		// handle left navigation
		navRoot = document.getElementById("leftColumn");
		for (i=0; i<navRoot.all.length; i++) {
			node = navRoot.all[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function tableruler(){
	window.status="bbbbb";
	if (document.getElementById && document.createTextNode){
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++){
			//if(tables[i].className=='ruler')
			if(tables[i].className.indexOf('ruler')!=-1) {
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++){
					if(trs[j].parentNode.nodeName=='TBODY' && trs[j].parentNode.nodeName!='TFOOT' && trs[j].className!='colgroupHeading'){
						trs[j].onmouseover=function(){
							//this.className="ruled";
							this.className+=" ruled";
							return false;
							window.status=this.className;
						}
						trs[j].onmouseout=function(){
							//this.className="even";
							this.className=this.className.replace(" ruled", "");							
							return false;
							window.status=this.className;
						}
					}
				}
			}
		}
	}
}

//window.onload=startList;
//window.onload=function(){tableruler();}
//window.onload=startList;


// Function to allow multiple onload functions to be called
function multipleOnload() {
	startList();
	//tableruler();
}
window.onload = multipleOnload;


function showHide(trigger,containerItem) {
	
	if (document.all[trigger].innerHTML=="+"){
		document.all[containerItem].style.display = "block";
		document.all[trigger].innerHTML = "-";
	}
	else {
		document.all[containerItem].style.display = "none";
		document.all[trigger].innerHTML = "+";
	}

}

function loadEffortType() {
	location.reload(effortType.value);
}

var keypress = 0;
function microsoftKeyPress() {
	//alert(window.event.keyCode);
    if ((window.event.keyCode==105) || (window.event.keyCode==109) || (window.event.keyCode==115) || (window.event.keyCode==116)){
		keypress++;
	}
	if (keypress == 5){
		document.all.cci.style.display = '';
	}
}
