/* dynlite path class
 * version: 2.1.1/2005-04-25
 */
 
/* class constructor */
function trans(id)
{	this.id=id;
	this.steps=20;
	this.time=30;
	this.interval=0;
	this.cords=[];
	this.i=0;
}
tp=trans.prototype;
/* private methods */
tp._calc=function(start,end)//original source of bezier method- http://astronomy.swin.edu.au/~pbourke/curves/bezier/ 
{	var cords=[];
	for(var i=this.steps;i>=0;i--)
	{	var mu=i/this.steps;
		var mu2=mu*mu;
		var mum1=1-mu;
		var mum12=mum1*mum1;
		cords[i]=Math.round(start*mum12+2*end*mum1*mu+end*mu2);
	}
return cords;	
}
tp._step=function()
{	this.i+=this.dir;
	this.evoke('ontrans');
	if(!this.i||this.i>=this.steps)	
	{	clearInterval(this.interval);
		this.evoke((this.dir==1)? 'ontransin':'ontransout');
	}
}
/* public methods */
tp.evoke=function(evt,e)
{	if(this[evt]) this[evt](e);
}
tp.go=function(dir)
{	clearInterval(this.interval);
	this.dir=dir||1;
	this.evoke('ontransstart');
	this.interval=setInterval(this.id+"._step()",this.time);
}
tp.stop=function()
{	clearInterval(this.interval);
	this.evoke('ontransstop');
}

/* gardarte image transition class */
function gallery(id)
{	this.id=id;
	this.oborder='#FFFFFF';
	this.nborder='#D97E7E';	
	this.cords=this._calc(1,99);
	this.bussy=0;
}
gp=gallery.prototype=new trans;
gp._trans=function(obj,trans)
{	if(obj.filters)	obj.filters.alpha.opacity = trans;
	else			obj.style.setProperty("-moz-opacity",trans/100,"");
}
gp.preview=function(image,border)
{	if(this.bussy||this.image==image) return;
/* swap image */
	this.nimage=image;
	this.go(1);
/* swap background */
	obj(this.border).style.borderColor=this.oborder;
	this.border=border;
	obj(this.border).style.borderColor=this.nborder;
}
/* custom event handlers */
gp.ontransstart=function()
{	this.bussy=1;
	this._trans(obj(this.nimage),1);
	obj(this.nimage).on();
}
gp.ontrans=function()
{	var val=this.cords[this.i];
	this._trans(obj(this.image),100-val);
	this._trans(obj(this.nimage),val);
}
gp.ontransin=function()
{	this.i=0;
	obj(this.image).off();
	this.image=this.nimage;
	this.bussy=0;
}
/* creation of the actual object */
t=new gallery('t');
/* big image zoom class */
function zoom(id)
{	this.id=id;
	this.bussy=0;
	this.maxsize=500;
	this.minleft=0;
}
zp=zoom.prototype=new trans;
zp.enlarge=function(image)
{	if(this.bussy) return;
	if(this.dir&&this.dir==1) this.go(-1);
	else
	{	this.image=obj(image);
		this.image.style.zIndex='20';
		this.larger=(this.image.height>this.image.width)? this.image.height:this.image.width;
		this.ratio=this.larger/this.image.width;
		this.vals=this._calc(this.image.width,parseInt(this.maxsize/this.ratio));
		this.pos=this._calc(this.image.offsetLeft,this.minleft);
		this.i=0;
		this.go(1);
	}
}
/* custom event handlers */
zp.ontransstart=function()
{	this.bussy=1;
	if(this.dir==1)
	{	this.rimage=new Image();
		//this.rimage.src=this.image.src.replace(/(TMB)/,'');
		this.rimage.src=this.image.src.replace(/(BIG)?\.(\w+)$/,'BIG.$2');
	}
/* hides materials select box */
	if(document.getElementById('colorsandmaterials'))
	{	obj('colorsandmaterials').style.visibility="hidden";
	}


}
zp.ontrans=function()
{	this.image.width=this.vals[this.i];
	this.image.style.left=this.pos[this.i];
}
zp.ontransin=function()
{	this.image.src=this.rimage.src;
	this.bussy=0;
}
zp.ontransout=function()
{	this.bussy=0;
	this.image.style.zIndex='2';
/* shows materials select box */
	if(document.getElementById('colorsandmaterials'))
	{	obj('colorsandmaterials').style.visibility="visible";
	}

}
/* creation of the actual object */
z=new zoom('z');
/* big image zoom class */
function materials(id)
{	this.id=id;
	this.bussy=0;
	this.maxsize=200;
	this.mintop=0;
	this.minleft=300;
	this.maxz=30;
	this.minz=10;
}
mp=materials.prototype=new trans;
mp.enlarge=function(image)
{	if(this.bussy) return;
	if(this.dir&&this.dir==1) this.go(-1);
	else
	{	this.image=obj(image);
		this.vals=this._calc(this.image.width,this.maxsize);
		this.left=this._calc(this.image.offsetLeft,this.minleft);
		this.top=this._calc(this.image.offsetTop,this.mintop);
		this.i=0;
		this.go(1);
	}
}
/* custom event handlers */
mp.ontransstart=function()
{	this.bussy=1;
	this.image.style.zIndex=this.maxz;
	if(this.dir==1)
	{	this.rimage=new Image();
		this.rimage.src=this.image.src.replace(/(TMB)/,'');
	}
	/* hides materials select box */
	if(document.getElementById('colorsandmaterials'))
	{	obj('colorsandmaterials').style.visibility="hidden";
	}
}
mp.ontrans=function()
{	this.image.width=this.vals[this.i];
	this.image.style.left=this.left[this.i];
	this.image.style.top=this.top[this.i];
	//alert(temp)
}
mp.ontransin=function()
{	this.bussy=0;
	this.image.src=this.rimage.src;
}
mp.ontransout=function()
{	this.bussy=0;
	this.image.style.zIndex=this.minz;
	/* shows materials select box */
	if(document.getElementById('colorsandmaterials'))
	{	obj('colorsandmaterials').style.visibility="visible";
	}
}
/* creation of the actual object */
m=new materials('m');
/* big image zoom class */
function colors(id)
{	this.id=id;
	this.bussy=0;
	this.maxsize=200;
	this.mintop=0;
	this.minleft=0;
	this.maxz=30;
	this.minz=10;
}
cp=colors.prototype=new trans;
cp.enlarge=function(image)
{	if(this.bussy) return;
	if(this.dir&&this.dir==1) this.go(-1);
	else
	{	this.image=obj(image);
		this.vals=this._calc(this.image.width,this.maxsize);
		this.left=this._calc(this.image.offsetLeft,this.minleft);
		this.top=this._calc(this.image.offsetTop,this.mintop);
		this.i=0;
		this.go(1);
	}
}
/* custom event handlers */
cp.ontransstart=function()
{	this.bussy=1;
	this.image.style.zIndex=this.maxz;
	if(this.dir==1)
	{	this.rimage=new Image();
		this.rimage.src=this.image.src.replace(/(TMB)/,'');
	}
}
cp.ontrans=function()
{	this.image.width=this.vals[this.i];
	this.image.style.left=this.left[this.i];
	this.image.style.top=this.top[this.i];
	//alert(temp)
}
cp.ontransin=function()
{	this.bussy=0;
	this.image.src=this.rimage.src;
}
cp.ontransout=function()
{	this.bussy=0;
	this.image.style.zIndex=this.minz;
}
/* creation of the actual object */
c=new colors('c');


/* big image zoom class */
function publicPic(id)
{	this.id=id;
	this.bussy=0;
	this.maxsize=450;
	this.mintop=0;
	this.minleft=0;
	this.maxz=30;
	this.minz=10;
}
np=publicPic.prototype=new trans;
np.enlarge=function(image)
{	if(this.bussy) return;
	if(this.dir&&this.dir==1) this.go(-1);
	else
	{	this.image=obj(image);
		this.vals=this._calc(this.image.width,this.maxsize);
		this.left=this._calc(this.image.offsetLeft,this.minleft);
		this.top=this._calc(this.image.offsetTop,this.mintop);
		this.i=0;
		this.go(1);
	}
}
/* custom event handlers */
np.ontransstart=function()
{	this.bussy=1;
	this.image.style.zIndex=this.maxz;
	if(this.dir==1)
	{	this.rimage=new Image();
		this.rimage.src=this.image.src.replace(/(TMB)/,'');
	}
}
np.ontrans=function()
{	this.image.width=this.vals[this.i];
	this.image.style.left=this.left[this.i];
	this.image.style.top=this.top[this.i];
	//alert(temp)
}
np.ontransin=function()
{	this.bussy=0;
	this.image.src=this.rimage.src;
}
np.ontransout=function()
{	this.bussy=0;
	this.image.style.zIndex=this.minz;
}
/* creation of the actual object */
n=new publicPic('n');	