var x = 0;

function showImg(x){
	var calc = x * 349;
	var left = '-' + calc;
	
	box = $('previews');
	fx = new Fx.Styles(box);
	
	fx.start({'left': left});
	
}

window.addEvent('domready', function(e){
	
	var i = 0;
	var list = $$('.bmenu');
	list.each(function(e) {
	 
		var fx = new Fx.Styles(e, {duration:200, wait:false});
	 	var src = e.src;
		if(src.substr(src.indexOf("-"),src.length) == "-over.gif"){
			
		}
		else{
			e.addEvent('mouseenter', function(){
				e.src = ROOT+"images/"+e.alt+"-over.gif";
			});
		 
			e.addEvent('mouseleave', function(){
				e.src = ROOT+"images/"+e.alt+".gif";
			});
		}
	 
	});
	
	
	
	var thumbs = $$('.thumb');
	thumbs.each(function(e) {
		var x = e.id.replace(/img_/,"");
		var calc = x * 349;
		var left = '-' + Math.round(calc);
		
		e.addEvent('click', function(){
			var	fx = new Fx.Styles($('previews'), {duration: 600, wait:false});						 	
			fx.start({'left': left});
		});
	});
	
	if($('related') != null)
	{
		var rel = $('related');
		var fx = new Fx.Styles(rel, {duration: 200, wait: false});
		
		$('imagebox').addEvents({
			'mouseover': function(){
				fx.start({'bottom':'0px'});
			},
			'mouseout': function(){
				fx.start({'bottom':'-60px'})
			}
			
		});
		
		
	}
	
	

});

var i = 0;

function FadeToImg(){
	var images = $$('.slideimg');
	var total = images.length;
	if(total > 1){
		var fx = new Fx.Style('img'+i, 'opacity', {duration: 2000});
		fx.start(0);
		i++;
		if(i > total-1){
			i = 0;
		}
	
		$('img'+i).setStyles({"opacity": 0});
		
		var fx2 = new Fx.Style('img'+i, 'opacity', {duration: 2000});
		fx2.start(1);	
		setTimeout("FadeToImg()", 6000);
	}
}




