document.observe('dom:loaded', function() 
{
	$$('a[rel="external"]').each(function(link)
	{
		if(link.readAttribute('href') != '' && link.readAttribute('href') != '#')
		{
			link.writeAttribute('target','_blank');
		}
	});
	

	$('center_content').getElementsBySelector('a').each(function(link)
	{
		Event.observe(link, "mouseover", function(event) {	
			this.morph('color: #9b64ea');

		});
		Event.observe(link, "mouseout", function(event) {	
			this.morph('color: #5cb5e9');
		});
	});


	$('center_content').getElementsBySelector('h3 a').each(function(link)
	{
		Event.observe(link, "mouseover", function(event) {	
			this.morph('color: #ededed');

		});
		Event.observe(link, "mouseout", function(event) {	
			this.morph('color: #0f374d');
		});
	});
	
	$('sidebar').getElementsBySelector('h2 a').each(function(link)
	{
		Event.observe(link, "mouseover", function(event) {	
			this.morph('color: #dfdfdf');

		});
		Event.observe(link, "mouseout", function(event) {	
			this.morph('color: #0f374d');
		});
	});

	if($('face_map') != null)
	{
		$('face_map').getElementsBySelector('a').each(function(link)
    	{
        	Event.observe(link, "click", function(event) {

				var div = $('mt_glider').down('div.scroller');
				var options = Object.extend({ duration: 1.0, frequency: 3 }, options || {});
				var href = link.readAttribute('title');

				mt_glider.moveTo(href, div, options);

				return false;
	
	        });

    	    Event.observe(link, "mouseover", function(event) {
	
				var tip = link.readAttribute('alt');
        	    container = document.createElement('div');
            	Element.extend(container);

	            container.addClassName('tooltip').hide();

    	        document.body.appendChild(container);

        	    container.update(tip);
	            container.clonePosition(link, { offsetLeft: 0, offsetTop: 80, setWidth: false, setHeight: false });
            	container.show();
    	    });
        	Event.observe(link, "mouseout", function(event) {
            	container.hide();
	        });
    	});
	}	
});
