// Nav Menu
function sad_browser() {
		open('update_browser.php');
}

// New Rollover  Streamlined.  
function tdRoll_old(evt,state) {
	var el = evt.target || evt.srcElement;
	while (el && (!el.tagName||el.tagName.toLowerCase()!='td')) el=el.parentNode;
	if (!el) return;
   if(el.className == "cur") return;
	el.className = state?'on':'off';
}

// New Rollover
function tdRoll(e,state) {
/*   if (state) {
      e.style.backgroundColor = "#c4c6cb";
   } else {
      e.style.backgroundColor = "#ffffff";
   } */
//   if(e.className == "cur") return;
//	e.className = state?'on':'off';
     e.style.backgroundColor = state?'#E6e6e6':'#ffffff';
     e.style.color = state?'#000000':'#707070';
}

function draw_div(menu_name, on_off) {
	if (document.getElementById(menu_name)) { // DOM3 = IE5, NS6
		 div_obj = document.getElementById(menu_name);
		 div_obj.style.visibility = on_off;
	} else if (!document.getElementById){
		sad_browser();
	}
}

function show_layer(name,elements,element_set){
	for(i=1;i<=elements;i++){
		tmp = element_set + i;
		if ( tmp == name){
			draw_div(name, 'visible');
		} else {
			draw_div(tmp, 'hidden');
		}
	}
}

// Image Preloader
function preloadImages() {
  var preImages=new Array();
  var tmp;
	for (i=0; i < preloadImages.arguments.length; i++){
      preImages[i]=document.createElement('img');
//		preImages[i]=new Image()
		preImages[i].src=preloadImages.arguments[i]
	}
}

// Window Popup
function popupWin(page, width, height) {
	winprops = "toolbar=0,status=1,scrollbars=1,resizable=1,width=" + width + ", height=" + height;
	popup = window.open( page, "popup", winprops);
	popup.focus();
//   return true;
}

function popupWinReturn(page, width, height) {
	winprops = "toolbar=0,status=1,scrollbars=1,resizable=1,width=" + width + ", height=" + height;
	popup = window.open( page, "popup", winprops);
	popup.focus();
   return true;
}



// Only allow numbers, return, and backspace in a text field.  Usage: onKeyPress="return only_numbers(event);"
function only_numbers(event) {
	var key;
	if (window.event) {
		key = window.event.keyCode;
	} else if (event) {
		key = event.which;
	} else {
		return true;
	}
	if(key >= 48 && key <= 57 || key == 8 || key == 13) {
		return true;
	} else {
		return false;
	}
}

// Image Swapper
function glow(img) {
  if (window.glowing) deglow();
	img.src=img.src.replace('_off','_on'); 
	window.glowing=img;
}

function deglow(){ 
	if (!window.glowing) return;
	glowing.src=glowing.src.replace('_on','_off'); 
	glowing=null;
}