
var working = false;
var newdiv = document.createElement('div');
newdiv.setAttribute('id', 'fbhover');
newdiv.style.display = "none";
newdiv.innerHTML = '<iframe id="fbif" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FMedical-Informatics-Engineering-MIE%2F127707293927806&amp;layout=button_count&amp;show_faces=false&amp;width=82&amp;action=like&amp;font=tahoma&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:1px solid #D2CBA1; position:relative; top:-2px; left:75px; padding:3px; background-color:#ffffff; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; overflow:hidden; width:82px; height:21px; float:left;" allowTransparency="true"></iframe><div id="myframe"></div><a id="fb" target="_blank" href="x?h=http&l=www.facebook.com/pages/Medical-Informatics-Engineering-MIE/127707293927806" style="position:absolute;bottom:0px;left:2px;"><img src="/gfx/blank.gif" style="background:url(\'../gfx/fbtrrs75.png\') no-repeat 0 0;" height="24" width="75" /></a>';

function resetBlock() {
	var fbimg = $$('#fb img')[0];

	$('fbhover').setStyles({
		width: '162px',
		height: fbimg.getSize().y,
		position: 'absolute',
		left: 4,
		bottom: 0,
		padding: '3px',
		borderRadius: '2px',
		zIndex: '65535',
		display: 'block'
	});

	if (Browser.firefox) {
		$('fbhover').setStyle('-moz-border-radius', '3px');	
	}

	if (Browser.ie6) {
		$('fbhover').setStyles({
			bottom: 'auto',
			top: 9,
			left: -3 
	   });
		$$('#fbhover img')[0].setStyles({
			position: 'relative',
			top: '-3px'
		});
	}
	if (Browser.ie7) {
		$$('#fbhover img')[0].setStyles({
			position: 'relative',
			top: '-3px'
		});
	}
}

window.addEvent('domready', function() {
	$('follow_bar').appendChild(newdiv);
	$('fbhover').fade('hide');
	resetBlock();

	$('fb').addEvent('mouseenter', function() { 
		working = true;
		$('fbhover').fade('in');
		(function(){ working = false; }).delay(550);
	});
	document.addEvent('mousemove', function(e){
		var coor = $('fbhover').getCoordinates();
		if(e.page.x < coor['left'] || e.page.x > (coor['left'] + coor['width']) || e.page.y < coor['top'] || e.page.y > (coor['top'] + coor['height']) ) {
			if(!working) {			
				$('fbhover').fade('hide');
			}
		}
	});
});
