// Ballistics Eu CD 2009 script for the flying pig
var TakeOff=-100; var Horizon=895;
var lat=0; var elevation; var climb=4; var ground=225; // 
var wind=5; var drag; var rate=1; var distance=90; // Min+StartPerspective
var moving; var fade=100; var fadefrom=695;

function flight() {
x = (x + rate) % Horizon; y = x / climb; // rate=increment size. x modulo(%) Horizon sets repeat pass 
lat = x + TakeOff; // allow horizontal position offset from counter
elevation = ground - y; // Inverse of 'top'
distance = 85+(800-x)/20; // Minimum size + range to reduce over track
fade=100-(parseInt(x/fadefrom)*((x % fadefrom)/2)); // Opacity 100% > 0% after fadefrom
// document.getElementById('txt').value=lat; // Variables to trace. (Unhide txt box) 
document.getElementById("hogs").style.left = lat+'px';
document.getElementById("hogs").style.top  = elevation+'px';
document.getElementById("hogs").style.width = distance+'px';
document.getElementById("hogs").style.height  = distance+'px';
document.getElementById("hogs").style.opacity  = fade/100;
document.getElementById("hogs").style.filter = 'alpha(opacity='+fade+')';
moving=setTimeout("flight()",drag);
}

function burn() {
lat = document.getElementById("hogs").offsetLeft; // get starting point
x = lat - TakeOff; y = x / climb; // height is directly proportional to travel 
drag = 26 - wind; // invert windspeed to set clock cycle
flight(); // go do it
}

function becalm() {clearTimeout(moving);}
