function printWindow() {
  Browser = parseInt(navigator.appVersion);
  if (Browser >= 4) window.print();
}
  
function confirmLink(theLink, theText) {
  // Confirmation is not required if the browser is Opera (crappy js implementation)
  if (typeof(window.opera) != 'undefined') {return true;}
  var is_confirmed = confirm(theText);
  if (is_confirmed) {theLink.href += '&is_js_confirmed=1';}
  return is_confirmed;
}

function imgXY(imgID) {
  /* This function returns the upperleft x,y coordinates of the specified image */
  var XY = new Object();
  var imgObj = document.images[imgID];
  if (imgObj == null) return false;
  if (document.layers) {
		XY.x = eval(imgObj).x;
		XY.y = eval(imgObj).y;
  }else{
		var x,y, tempEl;
		x = eval(imgObj).offsetLeft;
		y = eval(imgObj).offsetTop;
		tempEl = eval(imgObj).offsetParent;
	  while (tempEl != null) {
	  	x += tempEl.offsetLeft;
			y += tempEl.offsetTop;
	  	tempEl = tempEl.offsetParent;
	  }
		XY.x = x;
		XY.y = y;
  }
  return XY;
}

function displayMenu(menu) {
	var imgPos; 
	imgPos = imgXY(menu); 
	if (imgPos){
  	showPermPanel('Main',imgPos.x, imgPos.y);
	}	
} 

function showDiv(doshow, div) {
  if(doshow){
  	document.getElementById(div).style.display=''
  }else{
  	document.getElementById(div).style.display='none'
  }  	
}

function buttonDisable(id) {
	var btn;
	btn = document.getElementById(id);
	if(btn){
    btn.style.backgroundColor='gray';
    btn.style.cursor='default';
    btn.disabled='true'
	}
}

function buttonEnable(id) {
	var btn;
	btn = document.getElementById(id);
	if(btn){
    btn.style.backgroundColor='red';
    btn.style.cursor='point';
    btn.disabled='false'
	}
}

