/*
************************************************************************************************
************************************************************************************************
************************************************************************************************
3DROTATOR PRODUCT VIEWER ADVANCED FEATURES API www.3DRotator.com

	Make a link on your page cause the 3DRotator viewer to rotate or zoom. Great for pointing out a feature on your product or teaching.
	OR Integrate with your flash movie allowing it to control the 3DRotator viewer in real time

		function RotatorMove(rotatorId, xdegree, ydegree, xpan, ypan, zoom, time, sharpen, callbackfunctionname)
			- where 
				xdegree and ydegree are in degrees (double)
				xpan	and ypan are in percent, a value of 50 means centered (double)
				zoom 	is how far zoomed in, from 1 to 20 times (double)
				time 	is for rotation in milliseconds, can be = 0 for jump (double)
				sharpen is 'sharpen' or 'none' - the image is sharpened after rotation
				callbackfunctionname is string name of javascript function to receive current displayed position of object. leave '' (blank) for no call back (string)

			- example
				to zoom out, then rotate, then zoom back in to an absolute position use:
					<a href="javascript:RotatorMove('RotatorViewer',180,60,50,50,5,100,'','');" onMouseOver="window.status='See this part of the object';return true;">See This Part of the object</a>

************************************************************************************************
************************************************************************************************
************************************************************************************************
*/




if (RotatorViewerLoadedNamed == null){ var RotatorViewerLoadedNamed = new Array(10);}



function RotatorViewerLoaded(applet, rotatorId, viewerWidth, viewerHeight){
	/*
	this function gets called when applet started.
	required before RotatorMove() function call from a button on your webpage
	also allows you to start your own animation
	gets rid of error if applet does not exist. or is not ready
	simplifies/improves compatibility of opera and IE when calling the MoveTo function
	now can use RotatorMove() function defined below
 	*/

	RotatorViewerLoadedNamed[rotatorId] = applet;

	// now can use a line like this without having to specify document.applet.RotatorViewerapplet.Move(...)  which works in Opera but IE needs document.RotatorViewerApplet.Move(...)
	//if (RotatorViewerLoadedNamed['RotatorViewer'] != null) RotatorViewerLoadedNamed['RotatorViewer'].setAngle(xdegree,'abs',ydegree,'abs');

	// but with the RotatorMove function defined below this is simpler
	//	RotatorMove('RotatorViewer',180,60,50,50,5,100,'sharpen','RotatorDisplayPosition');

	RotatorViewerLoadedNamed[rotatorId].setActionCallBack('RotatorDisplayPosition');


} // end function RotatorViewerLoaded




function RotatorViewerLoadedSimple(applet, rotatorId, viewerWidth, viewerHeight){
	RotatorViewerLoadedNamed[rotatorId] = applet;
} // end function RotatorViewerLoadedSimple




function RotatorMove(rotatorId, xdegree, ydegree, xpan, ypan, zoom, time, sharpen, callbackfunctionname){
	if (RotatorViewerLoadedNamed[rotatorId] != null){

		RotatorViewerLoadedNamed[rotatorId].setAngle(xdegree,'abs',ydegree,'abs');
		RotatorViewerLoadedNamed[rotatorId].setPan(xpan,'abs',ypan,'abs');
		RotatorViewerLoadedNamed[rotatorId].setZoom(zoom,'abs');
		RotatorViewerLoadedNamed[rotatorId].setSpeed(time);
		RotatorViewerLoadedNamed[rotatorId].setSharpenMode(sharpen);
		RotatorViewerLoadedNamed[rotatorId].move(callbackfunctionname);
	} 
} // end function RotatorMoveTo



function RotatorShowDemo(rotatorId, tool, interupt){
		RotatorViewerLoadedNamed[rotatorId].showDemo(tool, interupt);
} // end function RotatorShowDemo




function RotatorDisplayPosition(rotatorId, xdegrees, ydegrees, xpan, ypan, zoom){
	/*
	A function like this one is called after every user move with RotatorViewerNamed[rotatorId].setActionCallBack('RotatorDisplayPosition');
		-useful for finding the preset viewer positions to use in a RotatorMove(...); command from a link on your page.
	A function like this one is called after the RotatorMove(...); command completes all motion.
		- specify your function name in the last variable passed to RotatorMove();
		- leave '' (blank) if you do not want any function called.
	This function receives the current position of the object in the viewer.
	It also is an indication that all movement is complete.
		-useful for creating your own complex animations through javascript controling the 3DRotator Viewer
			once a Move has completed, you can send another Move command with the next position
			tip: set the time variable to zero to control your own smooth zooming
	*/


	/* in this example, a form text box displays the recieved values
	   assumes your html page has a form named "ViewerPosition", and an input box named "Display" like: 
			<form name=ViewerPosition>
			<input name=Display type=box value="" size=80 >
			</form>

	*/


   document.ViewerPosition.Display.value = "RotatorMove('" + rotatorId + "'," + xdegrees + "," + ydegrees + "," + xpan + "," + ypan + "," + zoom + ",100,'','');";

} // end function RotatorDisplayPosition




