/*******************************************************
This file contains scripts for the mouse-over button tabs,
as well as providing functionality to the drop down navigation lists.
***************************************************/

// variable declaration
		if(document.images){ 
			//mods tab
			var mods_tab = new Image();
			var mods_tab_lit = new Image();
			mods_tab.src = "../images/tab_mods.gif";
			mods_tab_lit.src = "../images/tab_mods_mo.gif";						

			//tools tab
			var tools_tab = new Image();
			var tools_tab_lit = new Image();
			tools_tab.src = "../images/tab_tools.gif";
			tools_tab_lit.src = "../images/tab_tools_mo.gif";
			
			//tech tab
			var tech_tab = new Image();
			var tech_tab_lit = new Image();
			tech_tab.src = "../images/tab_tech.gif";
			tech_tab_lit.src = "../images/tab_tech_mo.gif";
			
			//files tab
			var files_tab = new Image();
			var files_tab_lit = new Image();
			files_tab.src = "../images/tab_files.gif";
			files_tab_lit.src = "../images/tab_files_mo.gif";
			
			//pics tab
			var pics_tab = new Image();
			var pics_tab_lit = new Image();
			pics_tab.src = "../images/tab_images.gif";
			pics_tab_lit.src = "../images/tab_images_mo.gif";
			
		}		
		
	// mods button functions
		function over_mods_button(){
			if(document.images){
				document["modsTab"].src = mods_tab_lit.src;
			}
		}		
		function restore_mods_button(){
			if(document.images){
				document["modsTab"].src = mods_tab.src;
			}
		}
		
	// tool button functions
		function over_tools_button(){
			if(document.images){
				document["toolsTab"].src = tools_tab_lit.src;
			}
		}		
		function restore_tools_button(){
			if(document.images){
				document["toolsTab"].src = tools_tab.src;
			}
		}
		
	// tech button functions
		function over_tech_button(){
			if(document.images){
				document["techTab"].src = tech_tab_lit.src;
			}
		}		
		function restore_tech_button(){
			if(document.images){
				document["techTab"].src = tech_tab.src;
			}
		}
		
	// files button functions
		function over_files_button(){
			if(document.images){
				document["filesTab"].src = files_tab_lit.src;
			}
		}		
		function restore_files_button(){
			if(document.images){
				document["filesTab"].src = files_tab.src;
			}
		}
			
	// pics button functions
		function over_pics_button(){
			if(document.images){
				document["picsTab"].src = pics_tab_lit.src;
			}
		}		
		function restore_pics_button(){
			if(document.images){
				document["picsTab"].src = pics_tab.src;
			}
		}


	// navigation for tech section 
	function loadTechPage(i){
		list = new Array(null, "tech.html", null, "bin_srch.html", 
		"es_format.html","tute.html", "tweaks.html", "gmst.html", "dirt.html");
		if (i>0){ // do nothing if 1st or 3rd list item is selected		
		  if(i<2){
			window.location=(list[i]);
		  }
		  else if(i>2)
		    	window.location=(list[i]);
		}
			
	}

	function writeListBox() {
	document.write('<form name="select" action="" ><select name="list" onchange="loadTechPage(this.selectedIndex)"><option>[Navigation]</option><option>Back to Tech</option><option>----------------------------</option><option>Binary Search</option><option>ESM File Format</option><option>Programming Tutorial</option><option>Configuration &nbsp;Tweaks</option><option>What the hell is a GMST?</option><option>Dirty Saves: Causes &amp; Cures</option></select></form>');
	}
	
	/**
	*	Nav 4.x resize bug fix reproduced from http://andromeda.rutgers.edu/~ehrlich/465/INDEXTXT.htm
	*/
	if (document.layers) {
	            origWidth = window.innerWidth
	            origHeight = window.innerHeight
	      }
	
	      function resizeFix() {
	      	if (document.layers) {
	      		if (window.innerWidth != origWidth || window.innerHeight != origHeight) {
	            	window.location.reload();
	            }
	      	}
      	}
      	window.onresize = resizeFix;  //override the standard onresize function
      	
 
// email.js beta
// protected email script for Mythic

var m_ = "mailto:";
var a_ = "@";
var dom = "mwmythicmods.com";

function mail(name, display)
{
   document.write('<a href="mailto:' + name + a_ + dom + '">' + display + '</a>');

}
