// JavaScript Document
//Written by Jason 5/5/05

function SecureMe() {
 var addressBar = document.location.href;
 var folderLocation = location.pathname.substring(5);
// alert(folderLocation)
 var lastSlash = folderLocation.lastIndexOf('/');
// alert(lastSlash);
 //var lastDot = folderLocation.lastIndexOf('.');
 //alert(lastDot);
 var folderName = folderLocation.substr(0, lastSlash);
// alert(folderName);
 var wholeFileName = folderLocation.substr(lastSlash+1);
 var lastDot = wholeFileName.lastIndexOf('.');
 var fileName = wholeFileName.substr(0,lastDot);
//alert(fileName);
 var extension = wholeFileName.substr(lastDot+1, 99);
// alert(extension);
 var protocol = addressBar.substr(0, 6);
 //if (protocol == "https") {
 //}
// alert("https://www.engr.washington.edu/epp/" + folderName + "/" + fileName + "." + extension);

 if (protocol == "http:/" && extension == "html") {
  window.location = ("https://www.engr.washington.edu/epp/" + folderName + "/" + fileName + ".php"); 
 }
 if (protocol == "http:/" && extension == "php") {
  window.location = ("https://www.engr.washington.edu/epp/" + folderName + "/" + fileName + ".php"); 
 }
 if (protocol == "https:" && extension == "html") {
  window.location = ("https://www.engr.washington.edu/epp/" + folderName + "/" + fileName + ".php"); 
 }
// window.location = (protocol + "://www.engr.washington.edu/epp/" + folderName + "/" + fileName + "." + extension);
}


// FUNCTION likeCheckbox(this,str)
// PURPOSE: To uncheck a radio button by clicking on it, making it function like a checkbox.
// HTML: <input name="radioname" onmousedown="likeCheckbox(this, 'radioname')" />
// uses onmousedown instead of onclick
// setTimeout() gives a delay which is required to get it to work. 

function likeCheckbox(thisButton,elementName){
	if(thisButton.checked){
		//alert(document.getElementsByName(elementName)[0].checked);
		//setTimeout("document.form3.lateWorkshops20.checked = false;", 100);
		setTimeout("document.getElementsByName('" + elementName + "')[0].checked = false;", 100);
		thisButton.checked = false;
	}
	else if(!thisButton.checked){
		thisButton.checked = true;
	}
}




// FUNCTION uncheck(str,str,str,str,str)
// PURPOSE: To uncheck different radio groups that must be named differently but are mutually exclusive.
// HTML: <input onclick="uncheck('anygroupname',['anygroupname'],['anygroupname'],['anygroupname'],['anygroupname'])" />
// Can list up to 5 group names to uncheck; last 4 are optional.

function uncheck(groupNameA, groupNameB, groupNameC, groupNameD, groupNameE){
	//alert(document.getElementsByName(groupName)[0].value);
	for (i=0; i<document.getElementsByName(groupNameA).length; i++){
		 document.getElementsByName(groupNameA)[i].checked = false;
	}
	if(groupNameB){
		for (i=0; i<document.getElementsByName(groupNameB).length; i++){
		 	document.getElementsByName(groupNameB)[i].checked = false;
		}
	}
	if(groupNameC){
		for (i=0; i<document.getElementsByName(groupNameC).length; i++){
		 	document.getElementsByName(groupNameC)[i].checked = false;
		}
	}
	if(groupNameD){
		for (i=0; i<document.getElementsByName(groupNameD).length; i++){
		 	document.getElementsByName(groupNameD)[i].checked = false;
		}
	}
	if(groupNameE){
		for (i=0; i<document.getElementsByName(groupNameE).length; i++){
		 	document.getElementsByName(groupNameE)[i].checked = false;
		}
	}
}