/**
Script: Slideshow.Push.js
	Slideshow.Push - Push extension for Slideshow.

License:
	MIT-style license.

Copyright:
	Copyright (c) 2008 [Aeron Glemann](http://www.electricprism.com/aeron/).
*/

Slideshow.Push=new Class({
	Extends:Slideshow,initialize:function(B,C,A){
		A.overlap=false;this.parent(B,C,A)
	},
	
	_show:function(C){
		var A=[this.image,((this.counter%2)?this.a:this.b)];
		if(!this.image.retrieve("fx")){
			this.image.store("fx",new Fx.Elements(A,{duration:this.options.duration,link:"cancel",onStart:this._start.bind(this),onComplete:this._complete.bind(this),transition:this.options.transition}))
			}
			
		   var iWidth = 0, iHeight = 0;

		   	if (navigator.appName.indexOf("Microsoft")!=-1) {
			   //	alert("IE");
				iWidth = document.body.offsetWidth;
			   	iHeight = document.body.offsetHeight;
			} else if (document.documentElement && document.documentElement.clientHeight){
		       iWidth = parseInt(window.innerWidth,10);
		       iHeight = parseInt(window.innerHeight,10);
		   }
		   else if (document.body){
		       iWidth = parseInt(document.body.offsetWidth,10);
		       iHeight = parseInt(document.body.offsetHeight,10);
		   }			
				
			this.image.set("styles",{left:"auto",right:"auto"
			}).setStyle(this.direction,iWidth).setStyle("visibility","visible");
			var B={"0":{},"1":{}};
			
			var center_point = (iWidth-this.image.width)*.5;
		
			if(center_point < 214){
				center_point = 214;
			}			
			
			
			
			if(this.direction == "right"){
			//	alert('this.direction ' + this.direction);
				center_point -= 14;
			}
			
			B["0"][this.direction]=[iWidth,center_point];
			//alert();
			B["1"][this.direction]=[0,-iWidth]
			//alert("B0 " + B["0"][this.direction] + " B1 " + B["1"][this.direction] + " direction " + this.direction);
			if(A[1].getStyle(this.direction)=="auto"){
				var D=iWidth-A[1].width;A[1].set("styles",{left:"auto",right:"auto"}).setStyle(this.direction,D);
				B["1"][this.direction]=[D,-iWidth]}if(C){
					
					for(var E in B){B[E][this.direction]=B[E][this.direction][1]}this.image.retrieve("fx").cancel().set(B)}else{this.image.retrieve("fx").start(B)}}});
