/* ***************************************** */// Copyright 2010 Palmo Inc. All rights reserved./* ***************************************** */var growInProgress = false ; var revolveInProgress = 0; // var doAnother = 0; var animationDuration = 1.5; var position = new Array() ;var sWidth = 120; var sWidthGrown = 132 ; // position index 0var leftOffscreenLeft = 60;var leftOffscreenTop = 0; /* was 250 */var leftOffscreenWidth = 0 ; var pos0 = new Array() ;pos0['left'] = 60; pos0['top'] = 250; pos0['width'] = 0; pos0['opacity'] = 0; pos0['idName'] = 'offscreenLeft'; // index 1; var leftItemLeft = 75;var leftItemTop = 120;var leftItemWidth = 120;var pos1 = new Array() ;pos1['left'] = 75; pos1['top'] = 120; pos1['width'] = 120; pos1['opacity'] = 65; pos1['idName'] = 'left'; // index 2var centerItemLeft = 250;var centerItemTop = 30;var centerItemWidth = 256;var pos2 = new Array() ;pos2['left'] = 250; pos2['top'] = 30; pos2['width'] = 256; pos2['opacity'] = 100; pos2['idName'] = 'center'; // index 3; var rightItemLeft = 560; var rightItemTop = leftItemTop; var rightItemWidth = leftItemWidth ; var pos3 = new Array() ;pos3['left'] = 560; pos3['top'] = 120; pos3['width'] = 120; pos3['opacity'] = 65; pos3['idName'] = 'right'; // index 4var rightOffscreenLeft = 660;var rightOffscreenTop = leftOffscreenTop;var rightOffscreenWidth = leftOffscreenWidth ; var pos4 = new Array() ;pos4['left'] = 660; pos4['top'] = 250; pos4['width'] = 0; pos4['opacity'] = 0; pos4['idName'] = 'offscreenRight'; position[0] = pos0; position[1] = pos1; position[2] = pos2; position[3] = pos3; position[4] = pos4; var revolver ; var rIndex = 0 ;		/* index of the currently selected item of the revolver *//*function initRevolver() {	//alert("initting");	revolver = getElementsByClass('revolverItem')  ;	rIndex = 0 ;	hideElementWithID('backButton') ;		unhideElementWithID('forwardButton') ;		updateRevolveInProgress(0) ; 		document.getElementById('leftItem').style.width = '0' ; }*/function initRevolverAt1() {	//alert("initting");	/* obscure text version of icons 	hideElementWithID('textIcon1') ;		hideElementWithID('textIcon2') ;		hideElementWithID('textIcon3') ;		hideElementWithID('textIcon4') ;		hideElementWithID('textIcon5') ;	*/		/* reset alt tags to null so they don't interfere with display of animation (but leave them for spiders and verification) */	// alert(document.getElementById("rightOffscreenItem2").getAttribute("alt") );	document.getElementById("rightOffscreenItem1").setAttribute("alt", "");	document.getElementById("rightOffscreenItem2").setAttribute("alt", "");	document.getElementById("leftItem").setAttribute("alt", "");	document.getElementById("centerItem").setAttribute("alt", "");	document.getElementById("rightItem").setAttribute("alt", "");	// alert(document.getElementById("rightOffscreenItem2").getAttribute("alt") );		revolver = getElementsByClass('revolverItem')  ;	rIndex = 1 ;	// unhideElementWithID('backButton') ;		// unhideElementWithID('forwardButton') ;		updateRevolveInProgress(0) ; 	}function init() {	initRevolverAt1();}/* ---------- */// Dean Edwards/Matthias Miller/John Resig// this is a technique for calling the init script prior to the onload// its goal is to call init as soon as possible after the DOM laods// Firefox and Operan have a DOMContentLoaded event but other browsers don't // see dean.edwards.name/weblog/2005/09/busted/function init() {  // quit if this function has already been called  if (arguments.callee.done) return;  // flag this function so we don't do the same thing twice  arguments.callee.done = true;  // kill the timer  if (_timer) clearInterval(_timer);  // do stuff  initRevolverAt1();};/* for Mozilla/Opera9 */if (document.addEventListener) {  document.addEventListener("DOMContentLoaded", init, false);}/* for Internet Explorer *//*@cc_on @*//*@if (@_win32)  document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");  var script = document.getElementById("__ie_onload");  script.onreadystatechange = function() {    if (this.readyState == "complete") {      init(); // call the onload handler    }  };/*@end @*//* for Safari */if (/WebKit/i.test(navigator.userAgent)) { // sniff  var _timer = setInterval(function() {    if (/loaded|complete/.test(document.readyState)) {      init(); // call the onload handler    }  }, 10);}/* for other browsers */window.onload = init;/* ------------------------- */function updateRevolveInProgress(value) {	revolveInProgress = value ; 	}function waitUntilRevolveIsComplete() {	var i; 	var a;	for (i = 0; i++; i < 100) {		a = a + 1; 	}	if (revolveInProgress == 1) {		waitUntilRevolveIsComplete() ; 	}}function updateForwardBackButtons() {	if (rIndex == 0 ) {		hideElementWithID('backButton') ;		}	else {		unhideElementWithID('backButton') ;			}	if (rIndex >= (revolver.length - 1) ) {		hideElementWithID('forwardButton') ;		}	else {		unhideElementWithID('forwardButton') ;			}}//animation moves leftfunction animateLeft() {	// constructor var t = new Tween(object,property,easing,start,end,duration,suffixe);		// start animating at position 1 since we are moving left (animate only positionIndexes 1 through 4		/* if we're at the end of the array, don't animate */	var numItems = revolver.length ; 		//if (revolveInProgress == 0) {			// if an animation left is in progress stop it first		if (typeof motionLeft != 'undefined') {			motionLeft.stop() ;		}		if (rIndex < numItems) {			motionLeft = new Parallel() ; 			// alert ("entering loop with rIndex " + rIndex) ;			var rIndexTemp = rIndex; 				var pMax = numItems ; 			var pIndex = 2; 	//the first item to animate is the center position			var item = revolver[rIndexTemp];						// check if we are in the first position			if (rIndexTemp == 0) {				// we are in the first position				pIndex = 2; 	//the first item to animate is the center position							}			else {				// we are not in the first position				pIndex = 1; 	// the first item to animate is in the left position				rIndexTemp--; 	// the item to animate is to the left of the center item			}			// check if we are in the last position to be animated			if (rIndex == numItems - 2) {				pMax = pMax - 1;  // if we are on the last item, omit the animation for the rightOffscreen position (position 4), as there are no more items to animate on screen			}			for (pIndex  ;  pIndex < pMax ; pIndex++ ) {				// for each position, construct the tween based on the positions stored in the position array				item = revolver[rIndexTemp];				motionLeft.addChild( new Tween(item.style,'width',Tween.strongEaseOut,position[pIndex]['width'],position[pIndex-1]['width'],animationDuration,'px')    ) ;				motionLeft.addChild( new Tween(item.style,'left',Tween.strongEaseOut,position[pIndex]['left'],position[pIndex-1]['left'],animationDuration,'px')    ) ;				motionLeft.addChild( new Tween(item.style,'top',Tween.strongEaseOut,position[pIndex]['top'],position[pIndex-1]['top'],animationDuration,'px')    ) ;								// constructor OpacityTween(obj,func,fromOpacity,toOpacity,duration)				motionLeft.addChild( new OpacityTween(item,Tween.strongEaseOut,position[pIndex]['opacity'],position[pIndex-1]['opacity'],animationDuration)    ) ;											rIndexTemp++;				// update the images class name for the grow function				item.myPositionName = pIndex-1; 			}			/*			motionLeft.onMotionFinished = function() {				//alert("motion finished") ;				//updateRevolveInProgress(0) ; 				}			*/			//updateRevolveInProgress(1) ; 				motionLeft.start();			if (rIndex < revolver.length) {				// alert("incrementing rIndex");				rIndex++;	// increment the rIndex				// alert("rIndex updated to "+rIndex);			}			updateForwardBackButtons() ;					}			//}	//else {		//alert("revolve in progress no can do") ;	//} }// animation moves rightfunction animateRight() {	// constructor var t = new Tween(object,property,easing,start,end,duration,suffixe);		// start animating at position 1 since we are moving left (animate only positionIndexes 1 through 4		/* if we're at the end of the array, don't animate */	var numItems = revolver.length ; 		if (typeof motionRight != 'undefined') {		motionRight.stop() ;	}	if (rIndex < numItems) {		motionRight = new Parallel() ; 		// alert ("entering loop with rIndex " + rIndex) ;		var rIndexTemp = rIndex; 			var pMin = 0 ; 		var pIndex = 2; 	//the first item to animate is the center position		var item = revolver[rIndexTemp];		// check if we are on the last item		if (rIndexTemp >= (revolver.length - 1 )) {			pIndex = 2; 	//the first item to animate is the center position					}		else {			// we are not in the last position			pIndex = 3; 	// the first item to animate is in the right position			rIndexTemp++; 	// the item to animate is to the right of the center item		}				// check if we are on the second item 		if (rIndex <= 1) {			pMin = 1;  // if we are on the second item, omit the animation for the leftOffscreen position (position 0), as there are no more items to animate on screen		}				for (pIndex  ;  pIndex >= pMin ; pIndex-- ) {			// for each position, construct the tween based on the positions stored in the position array			item = revolver[rIndexTemp];			motionRight.addChild( new Tween(item.style,'width',Tween.strongEaseOut,position[pIndex]['width'],position[pIndex+1]['width'],animationDuration,'px')    ) ;			motionRight.addChild( new Tween(item.style,'left',Tween.strongEaseOut,position[pIndex]['left'],position[pIndex+1]['left'],animationDuration,'px')    ) ;			motionRight.addChild( new Tween(item.style,'top',Tween.strongEaseOut,position[pIndex]['top'],position[pIndex+1]['top'],animationDuration,'px')    ) ;			motionRight.addChild( new OpacityTween(item,Tween.strongEaseOut,position[pIndex]['opacity'],position[pIndex+1]['opacity'],animationDuration)    ) ;									rIndexTemp--;		}		/*		motionRight.onMotionFinished = function() {				//alert("motion finished") ;				updateRevolveInProgress(0) ; 					if (doAnother == 1) { 					animateRight() ;					alert("did anohter") ;				}			}				*/		// updateRevolveInProgress(1) ; 			motionRight.start();		if (rIndex > 0 ) {			rIndex--;	// decrement the rIndex		}		updateForwardBackButtons() ;	}	 }   
