window.addEvent('domready', function(){

	$$('span.facebook a').each(function(el,i){
		el.addEvent('click',function(e){
			e.stop();
			wnd = window.open(el.get('href'),'facebook','width=600,height=480');
			wnd.focus();
		});
	});

	$$('span.myspace a').each(function(el,i){
		el.addEvent('click',function(e){
			e.stop();
			var params = el.get('href').split('||');
			var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto';
			targetUrl += '&t=' + encodeURIComponent(params[0]);
			targetUrl += '&u=' + params[1];
			targetUrl += '&r=' + params[2];
			wnd = window.open(targetUrl,'myspace','width=600,height=480');
			wnd.focus();
		});
	});
	
	$$('span.nettby a').each(function(el,i){
		el.addEvent('click',function(e){
			e.stop();
			var params = el.get('href').split('||');
			var targetUrl = 'http://www.nettby.no/user/edit_link.php';
			targetUrl += '?name=' + escape(params[0]);
			targetUrl += '&url=' + escape(params[1]);
			wnd = window.open(targetUrl,'myspace','scrollbars=no,width=450,height=430');
			wnd.focus();
		});
	});
	
	$$('span.biip a').each(function(el,i){
		el.addEvent('click',function(e){
			e.stop();
			var targetUrl = 'http://www.biip.no/service/share.aspx?url=' + encodeURIComponent(el.get('href'));
			wnd = window.open(targetUrl,'biipsharer','location=yes,links=no,scrollbars=no,toolbar=no,width=626,height=436');
			wnd.focus();
		});
	});
	
	if(blogUrl==window.location.href){
		$$('div.hideable').addClass('hide');
	}
		
	/* generic code to open all links with rel=_blank in new window, to pass validation in xhtml strict. */
	$$('a').each(function(link,i){
		if(link.get('rel')=='_blank') link.setProperty('target','_blank');
	});	
	/* end link code */
	
});