function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}
	
	//
	function changeThumb(num){
		var thumb = document.getElementById('thumbimg');
		var full = document.getElementById('fullimg');
		
		var fullsrc = full.src.split('/');
		fullsrc = fullsrc[fullsrc.length-1];
		
		category = fullsrc.split('_')[0];
		
		var newsrc = category+'_rollover_'+num+'.jpg';
		
		document.thumb_image.src = 'suite_images/'+newsrc;
	}	


	// usage: suite-quote.cfm
	// -- hideProfileTable()
	// hide the profiles (tables with a class of "viewprofilelink") ** that are in div#sidebar
	function hideProfileTables(){
		var sidebar=getElementsByClassName('sidebar')[0];
		var profiletables = sidebar.getElementsByTagName('div');
		var showhidelinks = sidebar.getElementsByTagName('a');		

		for(var x=0; x<profiletables.length; x++){
			if( profiletables[x].className == "expandedprofile")
				profiletables[x].style.display = "none";
		}

		for(var x=0; x<showhidelinks.length; x++){
			if( showhidelinks[x].innerHTML == "Hide Profile")
				showhidelinks[x].innerHTML = "View Profile";
		}
		
	}
	
	// usage: suite-quote.cfm
	// -- showProfileTable()
	// shows the profile table ... 
	function showProfileTable(){
		var hideit=false;
		var table2show = document.getElementById(this.rel); // sample link = ... <a href="" class="viewprofilelink" rel="profileset_3">View Profile</a>
		if( table2show.style.display == "block" )
			hideit=true;

		hideProfileTables(); // hide any that might be currently visible

		if( !hideit ) {
			this.innerHTML = "Hide Profile";
			table2show.style.display = "block" //show the table we're looking for (the table has the same id as the rel attr)
		}
		return false; // don't follow the link
	}