function totalWorldwide(e) {
	  var data__ = e.data;

	  var _links_sel = [];
	  var countries = [];
	  function isInArray(value, array) { return array.indexOf(value) > -1; }

	  for(var i = 0; i<=(data__.year);i++) {
	    var temp = _links_sel.concat(data__.data[i][1]); _links_sel = temp;
	    data__.data[i][1].forEach(function(f,i) {
	        if(!isInArray(f.source.name,countries)) countries.push(f.source.name);
	        if(!isInArray(f.target.name,countries)) countries.push(f.target.name);
	    });
	  }

	  postMessage({'cmd':'totalWorldwideBack','links':_links_sel,'countries':countries});
	}
// get all ftas to the selected year
get all ftas to the selected year
get all ftas to the selected year
function totalWorldwide(e) {
	  var data__ = e.data;
	  var _links_sel = [];
	  var countries = [];
	  function isInArray(value, array) { return array.indexOf(value) > -1; }
	  for(var i = 0; i<=(data__.year);i++) {
	    var temp = _links_sel.concat(data__.data[i][1]); _links_sel = temp;
	    data__.data[i][1].forEach(function(f,i) {
	        if(!isInArray(f.source.name,countries)) countries.push(f.source.name);
	        if(!isInArray(f.target.name,countries)) countries.push(f.target.name);
	    });
	  }
	  postMessage({'cmd':'totalWorldwideBack','links':_links_sel,'countries':countries});
	}
function totalWorldwide ( e ) { var data__ = e . data ; var _links_sel = [ ] ; var countries = [ ] ; function isInArray ( value , array ) { return array . indexOf ( value ) > - 1 ; } for ( var i = 0 ; i <= ( data__ . year ) ; i ++ ) { var temp = _links_sel . concat ( data__ . data [ i ] [ 1 ] ) ; _links_sel = temp ; data__ . data [ i ] [ 1 ] . forEach ( function ( f , i ) { if ( ! isInArray ( f . source . name , countries ) ) countries . push ( f . source . name ) ; if ( ! isInArray ( f . target . name , countries ) ) countries . push ( f . target . name ) ; } ) ; } postMessage ( { 'cmd' : 'totalWorldwideBack' , 'links' : _links_sel , 'countries' : countries } ) ; }
get all ftas to the selected year
get all ftas to the selected year