document.onkeydown = key;

function key(e){
	if (!e) e = window.event;
	var k = e.keyCode;
	var tagName = (e.target || e.srcElement).tagName;
	if (e.ctrlKey){
/*		if (tagName != 'INPUT' && tagName != 'TEXTAREA'){*/
		if (tagName != "INPUT" && tagName != "SELECT" && tagName != "TEXTAREA"){
			if (k == 13){
				if(document.getElementById("first") == null) return false;
				else document.getElementById("first").onclick();
/*				eval(s);
				setTimeout(function(){eval(s);},1000);*/
			}
			if (k == 37)
				if(document.getElementById("searchprev1") != null)
					location = document.getElementById("searchprev1").href;
				else if(document.forms["searchprev_c1"] != null)
					document.forms["searchprev_c1"].submit();
				else if(document.getElementById("prev") != null){
					var s = ""+document.getElementById("prev").onclick;
					s=s.substr(s.indexOf("doc"));
					s=s.substr(0,s.length-(s.length-s.indexOf("return")));
					eval(s);
				}
			if (k == 39)
				if(document.getElementById("searchnext1") != null)
					location = document.getElementById("searchnext1").href;
				else if(document.forms["searchnext_c1"] != null)
					document.forms["searchnext_c1"].submit();
				else if(document.getElementById("next") != null){
					var s = ""+document.getElementById("next").onclick;
					s=s.substr(s.indexOf("doc"));
					s=s.substr(0,s.length-(s.length-s.indexOf("return")));
					eval(s);
				}
			if (k == 38)
				if(document.getElementById("searchfirst1") != null)	
					location = document.getElementById("searchfirst1").href;
				else if(document.forms["searchfirst_c1"] != null)
					document.forms["searchfirst_c1"].submit();
			if (k == 40)
				if(document.getElementById("searchlast1") != null)	
					location = document.getElementById("searchlast1").href;
				else if(document.forms["searchlast_c1"] != null)
					document.forms["searchlast_c1"].submit();
/*			return false;*/
		}
	}else{
		var tagName = (e.target || e.srcElement).tagName;
		if (tagName != "INPUT" && tagName != "SELECT" && tagName != "TEXTAREA"){
/*			if (k == 13){alert("old = " + screen.width + " x " + screen.height + "\n" + "new = " + screenSize().w + " x " + screenSize().h);}*/
/*alert($(\'b6\').getStyle(\'cursor\'));
			}*/
/*			if(k == 37)
				if(document.getElementById("prev") != null){
					var s = ""+document.getElementById("prev").onclick;
					s=s.substr(s.indexOf("doc"));
					s=s.substr(0,s.length-(s.length-s.indexOf("return")));
					eval(s);
				}
			if(k == 39)
				if(document.getElementById("next") != null){
					var s = ""+document.getElementById("next").onclick;
					s=s.substr(s.indexOf("doc"));
					s=s.substr(0,s.length-(s.length-s.indexOf("return")));
					eval(s);
				}*/
			if(k == 38);
			if(k == 40);
		}
	}
}

/*
document.getElementById("min").focus();

if(document.forms["searchprev1"] != null)
document.forms["searchprev1"].submit();

if(document.getElementById("view20_1") != null){
	if(document.getElementById("view10_1") != null)					
		location = document.getElementById("view10_1").href;
		else location = document.getElementById("view20_1").href;
*/

function screenSize() {
    var w, h;
    w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
    h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
    return {w:w, h:h};
}

