function archiveJump() {
var yearIndex = document.getElementById('YEAR').selectedIndex;
yearIndex = document.getElementById('YEAR')[yearIndex].value;
var catIndex = document.getElementById('URL').selectedIndex;
catIndex = document.getElementById('URL')[catIndex].value;
window.location = "http://www.ohsutp.ca/index.php/workshops/archive/"+yearIndex+catIndex;
}

function kteJump() {
var location="http://www.ohsutp.ca/index.php/kte/";
var topicIndex = document.getElementById('TOPIC').selectedIndex;
var popIndex = document.getElementById('POPULATION').selectedIndex;
if (topicIndex != "0" || popIndex != "0")   location += "category/";

if (topicIndex != "0")    location += document.getElementById('TOPIC')[topicIndex].value;

if (popIndex != "0") {
  if (topicIndex != "0") location += "&";
  location += document.getElementById('POPULATION')[popIndex].value;
}

if (topicIndex != "0" || popIndex != "0")   location += "/";

var sortIndex = document.getElementById('orderby').selectedIndex;
if (sortIndex != "0") location = location + "sort/" + document.getElementById('orderby')[sortIndex].value + "/";


window.location = location;
}


function addLoadEvent(func){
    var oldonload = window.onload;
    if(typeof window.onload != 'function'){
        window.onload = func;
    }else{
        window.onload = function(){
            oldonload();
            func();
        }
    }
}


/*---- Grey Initial Values ------ */

function greyInitialValues(){

	var filled = getElementsByClassName("filled");
	if(filled.length > 0){
		for(var i = 0; i < filled.length; i++){
			filled[i].className = "empty";
			filled[i].initialValue = filled[i].value;
			
			filled[i].onclick = filled[i].onfocus = function(){
				this.className = "filled";
				if(this.value == this.initialValue){
					this.value= "";
				}
			}
			
			filled[i].onblur = function(){
				if(this.value == this.initialValue || this.value == ""){
					this.className = "empty";
					this.value = this.initialValue;
				}else{
					this.className = "filled";
				}
			}
		}
	}else{return;}
}
addLoadEvent(greyInitialValues);

/*---- Grey Initial Values ------ */

/* -----    getElementsByClassName  -----
	by SCOTT SCHILLER
	http://www.schillmania.com
-----------------------------------*/

function getElementsByClassName(className,oParent) {
  var doc = (oParent||document);
  var matches = [];
  var nodes = doc.all||doc.getElementsByTagName('*');
  for (var i=0; i<nodes.length; i++) {
    if (nodes[i].className == className || nodes[i].className.indexOf(className)+1 || nodes[i].className.indexOf(className+' ')+1 || nodes[i].className.indexOf(' '+className)+1) {
      matches[matches.length] = nodes[i];
    }
  }
  return matches; // kids, don't play with fire. ;)
}

/* end scripts by SS */
