
// equivalent to php function
function number_format(i,d)
{
	s = parseFloat(i).toFixed(d);
	f = 0; a = [];
	for( i = Math.floor((s.length-1)/3); i > 0; i-- ) {
		t = s.length;
		if( i > 1 ) t -= i*3;
		a.push(s.substring(f,t));
		f = t;
	}
	return a.join(',');
}

$(document).ready(function() {
	
	/* open links with rel="external" in new window and amend link title */
	$('a[rel*="external"]').each(function() {
		var title = $(this).attr('title') ? $(this).attr('title') + ' (opens in a new tab or window)' : 'This link will open in a new tab or window';
		$(this).attr('title',title).click(function() {
			window.open($(this).attr('href'));
			return false;
		});
	});
	
	// execute sIRF after DOM load
	if(typeof sIFR == "function"){
		sifr_exec();
	};
	
	
});


