//Carousel

$(document).ready(function(){
	$(function() {
		$(".carouselBrands").jCarouselLite({
			auto: 800,
			circular: true, 
			speed: 800,
			visible: 1
		});
	});  
	
	
	$(".carouselBrands").bind(
		'mouseover',
		function(){
			caranim=false;
		}).bind(
		'mouseout',
		function(){
			caranim=true;
		});
		
	$(".brandlogo").bind(
		'mouseover',
		function(){
			$(this).animate({width: 125, height: 125},200);
			}).bind(
		'mouseout',
		function(){
			$(this).animate({width: 75, height: 75},200);
			});
	});

//Photo Gallery

function initgallery() {
	$('a').each(function() {
		if (this.getAttribute('href') && (this.getAttribute('rel') == 'slide')){
			this.onclick = function () {
				$("#slide").toggle();
				$("#slideimg").html('<img src="'+this.href+'" width="450" height="450" alt="'+this.getAttribute("title")+'" title="'+this.getAttribute("title")+'" />');
				$("#slidecaption").html("<em>"+this.getAttribute("title")+"</em>");
				setTimeout("$('#slide').show('slow')", 2000);
				return false;
			}
		}
	});
	
	var allThumbs = $("#thumbs a").get();
	thumbLength = allThumbs.length;
	tOffset = 0;
}

function leftScroll() {
	if(tOffset < 10) {
		tOffset = tOffset + 10;
		document.getElementById("thumbs").style.marginLeft = tOffset + "px";
		doscroll = setTimeout("leftScroll()", 30);
	}
}

function rightScroll() {
	if(tOffset > ((thumbLength * 80) - ((thumbLength * 80) * 2) - 10) + 510) {
		tOffset = tOffset - 10;
		document.getElementById("thumbs").style.marginLeft = tOffset + "px";
		doscroll = setTimeout("rightScroll()", 30);
	}
}

function stopScroll() {
	if(doscroll) clearTimeout(doscroll);
}