window.addEvent('load', initTooltips);

function initTooltips()
{
	var myTips = new Tips();


	$$('.postmetadata a').each(function(element){
//			text = element.title.replace('Comment on ', 'Comment on "');
			element.store('tip:title', '');
//			element.store('tip:text', text);
			element.store('tip:text', element.title);
//			killAltsTitles(element);
			myTips.attach(element);
		});
	$$('a[rel=tag]').each(function(element){
			var tag = element.get('text');
			element.store('tip:text', 'Click here to see more posts tagged with "' + tag + '".');
			killAltsTitles(element);
			myTips.attach(element);
		});
	$$('#pagination div').each(function(element){
			if(element.id == 'nextpage')
				text = "Click to go to another page of posts";
			else if(element.id == 'previouspage')
				text = "Click to go to previous page of posts";

			element.store('tip:text', text);
			killAltsTitles(element);
			myTips.attach(element);
		});
	$$('img.tags').each(function(element){
			element.store('tip:title', '');
			element.store('tip:text', element.title);
			killAltsTitles(element);
			myTips.attach(element);
		});
	$$('.more-link').each(function(element){
			element.store('tip:text', 'Click to read more of this article');
			$$('.readmoreimg').each(function(element){
											 	element.alt = '';
											 	element.title = '';
											 });
			myTips.attach(element);
		});
	$$('.stbutton').each(function(element){
			element.store('tip:title', '');
			element.store('tip:text', 'Share this Article');
			killAltsTitles(element);
			myTips.attach(element);
		});
	
	$$('#sidesearch img').each(function(element){
			element.store('tip:title', '');
			element.store('tip:text', element.alt);
			killAltsTitles(element);
			myTips.attach(element);
		});
	
//	$$('a[target="_blank"]').each(function(element){
	$$('a.html').each(function(element){
			element.store('tip:title', '');
			element.store('tip:text', 'This resource will open in a new window');
			killAltsTitles(element);
			myTips.attach(element);
		});
	$$('a.link').each(function(element){
			element.store('tip:title', '');
			element.store('tip:text', 'This link will open in a new window');
			killAltsTitles(element);
			myTips.attach(element);
		});
}
function killAltsTitles(target)
{
	target.alt = '';
	target.title = '';
}