tp1 = function(h) { return Math.max((h-400)/2,0); };
wh1 = function(w) { return Math.max((w-750)/2,0); };
wh2 = function(w) { return Math.max((w-750)/2+396,0); };
tm = function(i) { return i*300+1000; };
minalpha = 0.5;