// add function createTabs() to loadJS() in global_vars.js

/*
Elements to style and position:
#tab_content
*/

 //id of element to recieve content
var fsTabbedTarget = "tab_content";

//list the id's of the tab graphics
var fsTabbedButtons = new Array(
	"tuition_tab",
	"grant_tab",
	"donor_tab"
);

// list the module class names which contain the content in the order of the tabs
var fsTabbedContainers = new Array(
	"tuition_content",
	"grant_content",
	"donor_content"
);

// list the module class names which contain the more links


var fsTabbedBlocks = new Array();

function createTabs(){

	divs = document.getElementsByTagName('div');
	
	for(i=0;i<divs.length;i++){
		for(j=0;j<fsTabbedContainers.length;j++){
			if(divs[i].className == fsTabbedContainers[j]){
				fsTabbedBlocks[j] = divs[i].innerHTML;
			}
		}

		


	}

	for(i=0;i<fsTabbedButtons.length;i++){
		document.getElementById(fsTabbedButtons[i]).offSrc = document.getElementById(fsTabbedButtons[i]).src;
		document.getElementById(fsTabbedButtons[i]).onSrc = document.getElementById(fsTabbedButtons[i]).src.replace(/\.(gif|jpg)/,"_on.$1");
	}

	swapTab(0);

}


function swapTab(n){
	for(i=0;i<fsTabbedButtons.length;i++){
			document.getElementById(fsTabbedButtons[i]).src = document.getElementById(fsTabbedButtons[i]).offSrc;
	}

	if(n){
		document.getElementById(fsTabbedButtons[n]).src = document.getElementById(fsTabbedButtons[n]).onSrc;
		document.getElementById(fsTabbedTarget).innerHTML = fsTabbedBlocks[n];
	}else{
		document.getElementById(fsTabbedButtons[0]).src = document.getElementById(fsTabbedButtons[0]).onSrc;
		document.getElementById(fsTabbedTarget).innerHTML = fsTabbedBlocks[0];
	}
}
