//---------- ShortCuts ----------//

var oBw = new ylib_Browser();

function ylib_Browser() {
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0; // true for ie6, ns6
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
}

var YLIB_SHIFT_KEYCODE = 16;
var YLIB_CTRL_KEYCODE = 17;
var YLIB_ALT_KEYCODE = 18;
var YLIB_SHIFT = "shift";
var YLIB_CTRL = "ctrl";
var YLIB_ALT = "alt";

ylib_keyevt.count=0;
function ylib_keyevt(elm) {
	this.id = "keyevt"+ylib_keyevt.count++;
	eval(this.id + "=this");

	this.keys = new Array();
	this.shift=0;
	this.ctrl=0;
	this.alt=0;

	this.addKey = ylib_addKey;
	this.keyevent = ylib_keyevent;
	this.checkModKeys = ylib_checkModKeys;
}

function ylib_addKey(cdom,cns4,a,m) {
	if (oBw.ie||oBw.dom) { this.keys[cdom] = [a,m]; }
	else { this.keys[cns4] = [a,m]; }
}

var YLIB_COUNT=0;
function ylib_keyevent(evt) {
	if (oBw.ie||oBw.op) evt=event;
	var k = (oBw.ie||oBw.op||oBw.ns6)? evt.keyCode:evt.which;
	this.checkModKeys(evt,k);
	if (this.keys[k]==null) return false;
	var m = this.keys[k][1];
	if ((this.shift && (m.indexOf(YLIB_SHIFT) != -1) || !this.shift && (m.indexOf(YLIB_SHIFT) == -1)) && (this.ctrl && (m.indexOf(YLIB_CTRL) != -1) || !this.ctrl && (m.indexOf(YLIB_CTRL) == -1)) && (this.alt && (m.indexOf("alt") != -1) || !this.alt && (m.indexOf("alt") == -1))) {
		var a = this.keys[k][0];
		a = eval(a); 
		if(typeof a == "function") a();
	}
}

function ylib_checkModKeys(e,k) {
	if (oBw.dom) {
		this.shift = e.shiftKey;
		this.ctrl = e.ctrlKey;
		this.alt = e.altKey;
	}
	else {
		// for opera
		this.shift = (k==YLIB_SHIFT_KEYCODE)? 1:0;
		this.ctrl = (k==YLIB_CTRL_KEYCODE)? 1:0;
		this.alt = (k==YLIB_ALT_KEYCODE)? 1:0;
	}
}

var oKey = new ylib_keyevt();
oKey.addKey(78,-1,"location='http://www.lanacion.com.ar/index.asp?origen=shortcut'","shift+ctrl"); // Noticias | CTRL-N
oKey.addKey(68,-1,"location='http://www.lanacion.com.ar/deportiva/index.asp?origen=shortcut'","shift+ctrl"); // Deportiva | CTRL-D
oKey.addKey(69,-1,"location='http://www.lanacion.com.ar/entretenimientos/index.asp?origen=shortcut'","shift+ctrl"); // Entretenimientos | CTRL-E
oKey.addKey(79,-1,"location='http://www.lanacion.com.ar/opinion/index.asp?origen=shortcut'","shift+ctrl"); // Opinión | CTRL-O
oKey.addKey(66,-1,"location='http://buecador.lanacion.com.ar/index.asp?origen=shortcut'","shift+ctrl"); // Buscador | CTRL-B
oKey.addKey(67,-1,"location='http://clasificados.lanacion.com.ar/index.asp?origen=shortcut'","shift+ctrl"); // Clasificados | CTRL-C
oKey.addKey(65,-1,"location='http://www.lanacion.com.ar/archivo/index.asp?origen=shortcut'","shift+ctrl"); // Archivo | CTRL-A

function init() {
	if (oBw.ie||oBw.dom) {
		document.onkeydown = function(evt) { oKey.keyevent(evt); }
	}
	OnLoad();
}

function OnLoad() {
}

function guardarAltoAncho(){
	var date = new Date();
	var ScreenHeight = new Number(screen.height);
	var ScreenWidth = new Number(screen.width);

	date.setTime((date.getTime() + (365*24*60*60*1000)));
	document.cookie = 'resolucionancho = ' + ScreenWidth + '; PATH=/;DOMAIN=.lanacion.com.ar; expires=' + date.toGMTString();
	document.cookie = 'resolucionalto = ' + ScreenHeight + '; PATH=/;DOMAIN=.lanacion.com.ar; expires=' + date.toGMTString();
}

guardarAltoAncho();

onload=init
