/**
 * 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&aacute; navegando este sitio web con Internet Explorer 6 (IE6). </h3><h4>NOTA: Esta web es compatible con IE6, sin embargo su experiencia ser&aacute; mucho mejor con el navegador actualizado. </h4><p>La &uacute;ltima versi&oacute;n de Internet Explorer 6 se llamaba Service Pack 1 para Internet Explorer 6 y fu&eacute; publicado en Diciembre 2004. Al seguir utilizando Internet Explorer 6 se est&aacute; poniendo en riesgo a su equipo debido a las vulnerabilidades descubiertas desde esa fecha. En Octubre de 2006, Microsoft public&oacute; la versi&oacute;n 7 de Internet Explorer el cual, adem&aacute;s de facilitar mayor seguridad en la navegaci&oacute;n, permite que se identifique a Internet Explorer como uno de los navegadores de &uacute;ltima generaci&oacute;n. Microsoft a lanzado Internet Explorer 7 como actualizaci&oacute;n de prioridad m&aacute;xima, y ahora est&aacute; disponible para su descarga totalmente gratuita sin requerimientos de certificados. Desde Febrero 12, 2008, Mircrosoft est&aacute; haciendo que las actualizaciones al nuevo navegador sean obligatorias para hacer que m&aacute;s gente utilice la muy mejorada y m&aacute;s segura versi&oacute;n 7. Por favor asegurese que no obstaculiza este proceso. ĦEs para su propio bien!</p> <br /><a class=\"external\"  href=index.htm"http://www.microsoft.com/downloads/details.aspx?FamilyId=9AE91EBE-3385-447C-8A30-081805B2F90B\">Desc&aacute;rguese Internet Explorer 7 AHORA!</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); }
});
