var LinkDecorator = {
	
	_exclude : [],
		
	init : function(exclude){
		this._exclude = exclude;
	},
		
	decorateLinks : function(){
		var d = document,
			h = d.location.hostname,
//			a = document.getElementsByTagName('a'),
			u;
		
		/**
		 * Loop through all links in the document
		 */
		 $('div.content a').each(function(){
			u = $(this).attr('href');
			if(u){
				if(!(u.match(/^#/)) && u.match(/^http/)){

					/**
					 * Exclude some links
					 */
					if(this._exclude){
						for(var j=0; j<this._exclude.length;j++){
							if(u.indexOf(this._exclude[j]) != -1){
								break; //skip this link
							}
						}
					}
					
					/**
					 * External link, wrap with a <span class="external">
					 */
					if(u.indexOf(h) == -1){
						$(this).wrap('<span class="external" />');
					}
				}
			}
			
		});
/*
		for(var i=0; i<a.length; i++){

			u = a[i].href;

		}
*/
	}	
	
};
