function plutoEphemeris(year, month, day, latitude, longitude) {

// This function will calculate orbital data for Pluto base of the
// date and location passed in.
// Latitude and longitude should be passed in radians.
	
	var dataArray = new Array();
	var h  = -0.833;
	
// Calculate the day number

	var d = calcDayNumber(year, month, day);
	
// Get the Sun's position.  It will be needed for Pluto's ephemeris.

	var sunData = new Array();
	sunData = sunEphemeris(year, month, day, latitude, longitude);
		
// Calculate the orbital parameters for the given day.

	var o = obliquity(d);
	var S = SPluto(d);
	var P = PPluto(d);
	
// Calculate the heliocentric spherical coordinates.

	var lonHeEcl = degToRad(238.9508) + degToRad(0.00400703) * d;
	lonHeEcl = lonHeEcl - degToRad(19.799) * Math.sin(P)     + degToRad(19.848) * Math.cos(P);
	lonHeEcl = lonHeEcl +  degToRad(0.897) * Math.sin(2 * P) -  degToRad(4.956) * Math.cos(2 * P);
	lonHeEcl = lonHeEcl +  degToRad(0.610) * Math.sin(3 * P) +  degToRad(1.211) * Math.cos(3 * P);
	lonHeEcl = lonHeEcl -  degToRad(0.341) * Math.sin(4 * P) -  degToRad(0.190) * Math.cos(4 * P);
	lonHeEcl = lonHeEcl +  degToRad(0.128) * Math.sin(5 * P) -  degToRad(0.034) * Math.cos(5 * P);
	lonHeEcl = lonHeEcl -  degToRad(0.038) * Math.sin(6 * P) +  degToRad(0.031) * Math.cos(6 * P);
	lonHeEcl = lonHeEcl +  degToRad(0.020) * Math.sin(S - P) -  degToRad(0.010) * Math.cos(S - P);
		
	var latHeEcl = degToRad(-3.9082);
	latHeEcl = latHeEcl - degToRad(5.435) * Math.sin(P)     - degToRad(14.975) * Math.cos(P);
	latHeEcl = latHeEcl + degToRad(3.527) * Math.sin(2 * P) +  degToRad(1.673) * Math.cos(2 * P);
	latHeEcl = latHeEcl - degToRad(1.051) * Math.sin(3 * P) +  degToRad(0.328) * Math.cos(3 * P);
	latHeEcl = latHeEcl + degToRad(0.179) * Math.sin(4 * P) -  degToRad(0.292) * Math.cos(4 * P);
	latHeEcl = latHeEcl + degToRad(0.019) * Math.sin(5 * P) +  degToRad(0.100) * Math.cos(5 * P);
	latHeEcl = latHeEcl - degToRad(0.031) * Math.sin(6 * P) -  degToRad(0.026) * Math.cos(6 * P);
	latHeEcl = latHeEcl + degToRad(0.011) * Math.cos(S - P);
	
	var RHeEcl = 40.72;
	RHeEcl = RHeEcl + 6.68 * Math.sin(P)     + 6.90 * Math.cos(P);
	RHeEcl = RHeEcl - 1.18 * Math.sin(2 * P) - 0.03 * Math.cos(2 * P);
	RHeEcl = RHeEcl + 0.15 * Math.sin(3 * P) - 0.14 * Math.cos(3 * P);
	
// Re-calculate the heliocentric ecliptical coordinates.

	var xHeEcl = RHeEcl * Math.cos(lonHeEcl) * Math.cos(latHeEcl);
	var yHeEcl = RHeEcl * Math.sin(lonHeEcl) * Math.cos(latHeEcl);
	var zHeEcl = RHeEcl * Math.sin(latHeEcl);

// Calculate the geocentric ecliptical coordinates.

	var xGeoEcl = xHeEcl + sunData[0];
	var yGeoEcl = yHeEcl + sunData[1];
	var zGeoEcl = zHeEcl + sunData[2];

// Calculate the geocentric equitorial coordinates.

	var xGeoEqu = xGeoEcl;
	var yGeoEqu = yGeoEcl * Math.cos(o) - zGeoEcl * Math.sin(o);
	var zGeoEqu = yGeoEcl * Math.sin(o) + zGeoEcl * Math.cos(o);
	
// Calculate the right accension, declination and distance.

	var R   = Math.sqrt(Math.pow(xGeoEqu, 2) + Math.pow(yGeoEqu, 2) + Math.pow(zGeoEqu, 2));
	var RA  = Math.atan2(yGeoEqu, xGeoEqu);
	RA = normalize(RA, 2 * Math.PI);
	var Dec = Math.asin(zGeoEqu / R);
	Dec = normalize(Dec, 2 * Math.PI);
	
// Calculate the elongation, percent illumination, apparent diameter and magnitude.

	var elongation = Math.acos((Math.pow(sunData[5], 2) + Math.pow(R, 2) - Math.pow(RHeEcl, 2)) 
		/ (2 * sunData[5] * R));
	
	var FV = Math.pow(RHeEcl, 2) + Math.pow(R, 2) - Math.pow(sunData[5], 2);
	FV = FV / (2 * RHeEcl * R);
	FV = Math.acos(FV);
	
	var pctIllumination = (1 + Math.cos(FV)) / 2 * 100;
	
	var aprntDiameter = "Not Available";
	
	FV = radToDeg(FV);
	var magnitude = "Not Available";

// Calculate the rise, south and set time.

	var L = LSun(d);
	var UTSouth = RA - L + Math.PI - longitude;
	UTSouth = UTSouth / degToRad(15.04107);
	UTSouth = normalize(UTSouth, 24);
	
	var LHA = (Math.sin(degToRad(h)) - Math.sin(latitude) * Math.sin(Dec)) /
		(Math.cos(latitude) * Math.cos(Dec));
	if (LHA <= -1) {
		UTRise = "Always Up"
		UTSet  = "Always Up"
		}
	else if (LHA >= 1) {
		UTRise = "Always Set"
		UTSet  = "Always Set"
		}
	else {
		LHA = Math.acos(LHA);
		LHA = LHA / degToRad(15.04107);
	
		var UTRise = UTSouth - LHA;
		UTRise = normalize(UTRise, 24);
		var UTSet  = UTSouth + LHA;
		UTSet = normalize(UTSet, 24);
		}
	
	dataArray[0]  = xGeoEcl;
	dataArray[1]  = yGeoEcl;
	dataArray[2]  = zGeoEcl;
	dataArray[3]  = RA;
	dataArray[4]  = Dec;
	dataArray[5]  = R;
	dataArray[6]  = elongation;
	dataArray[7]  = aprntDiameter;
	dataArray[8]  = magnitude;
	dataArray[9]  = pctIllumination;
	dataArray[10] = UTRise;
	dataArray[11] = UTSouth;
	dataArray[12] = UTSet;
	
	return dataArray;
			
	}

function SPluto(d) {

// Calculate S, for Pluto.  Input is the day number, d. 

	var S1 = 50.03;
	var S2 = 0.033459652;
	var S  = 0;
		
	S1 = degToRad(S1);
	S2 = degToRad(S2);	
	S  = S1 + S2 * d;
	S  = normalize(S, 2 * Math.PI);
	
	return S;
	}
	
function PPluto(d) {

// Calculate P, for Pluto.  Input is the day number, d. 

	var P1 = 238.95;
	var P2 = 0.003968789;
	var P  = 0;
	
	
	P1 = degToRad(P1);
	P2 = degToRad(P2);	
	P  = P1 + P2 * d;
	P  = normalize(P, 2 * Math.PI);
	
	return P;
	}
	
	


