function version()
{
alert('Utilities version: WN011912v');
}

function reload()
{
window.location.reload(location.href); 
}

//-- Begin GetKey--
var blnDOM = false, blnIE4 = false, blnNN4 = false; 

if (document.layers) blnNN4 = true;
else if (document.all) blnIE4 = true;
else if (document.getElementById) blnDOM = true;

document.onkeyup = getKeycode;
if (blnNN4) document.captureEvents(Event.KEYDOWN);

	var blank="key:"
function getKeycode(e)
{
	var code;
  if (blnNN4)
  {
    var code = e.which
  }
  if (blnDOM)
  {
    var code = e.which
  }
  if (blnIE4)
  {
    var code= event.keyCode
  }
	blank = blank+code;
	if (code==46){clear();}
	if (code==8){clear();}
	if (code==37){clear();lft();}
	if (code==39){clear();rt();}
	
	if (blank=='key:6779'){clear();on('coords');}
	if (blank=='key:78796779'){clear();off('coords');}
	if (blank=='key:8372'){clear();on('showco');document.getElementById('in').focus();}
	if (blank=='key:78798372'){clear();off('showco');document.getElementById('in').blur();}
	if (blank=='key:7765'){clear();on('placemnt');}
	if (blank=='key:78797765'){clear();off('placemnt');}
	if (blank=='key:677884'){clear();on('counter');}
    if (blank=='key:7879677884'){clear();off('counter');}
	
	if (blank=='key:8269'){clear();reload();}
	if (blank=='key:8669'){clear();version();}
	if (blank=='key:6571'){clear();age();}
		
	if (blank=='key:7579797632728572'){
		clear();
		alert('Thanks for checking this out. I had fun creating it!\n\nDid you try dragging the secret menus around? (Only works with PC mouse so far..) Next, I hope to let you drag items including pictures wherever you want, then let the browser remember positions for your next visit. Then maybe I\'ll let you add comments. \n\nFor now, send me an old fashioned text or email to let me know what you think!');}
	
	if (blank=='key:87878382'){
		clear();
		alert('co\nnoco\nsh\nnosh\nma\nnoma\nve\nag\ncnt (homepage only)\nnocnt\nre\nromeo\nkool huh');}
	
	if (blank=='key:8279776979'){
		clear();	
		location.href='http://www.microntn.com/Peter/album1.php';}
		
	document.Coordinates.keystroke.value = blank;
}

function clear(){blank="key:"; document.getElementById('in').value="";}

//-- End GetKey--
	
	
//-- Begin Drag/Coordinates/Placement--
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
var tempX = 20;
var tempY = 20;

var mousex = 0;
var mousey = 0;
var grabx = 0;
var graby = 0;
var orix = 0;
var oriy = 0;
var elex = 0;
var eley = 0;
var algor = 0;

var dragobj = null;

function falsefunc() { return false; } // used to block cascading events

function init()
{
  document.onmousemove = update; // update(event) implied on NS, update(null) implied on IE
  update();
}

function getMausXY(e) // works on IE6,FF,Moz,Opera7
{ 
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

  if (e)
  { 
    if (e.pageX || e.pageY)
    { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
      mousex = e.pageX;
      mousey = e.pageY;
      algor = '[e.pageX]';
      if (e.clientX || e.clientY) algor += ' [e.clientX] '
    }
    else if (e.clientX || e.clientY)
    { // works on IE6,FF,Moz,Opera7
      mousex = e.clientX + document.body.scrollLeft;
      mousey = e.clientY + document.body.scrollTop;
      algor = '[e.clientX]';
      if (e.pageX || e.pageY) algor += ' [e.pageX] '
    }  
  }


if (IE) {
tempX = event.clientX;
tempY = event.clientY;
}
if (!IE){
tempX = e.clientX;
tempY = e.clientY;
}

}

function update(e)
{
  getMausXY(e); // NS is passing (event), while IE is passing (null)
  //document.Coordinates.keystroke.value = blank;
  document.getElementById('span_browser').innerHTML = navigator.appName;
  document.getElementById('span_winevent').innerHTML = window.event ? window.event.type : '(na)';
  document.getElementById('span_autevent').innerHTML = e ? e.type : '(na)';
  document.getElementById('span_mousex').innerHTML = mousex;
  document.getElementById('span_mousey').innerHTML = mousey;
  document.getElementById('span_grabx').innerHTML = grabx;
  document.getElementById('span_graby').innerHTML = graby;
  document.getElementById('span_orix').innerHTML = orix;
  document.getElementById('span_oriy').innerHTML = oriy;
  document.getElementById('span_elex').innerHTML = elex;
  document.getElementById('span_eley').innerHTML = eley;
  document.getElementById('span_algor').innerHTML = algor;
  document.getElementById('span_dragobj').innerHTML = dragobj ? (dragobj.id ? dragobj.id : 'unnamed object') : '(null)';
  document.Coordinates.MouseX.value = tempX;
  document.Coordinates.MouseY.value = tempY;
}

function grab(context)
{
  document.onmousedown = falsefunc; // in NS this prevents cascading of events, thus disabling text selection
  dragobj = context;
  dragobj.style.zIndex = 120; // move it to the top
  document.onmousemove = drag;
  document.onmouseup = drop;
  grabx = mousex;
  graby = mousey;
  elex = orix = dragobj.offsetLeft;
  eley = oriy = dragobj.offsetTop;
  update();
}

function drag(e) // parameter passing is important for NS family 
{
  if (dragobj)
  {
    elex = orix + (mousex-grabx);
    eley = oriy + (mousey-graby);
    dragobj.style.position = "absolute";
    dragobj.style.left = (elex).toString(10) + 'px';
    dragobj.style.top  = (eley).toString(10) + 'px';
  }
  update(e);
  return false; // in IE this prevents cascading of events, thus text selection is disabled
}

function drop()
{
  if (dragobj)
  {
    
    dragobj = null;
  }
  update();
  document.onmousemove = update;
  document.onmouseup = null;
  document.onmousedown = null;   // re-enables text selection on NS
}
//-- End Drag/Coordinates/Placement--

var obj=null;
 
function on(obj)
{
 document.getElementById(obj).style.visibility="visible";
}

function off(obj)
{var obj=document.getElementById(obj);
 obj.style.visibility="hidden";
}
