/**
 * ## Creative Commons Attribution-Share Alike 3.0 Unported License ##
 * HiddenLinksJS by Sascha Kimmel is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
 * Permissions beyond the scope of this license may be available at http://www.saschakimmel.com/hiddenlinksjs.
 * http://creativecommons.org/licenses/by-sa/3.0/
 */
(function(){
	Event.observe(window, 'load', function(){
		var hiddenLinkElements = $$('span.hl');
		if (hiddenLinkElements.length > 0) {
			hiddenLinkElements.each(function(el){
				if (typeof el.title != 'undefined') {
					var elId = '';
					if (typeof el.id != 'undefined') {
						elId = el.id;
					}
					var newLink = new Element('a');
					if (elId != '') {
						newLink.setAttribute('id', elId);
					}
					
					var classNames = $w(el.className);
					classNames.each(function(cls){
						if (cls != 'hl') {
							newLink.addClassName(cls);
						}
					});
					newLink.update(el.innerHTML);
					newLink.setAttribute('href', el.title);
					newLink.setAttribute('target', '_blank')
					newLink.setAttribute('onclick', el.onclick)
					Element.replace(el, newLink);
				}
			});
		}
	});
})();

