$(document).ready(function(){
//image zoom
$('a.homeimg').zoomimage({centered: true,
controls:false,
caption:false,
border: 3,
opacity: 1,
beforeZoomIn: function(boxID) {
$('#' + boxID)
.find('img')
.css('opacity', 0)
.animate(
{'opacity':1},
{ duration: 500, queue: false }
);
},
beforeZoomOut: function(boxID) {
$('#' + boxID)
.find('img')
.css('opacity', 1)
.animate(
{'opacity':0},
{ duration: 500, queue: false }
);
}
})

//bubble fade
$('li.isevent a').hover(function() {
$(this).next('div').stop(true,true).fadeIn();
}, function() {  
$(this).next('div').fadeOut();
});

//offer banner

$(function() {
$('#exoffers > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 10000);
});



//fade the unused thumbnails
$('li.empty').stop().fadeTo("slow",0.5);

$('.kwCarImg').tooltip({track:true,showURL:false,fade:250});


//product page gallery
var defaultImage = $('#thumbGallery a.active').attr("href");
var defaultText = $('#thumbGallery a.active').attr("title")
$('img#largeImg').attr('src', defaultImage);
$('#caption').append(defaultText);

//preload the thumbnail gallery images
$('#thumbGallery a').preload();
$('.highlightProdList a').preload();
$('.homeimg').preload();

$('#thumbGallery a').click(function(event) {
event.preventDefault();
var image = $(this).attr("href");
var description = $(this).attr("title");
$('img#largeImg').stop();
$('img#largeImg').stop().fadeTo(500, 0, function() {  //fade image out
            $('img#largeImg').attr('src',image);  //give new image a src attribute
	    $("#caption").empty();
	    $("#caption").append(description);
        }).fadeTo("slow", 1);  //fade the image in

});

var opts = {align:'middle',size:'36',labels:'bc',distance:'100'};
$('#icons').jqDock(opts);

var kfopts = {align:'center',size:'80',labels:false};
$('.iconbox').jqDock(kfopts);

//news fader

$('#newsticker').innerfade({
		 animationtype: 'fade',
		 speed: 750,
		 timeout: 7500,
		 type:'sequence',
		 containerheight: '70px'});
		 
//new promos rotation
$('#offerbox').cycle({fx:'scrollUp',timeout: 10000,delay:  -2000});

});//end document-ready request

