
window.addEvent('domready', function()
{

    var bln_ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	
	if (
		$('bottomquickclosebtn') && 
		$('bottombubble')
	)
		new bubbleobj($('bottomquickclosebtn'), $('bottombubble'), -90, -70, false);

	if (
		$('quickclosebtn') && 
		$('topbubble')
	)
	{
	    if (bln_ie7 == true)
	    {
           	new bubbleobj($('quickclosebtn'), $('topbubble'), -215, -290, false);
	    }
	    else
	    {
           	new bubbleobj($('quickclosebtn'), $('topbubble'), -534, -290, false);
	    }
	}

	if (
		$('verytopquickclose') && 
		$('topbubble')
	)
		new bubbleobj($('verytopquickclose'), $('topbubble'), -90, 30, true);

	//we fix the ie menu bug:
	if ($('leftmenu'))
	{
		$$('#leftmenu li').addEvent('mouseenter', function()
		{
			//we change our background-image:
			if (this.getStyle('display') == 'block')
				this.setStyle('background-image', "url('css/images/leftmenu_libg_selected.png')");
		});

		$$('#leftmenu li').addEvent('mouseleave', function()
		{
			//we change our background-image:
			if (this.getStyle('display') == 'block')
				this.setStyle('background-image', "url('css/images/leftmenu_libg.png')");
		});
	}

	
});

var bubbleobj = new Class(
{
	initialize: function(_obj_btn, _obj_container, _i_offset, _i_offset_y, _is_abs)
	{
		//we add our onclick event:
	/*	_obj_btn.addEvent('click', function(_evt){
			//we close our browser:
			window.open('','_parent','');window.close();
		});*/

		//we add our mouseenter event:
		_obj_btn.addEvent('mouseenter', function(_evt)
		{
			_evt = new Event(_evt).stop;

			//we get the position of our current object:
			var x_pos = this.getPosition().x;
			if (_is_abs)
				var x_pos = this.getPosition().x - ((window.getSize().x - $('maincontainer').getSize().x) / 2);
			var y_pos = this.getPosition().y;

			//we set our bubble as a block:
			_obj_container.setStyle('display', 'block');

			//we then set that position to our bubble - its height:
			_obj_container.setStyles({
							'top': y_pos + _i_offset_y,
							'left': x_pos + _i_offset,
							'display': 'block'
			});

			new Fx.Tween(_obj_container).start('opacity', 0, 1);
		});

		_obj_btn.addEvent('mouseleave', function(_evt)
		{
			_evt = new Event(_evt).stop;

			new Fx.Tween(_obj_container).start('opacity', 1, 0);
		});
	}
});

