// JavaScript Document
function correctPNG()
{
   for(var i=0; i<document.images.length; i++)
   {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
   {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
   + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
   img.outerHTML = strNewHTML
   i = i-1
   };
   };
};

	if(navigator.userAgent.indexOf("MSIE")>-1)
	{
	window.attachEvent("onload", correctPNG);
	};
	
	
function Slider(slider, container){
	var items = container.getElementsByTagName('a');
	var count = items.length;
	this.selectedIndex = 0;
	slider.scrollLeft = 0;

	this.scrollTo = function(index){
		var item = items[index];
		if(!item)
			return;

		if(this.fx)this.fx.stop();
		this.fx = new Fx.Property(slider, 'scrollLeft', {duration:700, fps:24});
		this.fx.options.transition = function(p){
			var dv = Math.pow(128, -p);
			var y = 1-dv + dv * (1-Math.cos(p * (2 * (1 || 1) + .5) * Math.PI));
			return y;
		};
		this.fx.start(slider.scrollLeft, item.offsetLeft);
	};
	
	this.Next = function(){
		if(this.selectedIndex < count-1)
			this.scrollTo(++this.selectedIndex);
	};
	
	this.Prev = function(){
		if(this.selectedIndex > 0)
			this.scrollTo(--this.selectedIndex);
	};
}
