document.onkeydown = navigateThrough;

ns4 = document.layers; 
ie4 = document.all; 
nn6 = document.getElementById && !document.all; 

function getTarget(e) 
{
    e = e || window.event;
    return e.target || e.srcElement;
}

function navigateThrough (event)
{
	if (!event.ctrlKey)
		return;
	
	var link;
	
	switch (event.keyCode ? event.keyCode : event.which ? event.which : null)
	{
		case 0x25:
			link = document.getElementById ('prevLink');
			break;
		case 0x27:
			link = document.getElementById ('nextLink');
			break;
	}
	
	if (link && link.href) 
	{
		var t = getTarget(event);
		if (t.type && (t.type == "text" || t.type === "textarea")) {
			return;
		}

		document.location = link.href;	
	}
}


function getScroll() {
	   if (document.body.scrollTop != undefined) {	// IE model
	      var ieBox = document.compatMode != "CSS1Compat";
	      var cont = ieBox ? document.body : document.documentElement;
	      return {x : cont.scrollLeft, y : cont.scrollTop};
	   }
	   else {
	      return {x : window.pageXOffset, y : window.pageYOffset};
	   }
	}

function writeContents(id, text)
{
	document.getElementById(id).innerHTML = text;
}

function show(id)
{
	if (document.getElementById(id).style.display == 'none')
    {
		document.getElementById(id).style.display = 'block';
    }
}

function hide(id)
{
	document.getElementById(id).style.display = 'none';
}

function showhide(id)
{
	if (document.getElementById(id).style.display == 'none')
    {
		document.getElementById(id).style.display = 'block';
    }
	else
	{
		document.getElementById(id).style.display = 'none';
	}
}


function showv(id)
{
	document.getElementById(id).style.visibility = 'visible';
}

function hidev(id)
{
	document.getElementById(id).style.visibility = 'hidden';
}

function showhidev(id)
{

	if (document.getElementById(id).style.visibility == 'hidden')
    {
		showv(id);
    }
	else
	{
		hidev(id);
	}
}



function showMsg(e, text) 
{ 
	showv('msgBox');
    element = document.getElementById('msgBox');
    var scroll = getScroll();
    element.style.left = (scroll.x + e.clientX) + 'px';
    element.style.top = (scroll.y + e.clientY) + 'px';
    writeContents('msgText', text); 
}
