/**
 * RokIEWarn - An IE6 Warning to invite people upgrading to IE6
 * 
 * @version		1.2-noOpacity
 * 
 * @license		MIT-style license
 * @author		Djamil Legato <djamil@rockettheme.com>
 * @client		RocketTheme, LLC.
 * @copyright	Author
 */
 
 
var RokIEWarn = new Class({
	'site': 'sitename',
	'initialize': function() {
		var warning = "<h3>Estás navegando con Internet Explorer 6 (IE6)</h3><h4>ATENCION!: Internet explorer 6 es un explorador muy antiguo y puede que no veas correctamente esta página web y sus contenidos</h4><p>Internet Explorer 6 fue lanzado en agosto de 2001, y la última versión de Internet Explorer 6 fue lanzado en agosto de 2004. Al continuar ejecutando Internet Explorer 6 está abierto a cualquier y todas las vulnerabilidades de seguridad descubiertas desde esa fecha. En marzo de 2009, Microsoft lanzó la versión 8 de Internet Explorer que, las normas, además de proporcionar mayor seguridad, es más rápido y más compatible que tanto la versión 6 y 7 que lo precedieron. El uso general de Internet Explorer 6 se ha reducido a tal punto que el 2009 será probablemente el ano en que deje de apoyar a los desarrolladores web, así que por favor, actualice tan pronto como sea posible. Es por tu propio bien!</p> <br /><a class=\"external\"  href=\"http://www.microsoft.com/spain/windows/internet-explorer/worldwide-sites.aspx\">Descarga ahora Internet Explorer 8!</a>";
		
		this.box = new Element('div', {'id': 'iewarn'}).inject(document.body, 'top');
		var div = new Element('div').inject(this.box).setHTML(warning);
		
		var click = this.toggle.bind(this);
		var button = new Element('a', {'id': 'iewarn_close'}).addEvents({
			'mouseover': function() {
				this.addClass('cHover');
			},
			'mouseout': function() {
				this.removeClass('cHover');
			},
			'click': function() {
				click();	
			}
		}).inject(div, 'top');
		
		this.height = $('iewarn').getSize().size.y;
		
		this.fx = new Fx.Styles(this.box, {duration: 1000}).set({'margin-top': $('iewarn').getStyle('margin-top').toInt()});
		this.open = false;
		
		var cookie = Cookie.get('rokIEWarn'), height = this.height;
		//cookie = 'open'; // added for debug to not use the cookie value
		if (!cookie || cookie == "open") this.show();
		else this.fx.set({'margin-top': -height});

		
		return ;
	},
	
	'show': function() {
		this.fx.start({
			'margin-top': 0
		});
		this.open = true;
		Cookie.set('rokIEWarn', 'open', {duration: 7});
	},	
	'close': function() {
		var margin = this.height;
		this.fx.start({
			'margin-top': -margin
		});
		this.open = false;
		Cookie.set('rokIEWarn', 'close', {duration: 7});
	},	
	'status': function() {
		return this.open;
	},
	'toggle': function() {
		if (this.open) this.close();
		else this.show();
	}
});

window.addEvent('domready', function() {
	if (window.ie6) { (function() {var iewarn = new RokIEWarn();}).delay(2000); }
});
