/**
 * RokIEWarn - An IE6 Warning to invite people upgrading to IE6
 * 

 */
 
 
var RokIEWarn = new Class({
	'site': 'sitename',
	'initialize': function() {
		var warning = "<h3 style='color:#FFFFFF'>Provavelmente você deve estar usando o Internet Explorer 6 (IE6).</h3><h4 style='color:#FFFFFF'>NOTA: Este site utiliza recursos de ultima tecnologia, e o seu Internet Explorer está ultrapassado, assim aconselhamos você atualizar clicando no link a seguir.</p> <br /><p>Observações: Você será redirecionado para o site da Microsoft e deverá clicar no botão Download para atualizar. <br /> Você logo vai notar a diferença de ter atulizado o seu internet explorer. E o melhor, com total segurança que só o CatoléNews oferece a você.</p><a class=\"external\"  href=\"http://www.microsoft.com/downloads/details.aspx?FamilyId=9AE91EBE-3385-447C-8A30-081805B2F90B\">Atualizar para Internet Explorer 7 AGORA e de GRAÇA!</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(), 'opacity': 0});
		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, 'opacity': 0});

		
		return ;
	},
	
	'show': function() {
		this.fx.start({
			'margin-top': 30,
			'margin-left' : 10,
			'opacity': 1
		});
		this.open = true;
		Cookie.set('rokIEWarn', 'open', {duration: 7});
		document.getElementById("background").style.visibility = "hidden";
	},	
	'close': function() {
		var margin = this.height;
		this.fx.start({
			'margin-top': -margin,
			'opacity': 0
		});
		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); }
});