// JavaScript Document



function updatePageTabs(tabState)
{
	//alert("Working!");
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	else
	  {
	  alert("Your browser does not support XMLHTTP!");
	  }
	xmlhttp.open("POST","/includes/tracktabs.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send("pagesTab=" + tabState);
}

function updateArticleTabs(tabState)
{
	//alert("Working!");
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	else
	  {
	  alert("Your browser does not support XMLHTTP!");
	  }
	xmlhttp.open("POST","/includes/tracktabs.php",true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send("articlesTab=" + tabState);
}




function pageLoad() {
	//alert("testing");
	MM_preloadImages('/images/main/rss_icon_over_01.jpg','/images/main/start_button_over_01.jpg','/images/main/icon_home_over_01.gif','/images/main/icon_choosing_over_01.gif','/images/main/icon_types_over_01.gif','/images/main/icon_glossary_over_01.gif','/images/main/icon_calculator_over_02.gif','/images/main/icon_list_over_01.gif','/images/main/icon_articles_over_01.gif','/images/main/twitter_box_button_over_01.gif');
}


function initializeTabs(var1,var2) {
	//alert(var1 + " " + var2);
	switch (var1) {
		case "Term": pagesTermOn(); pagesWholeOff(); pagesUniversalOff(); pagesVariableOff(); break;
		case "Whole": pagesTermOff(); pagesWholeOn(); pagesUniversalOff(); pagesVariableOff(); break;
		case "Universal": pagesTermOff(); pagesWholeOff(); pagesUniversalOn(); pagesVariableOff(); break;
		case "Variable": pagesTermOff(); pagesWholeOff(); pagesUniversalOff(); pagesVariableOn(); break;
	}
	switch (var2) {
		case "New": articlesNewOn(); articlesTermOff(); articlesWholeOff(); articlesUniversalOff(); break;
		case "Term": articlesNewOff(); articlesTermOn(); articlesWholeOff(); articlesUniversalOff(); break;
		case "Whole": articlesNewOff(); articlesTermOff(); articlesWholeOn(); articlesUniversalOff(); break;
		case "Universal": articlesNewOff(); articlesTermOff(); articlesWholeOff(); articlesUniversalOn(); break;
	}
}


function pagesTermPressed() {
	pagesTermOn();
	pagesWholeOff();
	pagesUniversalOff();
	pagesVariableOff();
	updatePageTabs("Term");
}

function pagesWholePressed() {
	pagesTermOff();
	pagesWholeOn();
	pagesUniversalOff();
	pagesVariableOff();
	updatePageTabs("Whole");
}

function pagesUniversalPressed() {
	pagesTermOff();
	pagesWholeOff();
	pagesUniversalOn();
	pagesVariableOff();
	updatePageTabs("Universal");
}

function pagesVariablePressed() {
	pagesTermOff();
	pagesWholeOff();
	pagesUniversalOff();
	pagesVariableOn();
	updatePageTabs("Variable");
}

function articlesNewPressed() {
	articlesNewOn();
	articlesTermOff();
	articlesWholeOff();
	articlesUniversalOff();
	updateArticleTabs("New");
}

function articlesTermPressed() {
	articlesNewOff();
	articlesTermOn();
	articlesWholeOff();
	articlesUniversalOff();
	updateArticleTabs("Term");
}

function articlesWholePressed() {
	articlesNewOff();
	articlesTermOff();
	articlesWholeOn();
	articlesUniversalOff();
	updateArticleTabs("Whole");
}

function articlesUniversalPressed() {
	articlesNewOff();
	articlesTermOff();
	articlesWholeOff();
	articlesUniversalOn();
	updateArticleTabs("Universal");
}


function pagesTermOn() {
	document.getElementById("button_pages_term").style.backgroundColor = "#798084";
	document.getElementById("button_pages_term").style.color = "#ffffff";
	document.getElementById("pages_list_term").style.display = "block";
}

function pagesTermOff() {
	document.getElementById("button_pages_term").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_pages_term").style.color = "#393939";
	document.getElementById("pages_list_term").style.display = "none";
}

function pagesWholeOn() {
	document.getElementById("button_pages_whole").style.backgroundColor = "#798084";
	document.getElementById("button_pages_whole").style.color = "#ffffff";
	document.getElementById("pages_list_whole").style.display = "block";
}

function pagesWholeOff() {
	document.getElementById("button_pages_whole").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_pages_whole").style.color = "#393939";
	document.getElementById("pages_list_whole").style.display = "none";
}

function pagesUniversalOn() {
	document.getElementById("button_pages_universal").style.backgroundColor = "#798084";
	document.getElementById("button_pages_universal").style.color = "#ffffff";
	document.getElementById("pages_list_universal").style.display = "block";
}

function pagesUniversalOff() {
	document.getElementById("button_pages_universal").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_pages_universal").style.color = "#393939";
	document.getElementById("pages_list_universal").style.display = "none";
}

function pagesVariableOn() {
	document.getElementById("button_pages_variable").style.backgroundColor = "#798084";
	document.getElementById("button_pages_variable").style.color = "#ffffff";
	document.getElementById("pages_list_variable").style.display = "block";
}

function pagesVariableOff() {
	document.getElementById("button_pages_variable").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_pages_variable").style.color = "#393939";
	document.getElementById("pages_list_variable").style.display = "none";
}


function articlesNewOn() {
	document.getElementById("button_articles_new").style.backgroundColor = "#798084";
	document.getElementById("button_articles_new").style.color = "#ffffff";
	document.getElementById("articles_list_new").style.display = "block";
}

function articlesNewOff() {
	document.getElementById("button_articles_new").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_articles_new").style.color = "#393939";
	document.getElementById("articles_list_new").style.display = "none";
}

function articlesTermOn() {
	document.getElementById("button_articles_term").style.backgroundColor = "#798084";
	document.getElementById("button_articles_term").style.color = "#ffffff";
	document.getElementById("articles_list_term").style.display = "block";
}

function articlesTermOff() {
	document.getElementById("button_articles_term").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_articles_term").style.color = "#393939";
	document.getElementById("articles_list_term").style.display = "none";
}

function articlesWholeOn() {
	document.getElementById("button_articles_whole").style.backgroundColor = "#798084";
	document.getElementById("button_articles_whole").style.color = "#ffffff";
	document.getElementById("articles_list_whole").style.display = "block";
}

function articlesWholeOff() {
	document.getElementById("button_articles_whole").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_articles_whole").style.color = "#393939";
	document.getElementById("articles_list_whole").style.display = "none";
}

function articlesUniversalOn() {
	document.getElementById("button_articles_universal").style.backgroundColor = "#798084";
	document.getElementById("button_articles_universal").style.color = "#ffffff";
	document.getElementById("articles_list_universal").style.display = "block";
}

function articlesUniversalOff() {
	document.getElementById("button_articles_universal").style.backgroundColor = "#bbbcbc";
	document.getElementById("button_articles_universal").style.color = "#393939";
	document.getElementById("articles_list_universal").style.display = "none";
}

function submitForm()
{
	document.search.submit();
}