// JavaScript Document

function scrollTab(selectedTab,objectId) {
	
	//deactivate current tab
	document.getElementById('scroll_tab_selected').setAttribute("class", "scroll_box_tabs_text");
	
	//set current tab to id name to a regular tab
	document.getElementById('scroll_tab_selected').setAttribute("id", "scroll_tab");
	
	//set the selected tab id to selected
	document.getElementById(selectedTab).parentNode.setAttribute("id", "scroll_tab_selected");
	
	//show the selected tab is active
	document.getElementById('scroll_tab_selected').setAttribute("class", "scroll_box_tabs_selected");

	//selectedTab is the element that was clicked for query and run through a for loop
	
	//build our html to populate

	ColdFusion.navigate('/includes/categoryTags.cfm?mode=' + selectedTab + '&objectid=' + objectId,'scroll_box_scroll_layer');
	
	if (selectedTab == 'latestnews') {
		document.getElementById('text_footer_bar_link').href = "/index.cfm?objectid=52551750-6149-11E0-BB14000C296BA163";	
	}
	if (selectedTab == 'blog') {
		document.getElementById('text_footer_bar_link').href = "/index.cfm?objectid=20E329A0-6149-11E0-BB14000C296BA163";	
	}
	
}


function findActiveTab(thisDefault,thisObj) {
	var thisURL = window.location.toString();
	var thisQuery = thisURL.split("?");
	var params = thisQuery[1].split("&");
	//alert(params.length);
	for (i=0; i < params.length; i++) {
		testPair = params[i].split("=");
		//alert(testPair[0]);
		if (testPair[0] == 'tab') {
			var thisTab = testPair[1]	
		}
	}
	if (thisObj && thisTab) {
		scrollTab(thisTab,thisObj);
	} else {
		scrollTab(thisDefault,thisObj);
	}
}
