function signout()
{
	if (!confirm('ยืนยันการออกจากระบบ'))
		return;
	window.location.href = '../webopac/signout.php';
	
}

// ADMIN MENU
var _old_id = '';
function showMenu(id)
{
	// hide old id
	//hideMenu(_old_id);
	_old_id = id;
	var o = document.getElementById('submenu'+id);
	if (o == null)
		return;
	var i = id;
	oMain = document.getElementById('adminmenu'+i);
	oSub =  document.getElementById('submenu'+i);
	if (oMain == null || oSub == null)
		alert('sorry');
	oSub.style.left = oMain.offsetLeft + 'px';
	oSub.style.top = (oMain.offsetTop + oMain.offsetHeight + 1) + 'px';

	o.style.display = 'block';
	
}

function hideMenu(id)
{
	var o = document.getElementById('submenu'+id);
	if (o == null)
		return;
	o.style.display = 'none';	
}

function hideSubmenu()
{
	hideMenu(_old_id);
}

// Window properties  v1.1
// documentation: http://www.dithered.com/javascript/window_properties/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


function getInnerWidth(win) {
  var winWidth;
  if (win.innerWidth) {
    winWidth = win.innerWidth;
  }
  else if (win.document.documentElement && win.document.documentElement.clientWidth) {
    winWidth = win.document.documentElement.clientWidth;
  }
  else if (document.body) {
    winWidth = win.document.body.clientWidth;
  }
  return winWidth;
}

function getInnerHeight(win) {
  var winHeight;
  if (win.innerHeight) {
    winHeight = win.innerHeight;
  }
  else if (win.document.documentElement && win.document.documentElement.clientHeight) {
    winHeight = win.document.documentElement.clientHeight;
  }
  else if (win.document.body) {
    winHeight = win.document.body.clientHeight;
  }
  return winHeight;
}

function getScrollTop(win) {
   var scrollTop = 0;
   if (win.pageYOffset) {
      scrollTop = win.pageYOffset;
   }
   else if (win.document.documentElement && win.document.documentElement.scrollTop) {
      scrollTop = win.document.documentElement.scrollTop;
   }
   else if (win.document.body) {
      scrollTop = win.document.body.scrollTop;
   }
   return scrollTop;
}

function getScrollLeft(win) {
   var scrollLeft = 0;
   if (win.pageXOffset) {
      scrollLeft = win.pageXOffset;
   }
   else if (win.document.documentElement && win.document.documentElement.scrollLeft) {
      scrollLeft = win.document.documentElement.scrollLeft;
   }
   else if (win.document.body) {
      scrollLeft = win.document.body.scrollLeft;
   }
   return scrollLeft;
}
