// JavaScript Document

/* ----- Front page tab initialized ----- */

	// hide all the content initially
	function hidetabs() {
		tabc.style.display = "none";
		tabp.style.display = "none";
		tabj.style.display = "none";
		tabe.style.display = "none";
		tabw.style.display = "none";
		tabo.style.display = "none";
	}
	
	// show the content as selected, or from the random function when the page loaded
	function showtab(tab_id) {
		switch(tab_id) {
			case 1:
			tabc.style.display = "block";
			break;
			case 2:
			tabp.style.display = "block";
			break;
			case 3:
			tabj.style.display = "block";
			break;
			case 4:
			tabe.style.display = "block";
			break;
			case 5:
			tabw.style.display = "block";
			break;
			case 6:
			tabo.style.display = "block";
			break;
			default:
			tabc.style.display = "block";
			break;
		}
	}
	
	// set the navigation tab to be "on" - it 'blurs' to stop any browser halo around the button
	function ontabs(tab_id) {
		switch(tab_id) {
			case 1:
			tabone.src="_assets/_img/page_elements/tab_classical_on.gif";
			tabone.blur();
			break;
			case 2:
			tabtwo.src="_assets/_img/page_elements/tab_poprock_on.gif";
			tabtwo.blur();
			break;
			case 3:
			tabthree.src="_assets/_img/page_elements/tab_jazz_on.gif";
			tabthree.blur();
			break;
			case 4:
			tabfour.src="_assets/_img/page_elements/tab_educational_on.gif";
			tabfour.blur();
			break;
			case 5:
			tabfive.src="_assets/_img/page_elements/tab_worship_on.gif";
			tabfive.blur();
			break;
			case 6:
			tabsix.src="_assets/_img/page_elements/tab_other_on.gif";
			tabsix.blur();
			break;
		}
	}
	
	// set the navigation tab to be "over"
	function overtabs(tab_id) {
		if(tab_id != ontab) { // if it's not a selected tab, carry on
			switch(tab_id) {
				case 1:
				tabone.src="_assets/_img/page_elements/tab_classical_over.gif";
				break;
				case 2:
				tabtwo.src="_assets/_img/page_elements/tab_poprock_over.gif";
				break;
				case 3:
				tabthree.src="_assets/_img/page_elements/tab_jazz_over.gif";
				break;
				case 4:
				tabfour.src="_assets/_img/page_elements/tab_educational_over.gif";
				break;
				case 5:
				tabfive.src="_assets/_img/page_elements/tab_worship_over.gif";
				break;
				case 6:
				tabsix.src="_assets/_img/page_elements/tab_other_over.gif";
				break;
			}
		}
	}
	
	// set the navigation tab to be its original state
	function outtabs(tab_id) {
		if(tab_id != ontab) { // if it's not a selected tab, carry on
			switch(tab_id) {
				case 1:
				tabone.src="_assets/_img/page_elements/tab_classical.gif";
				break;
				case 2:
				tabtwo.src="_assets/_img/page_elements/tab_poprock.gif";
				break;
				case 3:
				tabthree.src="_assets/_img/page_elements/tab_jazz.gif";
				break;
				case 4:
				tabfour.src="_assets/_img/page_elements/tab_educational.gif";
				break;
				case 5:
				tabfive.src="_assets/_img/page_elements/tab_worship.gif";
				break;
				case 6:
				tabsix.src='_assets/_img/page_elements/tab_other.gif';
				break;
			}
		}	
	}

	// called from home.welcome - views/page_welcome.php
	
	function tabdisplay(tab_id) {
		ontab = tab_id; // set the id of the newly selected item (this stops mouseover and mouseout actions on this id)
		hidetabs(); // hide all content
		showtab(tab_id); // show the selected content
		for(i=0;i<=6;i++) { // set all nav tabs back to original state
			outtabs(i);
		}
		ontabs(tab_id); // set the selected nav tab to to be "on"
	}


/* ----- End of Front page ----- */