The World Needs a New Warrior

Last edited 26 August 2011 at 1:18pm

517347

#bar-wrap {
width: 538px;
margin-top: 2px;
padding: 0;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #2B74AF;
float: left;
}

#raised, #target {
color: white;
padding: 0 5px;
font-size: 16px;
}

#ship {
float: right;
height: 10px;
padding-top: 1px;
width: 18px;
}

#target {
float: right;
color: #2B74AF;
text-align: right;
}

#raised {
background-color: #2B74AF;
width: 150px;
}

#number {
display: none;
}

.clearbothsp {
clear: both;
}

(function($) {
$.fn.countTo = function(options) {

options = $.extend({}, $.fn.countTo.defaults, options || {});

var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;

return $(this).each(function() {
var _this = this,
loopCount = 0,
value = options.from,
interval = setInterval(updateTimer, options.refreshInterval);

function updateTimer() {
value += increment;
loopCount++;
$(_this).html(value.toFixed(options.decimals));

if (typeof(options.onUpdate) == 'function') {
options.onUpdate.call(_this, value);
}

if (loopCount >= loops) {
clearInterval(interval);
value = options.to;

if (typeof(options.onComplete) == 'function') {
options.onComplete.call(_this, value);
}
}
}
});
};

$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 100, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
onUpdate: null, // callback method for every time the element is updated,
onComplete: null // callback method for when the element finishes updating
};
})(jQuery);

$(document).ready(function(){

$('#slide-button').click(function() {
$("#donate-form-slide").slideDown("fast", function(){
$("#slide-button").hide();
});
return false;
});

var number = $("#number").html();
calcBar(number);

function calcBar(number){
var proportion = Math.floor((number/650000)*100);
var nicenumber = addCommas(number);
var target = 650000 - number;
makeRoll(0, number, "#raised .counter");
makeRoll(650000, target, "#target .counter");
slideAnim(proportion);
};

function slideAnim(prop){
$('#raised').animate({
width: prop + "%"
}, 4000);
};

function makeRoll(start, target, id){
$(id).countTo({
from: start,
to: target,
speed: 4000,
refreshInterval: 50,
onComplete: function(target, id) {
// $(id).html(addCommas(target));
}
});
};

function addCommas(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
};

}); // end docready

£ raised

Donate


£18 could buy 5 litres of water based paint to protect her from rust and extreme environments.

£60 could buy 10 square metres of material to make a banner to hang from the ship during direct actions.

£100 could help buy a life jacket, essential equipment for a RWIII crew member.

Or choose your own amount:

Please choose an amount:

The Rainbow Warrior has been the very heart and soul of our campaigning for over 30 years. But now she is coming to the end of her life and urgently needs to be replaced. In the UK we're trying to raise £650,000 towards the cost of the new Rainbow Warrior. Please make a donation and help us go on making waves.

- John Sauven, Executive Director, Greenpeace UK

She's been rammed, raided, bombed. But you can't sink a rainbow.


Watch and read more:

Interactive: the Rainbow Warrior's 32-years fighting for our planet

Follow Greenpeace UK