function sendform() {
    document.searchform.submit();
}//end sendform

function goTo(menu) {
	try {
		if (menu) {
			location = menu.options[menu.selectedIndex].value;
		}//end if 
		else { 
			alert(typeof(menu));
		}//end else
	}// end try
	catch(err) { }//end catch
}//end goTo

//goToWebsite() is deprecated, from now on use goTo()
function goToWebsite() {
    var list = document.colleges.CollegesMenu;
    location = list.options[list.selectedIndex].value;
}
//goToLink() is deprecated, from now on use goTo()
function goToLink() { var site = document.quickLinkslist.colleges; top.location = site.options[site.selectedIndex].value;}


function clearIt(what) {
    what.value = '';
}
function defaultIt(what) {
    if (what.value == '') {
        what.value = what.defaultValue;
    } else {
        what.value = what.value;
    }
}
function validateSearch(which) {
	try {
		if (which.q.value == which.q.defaultValue) {
			which.q.value = '';
			which.submit();
		}//end if 
		else {
			which.submit();
		}//end else
	}// end try
	catch(err) {
		if (document.searchform.q.value == document.searchform.q.defaultValue) {
    	    document.searchform.q.value = '';
      		document.searchform.submit();
    	}//end if 
    	else {
        	document.searchform.submit();
    	}//end else
	}//end catch
}//end validateSearch


//Hide Show functionality - 

// Toggle Show	 
function toggle_show(toggleId,detailsId,toggleShow,toggleHide) {
		var someDetails = document.getElementById(detailsId);
		someDetails.style.visibility="visible";
		someDetails.style.display="block";
		
		var someToggle = document.getElementById(toggleId);
		var hrefValue = "javascript:toggle_hide('"+toggleId+"','"+detailsId+"','"+toggleShow+"','"+toggleHide+"');";
		
		someToggle.setAttribute('href', hrefValue);
		someToggle.innerHTML = toggleHide;
}/// Show Details	

// Toggle Hide	
function toggle_hide(toggleId,detailsId,toggleShow,toggleHide) {
		var someDetails = document.getElementById(detailsId);
		someDetails.style.visibility="hidden";
		someDetails.style.display="none";
						
		var someToggle = document.getElementById(toggleId);
		var hrefValue = "javascript:toggle_show('"+toggleId+"','"+detailsId+"','"+toggleShow+"','"+toggleHide+"');";
		
		someToggle.setAttribute('href', hrefValue);
		someToggle.innerHTML = toggleShow;
}/// Hide Details



//this function hides all other "shown-content" and just displays the one selected, as opposed to the functions above which leave content shown if others have also been selected
function toggle_showOne(toggleId,detailsId) {
	
	try {
	
			details = document.getElementById("body");
			itemData = details.getElementsByTagName("div");
			
			//this loop looks for any other blocks of content that are showing ("shown-content") and then hides them. 			
			for(var h=0; h<itemData.length; h++){
				var categoryClass;
				
				
				categoryClass = getClassSafely(itemData[h]);
			
				if(categoryClass == "show-content") {
					
					setClassSafely(itemData[h], "hidden-content");
				
				}//end if
	
			}//end for
				
		
			hoverData = details.getElementsByTagName("a");
			
			//this loop looks for any other a tags that are highlighted (background color) and makes them plain (no background color)
			for(var k=0; k<hoverData.length; k++){
				var titleClass;
				
				
				titleClass = getClassSafely(hoverData[k]);
			
				if(titleClass == "down-button") {
					
					setClassSafely(hoverData[k], "plain");
					
				
				}//end if
	
			}//end for
			
		//this sets the appropriate block of content to show and highlights the appropriate link
		var someDetails = document.getElementById(detailsId);
		setClassSafely(someDetails, "show-content");
		
		var someToggle = document.getElementById(toggleId);
		setClassSafely(someToggle, "down-button");	
		
	}
	
	catch(e){
		//do  nothing
	}
		
		
}

function injectText(bcxtitle, bcxdesc) {
     
        var eleTitle = document.getElementById("bcTitle");
        var eleDesc = document.getElementById("bcDescription");
        
       eleTitle.innerHTML = bcxtitle;
       eleDesc.innerHTML = bcxdesc;
       
	   
	   setClassSafely(eleTitle, "shown-item");
	   setClassSafely(eleDesc, "shown-item");
	   
    }


function setClassSafely(element, value) {
	//get & check ClassName (IE)
	var theClass = element.getAttribute("className");
	//set className
	if (theClass) {
		element.setAttribute("className", value); 
		//debug("Yes className Set to: "+theClass);
	}//end if
	
	//Set class
	else { 
		element.setAttribute("class", value); 
		//debug("NO className Set, but class Set to: "+value);
	}//end else
}//end of setClassSafely

function getClassSafely(element) {
	//get & check ClassName (IE)
	var theClass = element.getAttribute("className");
	//set className
	if (theClass) {
		//debug("Yes className is: "+theClass);
	}//end if
	
	//Set class
	else {
		theClass = element.getAttribute("class");
		//debug("NO className, but class is: "+theClass); 
		
	}//end else
	return theClass;
}//end getClassSafely
