var itemWidth = 173;
var itemInRow = 3;
var exampleFx = new Object();

var galleryLoad = function()
{
	var itemCount = $('hul').getChildren().length;
	$('hul').setStyle('width', itemCount * itemWidth + "px");

	var curWidth = itemCount * itemWidth;    

	Fx.Styles.implement(	{ move:	function(leftTo)
									{
    									var curLeft = this.element.getStyle('left', true).toInt();
	
										if (leftTo < 0) // left
										{
											if (Math.abs(curLeft) + (itemWidth * itemInRow) < curWidth)
											{
												$('left_a').setOpacity(1);
												this.custom({'left': [curLeft, curLeft + leftTo]});
											}
											else
											{
												$('right_a').setOpacity(.5);
											}
										}
										else // right
										{
											if (curLeft != 0)
											{
												$('right_a').setOpacity(1);
			
												this.custom({'left': [curLeft, curLeft + leftTo]});
											}
											else
											{
												$('left_a').setOpacity(.5);
											}
										}
	
										var cn = "f" + (((Math.abs(curLeft) + (itemWidth * itemInRow)) / 684) - 1);
										cn = cn.substring(0,2);
									}	
    
							});

	exampleFx = new Fx.Styles('hul', { duration: 300, transition: Fx.Transitions.linear });
}


// Transparent png in IE6 -------------------------------------
function fixPNG(element)
{

  //if IE 5.5-6
  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
  {
    var src;
    if (element.tagName=='IMG') // if IMG
    {
        src = element.src;
        element.src = "/assets/images/blank.gif"; //replace the image by transparent gif
    }
    else // if not IMG
    {
      src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      if (src)
      {
        src = src[1]; 
        element.runtimeStyle.backgroundImage="none"; 
      }
    }
    // use AlphaImageLoader
    if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='image')";
  }
  
}
