///////////////////////////////////////////////////////////////////////////////
// 							Browser API Extensions
//	Dependencies:	xbdx.js		  				
//	Prefix:	ax		  				
//	
//	Author:		Paul Coleman  
//	Written:	 8/16/1999
//	Modified:	 9/16/1999
// Copyright © 1999 by Computer Services Contracting. All rights reserved.
// permision for use granted freely for any non-commercial use as long as 
// credit is given to Computer Services Contracting. 
///////////////////////////////////////////////////////////////////////////////
if (!xbdx) {
	alert("Cross Browser API Extention (apix.js) requires xbdx.js to be loaded.  Contact the WebMaster to report this problem.");
} else {
	apix = new Object();
	apix.Version = "0.3";
	apix.ModifyDate = "9.16.1999";
	apix.Status = "Beta";
};

///////////////////////////////////////////////////////////////////////////////
// 							axMoveInOval
//	Parameters:	oSSL - Style Sheet Layer object  				
//				iStartDegree - Starting angle in degrees  				
//				iX_Radius - x radius of oval  				
//				iY_Radius - y radius of oval  				
//				sID - optional - string, ID of the Oval object  				
//				iInterval - optional - amount of time to wait between movements in micro seconds  				
//  				
//	Public interface:
//			axMoveInOval(oSSL, iStartDegree, iIncrementDegree, iX_Radius, iY_Radius, iInterval, sID)
//			axMoveInOval.Step()
//			axMoveInOval.Stop()
//  				
//	Author:		Paul Coleman  
//	Written:	 8/16/1999
//	Modified:	 9/16/1999
///////////////////////////////////////////////////////////////////////////////
function axMoveInOval(oSSL, iStartDegree, iIncrementDegree, iX_Radius, iY_Radius, iInterval, sID) {
	this.Init(oSSL, iStartDegree, iIncrementDegree, iX_Radius, iY_Radius, iInterval, sID);
};

function axMoveInOvalInit(oSSL, iStartDegree, iIncrementDegree, iX_Radius, iY_Radius, iInterval, sID) {
	
	this.ID = sID?sID:"Oval";
	this.Interval = iInterval?iInterval:9;

	this.SSL = oSSL;
	this.NextDegree = iStartDegree;
	this.IncrementDegree = iIncrementDegree;
	this.x_center = parseInt(oSSL.style.left);
	this.y_center = parseInt(oSSL.style.top);
	this.x_radius = iX_Radius;
	this.y_radius = iY_Radius;
	
};
function axMoveInOvalStep() {
	var angle = Math.PI * this.NextDegree/180;
	var x_offset = Math.cos(angle)* this.x_radius;
	var y_offset = Math.sin(angle) * this.y_radius;
	this.SSL.style.left = this.x_center + x_offset ;
	this.SSL.style.top = this.y_center + y_offset ;
	this.NextDegree += this.IncrementDegree;
	if (this.NextDegree >= 360) { this.NextDegree -= 360};
	if (this.NextDegree <= 0) { this.NextDegree += 360};
};

function axMoveInOvalStart() {
	setInterval(eval("'document.all." + this.SSL.id + "." + this.ID + ".Step()'"), window.document.IntervalFactor * this.Interval);
};

function axMoveInOvalStop() {
};

if (is.DHTMLup) {
	axMoveInOval.prototype.Init = axMoveInOvalInit;
	axMoveInOval.prototype.Step = axMoveInOvalStep;
	axMoveInOval.prototype.Start = axMoveInOvalStart;
	axMoveInOval.prototype.Stop = axMoveInOvalStop;
//	with (axMoveInOval) {
//		prototype.Init = axMoveInOvalInit;
//		prototype.Step = axMoveInOvalStep;
//		prototype.Start = axMoveInOvalStart;
//		prototype.Stop = axMoveInOvalStop;
//	};
};

///////////////////////////////////////////////////////////////////////////////
// 					end		axMoveInOval
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// 							axMoveInCircle
//	Parameters:	oSSL - Style Sheet Layer object  				
//				iStartDegree - Starting angle in degrees  				
//				iIncrementDegree - amount of movement in degrees  				
//				iRadius - radius of circle  				
//				sID - optional - string, ID of the Circle object  				
//				iInterval - optional - amount of time to wait between movements in micro seconds  				
//  				
//	Public interface:
//			axMoveInCircle(oSSL, iStartDegree, iIncrementDegree, iRadius, iInterval, sID)
//			axMoveInCircle.Step()
//			axMoveInCircle.Stop()
//  				
//	Author:		Paul Coleman  
//	Written:	 8/16/1999
//	Modified:	 9/16/1999
///////////////////////////////////////////////////////////////////////////////

function axMoveInCircle(oSSL, iStartDegree, iIncrementDegree, iRadius, iInterval, sID) {
	this.Init(oSSL, iStartDegree, iIncrementDegree, iRadius, iInterval, sID);
};

function axMoveInCircleInit(oSSL, iStartDegree, iIncrementDegree, iRadius, iInterval, sID) {
	this.ID = sID?sID:"Circle";
	this.Interval = iInterval?iInterval:9;

	this.SSL = oSSL;
	this.NextDegree = iStartDegree;
	this.IncrementDegree = iIncrementDegree;
	this.x_center = parseInt(oSSL.style.left);
	this.y_center = parseInt(oSSL.style.top);
	this.radius = iRadius;
	
};

function axMoveInCircleStep() {
	var angle = Math.PI * this.NextDegree/180;
	var x_offset = Math.cos(angle)* this.radius;
	var y_offset = Math.sin(angle) * this.radius;
	this.SSL.style.left = this.x_center + x_offset ;
	this.SSL.style.top = this.y_center + y_offset ;
	this.NextDegree += this.IncrementDegree;
	if (this.NextDegree >= 360) { this.NextDegree -= 360};
	if (this.NextDegree <= 0) { this.NextDegree += 360};
};

function axMoveInCircleStart() {
	setInterval(eval("'document.all." + this.SSL.id + "." + this.ID + ".Step()'"), window.document.IntervalFactor * this.Interval);
};

function axMoveInCircleStop() {
};

if (is.DHTMLup) {
	axMoveInCircle.prototype.Init = axMoveInCircleInit;
	axMoveInCircle.prototype.Step = axMoveInCircleStep;
	axMoveInCircle.prototype.Start = axMoveInCircleStart;
	axMoveInCircle.prototype.Stop = axMoveInCircleStop;
//	with (axMoveInCircle) {
//		prototype.Init = axMoveInCircleInit;
//		prototype.Step = axMoveInCircleStep;
//		prototype.Start = axMoveInCircleStart;
//		prototype.Stop = axMoveInCircleStop;
//	};
};

///////////////////////////////////////////////////////////////////////////////
// 					end		axMoveInCircle
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// 							axMoveInBounce
//	Parameters:	oSSL - Style Sheet Layer object  				
//				iX_Delta - amount of x movement in pixels  				
//				iY_Delta - amount of y movement in pixels  				
//				fn - optional - function to call when direction changes  				
//				sID - optional - string, ID of the Bounce object  				
//				iInterval - optional - amount of time to wait between movements in micro seconds  				
//  				
//	Public interface:
//			axMoveInBounce(oSSL, iX_Delta, iY_Delta, fn, sID, iInterval)
//			axMoveInBounce.Step()
//			axMoveInBounce.Start(sID,iInterval)
//			axMoveInBounce.Stop()
//  				
//	Author:		Paul Coleman  
//	Written:	 8/16/1999
//	Modified:	 9/16/1999
///////////////////////////////////////////////////////////////////////////////

function axMoveInBounce(oSSL, iX_Delta, iY_Delta, fn, sID, iInterval) {
	this.Init(oSSL, iX_Delta, iY_Delta, fn, sID, iInterval);
};

function axMoveInBounceInit(oSSL, iX_Delta, iY_Delta, onDirectionChange, sID, iInterval) {
	this.onDirectionChange = onDirectionChange?onDirectionChange:null;
	this.ID = sID?sID:"Bounce";
	this.Interval = iInterval?iInterval:3;

	this.SSL = oSSL;
	this.X_Delta = iX_Delta;
	this.Y_Delta = iY_Delta;
	
};

function axMoveInBounceStep() {
	if ((parseInt(this.SSL.style.left) <= 0) || (parseInt(this.SSL.style.left) >= (window.getInnerWidth() - this.SSL.getClientWidth()))) {
		this.X_Delta = ~(this.X_Delta)+1;
		if (this.onDirectionChange) {
			this.onDirectionChange("x");
		};
	};

	if ((parseInt(this.SSL.style.top) <= 0) || (parseInt(this.SSL.style.top) >= (window.getInnerHeight() - this.SSL.getClientHeight()))) {
		this.Y_Delta =  ~(this.Y_Delta)+1;
		if (this.onDirectionChange) {
			this.onDirectionChange("y");
		};
	};

	this.SSL.moveBy(this.X_Delta, this.Y_Delta);
};

function axMoveInBounceStart() {
	this.onDirectionChange("x");
	setInterval(eval("'document.all." + this.SSL.id + "." + this.ID + ".Step()'"), window.document.IntervalFactor * this.Interval);
};

function axMoveInBounceStop() {
};

if (is.DHTMLup) {
	axMoveInBounce.prototype.Init = axMoveInBounceInit;
	axMoveInBounce.prototype.Step = axMoveInBounceStep;
	axMoveInBounce.prototype.Start = axMoveInBounceStart;
	axMoveInBounce.prototype.Stop = axMoveInBounceStop;
//	with(axMoveInBounce) {
//		prototype.Init = axMoveInBounceInit;
//		prototype.Step = axMoveInBounceStep;
//		prototype.Start = axMoveInBounceStart;
//		prototype.Stop = axMoveInBounceStop;
//	};
};

///////////////////////////////////////////////////////////////////////////////
// 					end		axMoveInBounce
///////////////////////////////////////////////////////////////////////////////
