var general = { 
	
	// OnLoad functions
	init: function(){
		this.bubbleEvt();
	},
	
	bubbleEvt: function() {
		
		general.addLinkIcon();

		general.makeElementALink($('.listpage ul.list li'));
		general.makeElementALink($('.blurbrow .blurb.cal'));
	},
	
	addLinkIcon: function(e) {
		// Add pdf icons to pdf links
		$("a[href$='.pdf']").before('<span class="pdf"></span>&nbsp;').addClass("link-icon");

		// Add txt icons to document links (doc, rtf, txt)
		$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").before('<span class="txt"></span>&nbsp;').addClass("link-icon");

		// Add zip icons to Zip file links (zip, rar)
		$("a[href$='.zip'], a[href$='.rar']").before('<span class="zip"></span>&nbsp;').addClass("link-icon"); 

		// Add email icons to email links
		$("a[href^='mailto:']").after('<span class="email"></span>&nbsp;').addClass("link-icon");

		//Add external link icon to external links - 
		$('a').not("a[href^='mailto:'], a[href^='callto:'], a.fb_like, .addthis_toolbox a, div.top-blurb a").filter(function() {
			//Compare the anchor tag's host name with location's host name
				
			if (this.hostname !== location.hostname) {
				$(this).after('<span class="external"></span>&nbsp;').addClass("link-icon");
			}
			
		});
	},	

	makeElementALink: function(e) {		
		$(e).click(function() {
			window.location = $(this).find("a:first").attr("href");
		});

		/*general class clickable that with status, title & hover*/
		$(e).hover(function() {
			$(this).attr("title",$(this).find("a:first").attr("title"));
			$(this).addClass("hover");
		}, function() { 
			$(this).removeClass("hover");
        });
	}	
		
}




$(document).ready(function(){			   
	general.init();
});
