Just checked, the mess I just posted correctly calculates the total perimiter for what I drew.

Silvaski - your formula there is helpful for drawing the pulley, as it includes the correction (0.57mm) for finding the difference between the pitch diameter and the actual pulley diameter. However for calculating the center distance and belt length, we only need the pitch diameter (D=N*p/pi).

Looking at the javascrip on the website you're using (http://www.product-config.net/catalo...r_functions.js), we can see the following:

Code:
        theta = Math.asin((pitchDiameterA - pitchDiameterB) / (2 * englishDesiredCD));        costheta = Math.cos(Math.asin((pitchDiameterA - pitchDiameterB) / (2 * englishDesiredCD)));
        desiredBeltLength = 2 * englishDesiredCD * costheta +
                Math.PI * (pitchDiameterA + pitchDiameterB) / 2 +
                theta * (pitchDiameterA - pitchDiameterB);
Their expression for theta is the same as my alpha.
For the overall belt length, the 2*CD*costheta is the same as my formula for 2*L, they just used trig not Pythagoras.
The expression pi*(D+d)/2 matches my formula - they've just factorized it and used diameters not radii.
The last item, theta*(D-d), is the extra length to account for the small angle of belt that is used due to the difference in pulley diameters. Again, if you re-arrange my formula then this term falls out. You can see if pulleys are the same size, i.e. d=D, then that part of the equation is zero.

So their formula is identical to what I just derived.

Then they round to the nearest integer teeth belt size and use some crazy looking formula to back-calculate the center distance.

Code:
v = 4 * beltLength - 6.28 * (pitchDiameterA + pitchDiameterB);        centerDistance = (v + Math.sqrt(v * v - 32 * (pitchDiameterA - pitchDiameterB) * (pitchDiameterA - pitchDiameterB))) / 16;
Whatever floats their boat...