// JavaScript Document
var menu_array = new Array();
var menunum_array = new Array();
	
var which_menu = "global";
var last_menu = "global";
	last_menu = "clean_slate";
var last_count = "global";
var item_indicator = "global";
var wasaclick = "global";

var versionChecked = "global";


function colorIn(the_object){
	the_area = document.getElementById(the_object);
//	alert(the_area);
	var bit = the_object.substr(0,3);
	if (bit == "dro"){
	the_area.style.backgroundColor = "FA9E3D";
//	FBECA5, EEEAB7
	} else {
	the_area.style.backgroundColor = "FBECA5";	
	}
}

function colorOut(the_object){
	the_area = document.getElementById(the_object);
	var bit = the_object.substr(0,3);
	if (bit == "dro"){
	the_area.style.backgroundColor = "FBECA5";
	} else {
	the_area.style.backgroundColor = "";
	}
}

function showItems(layerId, n){
	var which_menu = layerId.substr(9, 1);
	if ((which_menu != last_menu) && (last_menu != "clean_slate")){
		hideItems("dropdown_" + last_menu, last_count, 1);
	}
	var y_value = checkBrowser();
	for (i = 0; i <= n; i++){
		var eyetem = String(layerId + "_" + i);
		var layer = document.getElementById(eyetem);
		layer.style.visibility = "visible";
		layer.style.top = y_value + (i * 17);
	}
	last_menu = which_menu;
	last_count = n;
}


function whats_up(){
	alert("menu_array = " + menu_array +  ",\nmenunum_array = " + menunum_array);
}


function hideItems(layerId, n, x){
	for (i = 0; i <= n; i++){
		var eyetem = String(layerId + "_" + i);
		var layer = document.getElementById(eyetem);
		layer.style.visibility = "hidden";
	}
	if (x == 1){
		last_menu = "clean_slate";
	}
}


function checkBrowser(){
	var browser = new Object();
	browser.version = parseInt(navigator.appVersion);
	browser.isNetscape = false;
	browser.isMicrosoft = false;
	if (navigator.appName.indexOf("Microsoft") != -1){
		browser.isMicrosoft = true;
		indicator = 115;
	} else if (navigator.appName.indexOf("Netscape") != -1){
		browser.isNetscape = true;
		if (navigator.platform == "MacPPC"){
			var indicator = 125;		
		} else {
			var indicator = 119;
		}
	} else if (navigator.appName.indexOf("Safari") != -1){
		browser.isSafari = true;
		var indicator = 119;
	}
	return Number(indicator);
}


function newWindow(the_goal, b, c, d){
	var vertical_space = screen.availHeight;
	var horizontal_space = screen.availWidth;	
	if (vertical_space < c){
		c = (vertical_space - 60);
	} else {
// nothing happens;	
	}
	if (horizontal_space < b){
		b = (horizontal_space - 50);
	} else {
// nothing happens;	
	} if (d == 1){
	window.open(the_goal, "", "width=" + b + ",height=" + c + ",status=yes,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes");
	} else {
	window.open(the_goal, "", "width=" + b + ",height=" + c + ",status=yes,resizable=yes,scrollbars=yes");
	}
}



function newMapWindow(the_goal, b, c, d){
//	alert("file to be opened is " + the_goal);	
	var vertical_space = screen.availHeight;
	var horizontal_space = screen.availWidth;	
	if (vertical_space < c){
		c = (vertical_space - 60);
	} else {
// nothing happens;	
	}
	if (horizontal_space < b){
		b = (horizontal_space - 50);
	} else {
// nothing happens;	
	} if (d == 1){
	window.open(the_goal, "", "width=" + b + ",height=" + c + ",status=yes,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes");
	} else {
	window.open(the_goal, "", "width=" + b + ",height=" + c + ",status=yes,resizable=yes,scrollbars=yes");
	}
}




function go_to(x) {
	var the_URL = String("journal/" + x + ".pdf");
	window.location = the_URL;
}


function calculate_fs(x, y){
	var modem_speed = y;
	var the_answer = Math.round((x * 8)/((modem_speed/2) * 60));
	return the_answer;
}


function showItem(x, z){
		if (wasaclick == 1){
			var getridof = item_indicator;
			item_indicator = 0;		
			hideItem(getridof);
		}
		var eyetem = x;
		var layer = document.getElementById(eyetem);
		layer.style.visibility = "visible";
		if (z == 1){
			item_indicator = x;
		} else {
			item_indicator = 0;
		}

}


function hideItem(y){
		if (item_indicator != 0){
			wasaclick = 1;
		} else {
			var eyetem = y;
			var layer = document.getElementById(eyetem);
			layer.style.visibility = "hidden";
			wasaclick = 0;
		}
}

function layerSwap(x){
	var eyetem = x;
	var numba = eyetem.slice(5,6);
	var othereyetem = "layer" + (eval(numba) + 5);
	var newLayer = document.getElementById(othereyetem);
	var oldLayer = document.getElementById(eyetem);
	oldLayer.style.visibility = "hidden";		
	newLayer.style.visibility = "visible";
}


function layerUnswap(x){
	var eyetem = x;
	var numba = eyetem.slice(5,7);
	var othereyetem = "layer" + (eval(numba) - 5);
	var newLayer = document.getElementById(othereyetem);
	var oldLayer = document.getElementById(eyetem);
	oldLayer.style.visibility = "hidden";		
	newLayer.style.visibility = "visible";
}



function currentYear(){
//alert("it's working");
	d = new Date();
	var theYear = d.getFullYear();
	return theYear;	
}

function googleInfoSend(){
//alert ("function called");
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));


var pageTracker = _gat._getTracker("UA-5240460-2");
pageTracker._trackPageview();
//alert ("variable is " + gaJsHost);
//alert ("function called");
}




function F_call(){
alert("It's working!");
}


function flickerThis(x){

//		window.setTimeout(500);
for (i = 0; i <= 21; i++){

		var eyetem = String(x);
		
		var wordInQuestion = document.getElementById(eyetem);
		if (wordInQuestion.style.visibility == "visible"){
			wordInQuestion.style.visibility = "hidden";
		} 
		else {
			wordInQuestion.style.visibility = "visible";
		}
		alert(eyetem);

	}
	
}






checkBrowser();
//googleInfoSend();
