//thanks to Max Starkenburg for the classname function below - http://cnx.org/

function getElementsByClassName(classname){
        var rl = new Array();
        var re = new RegExp('(^| )'+classname+'( |$)');
        var ael = document.getElementsByTagName('*');
        var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
        if (document.all && !op) ael = document.all;
        for(i=0, j=0 ; i<ael.length ; i++) {
                if(re.test(ael[i].className)) {
                        rl[j]=ael[i];
                        j++;
                }
        }
        return rl;
}


function contentSwitch(anchor,id) {
	
	
		targetContent = "content"+id; 
		
		var content = new Array();
		
		content = getElementsByClassName("content");
		
		//  This hides all the content divs to begin with (resets it effectively so it can loop)
		
		for(var i=0;i<content.length;i++){

			content[i].style.display = "none";
		} 
		// Then this changes the corrent one back to visible not working in ie 
		
		document.getElementById(targetContent).style.display = "block";
		
		var link = new Array();
		
		
		link = getElementsByClassName("link");
		
		//does the same thing; changes all the anchors colors back to green
		
		for(var i=0;i<link.length;i++){
		
			link[i].style.color = "#06754a"; 
		} 
		
		// Then changes the selected anchor to orange.
		
		anchor.style.color="#ffa049";  
}




	 