

theCarousel = null;
function onInitCarousel(carousel, state)
{
	if (state == 'init')
	{
		theCarousel = carousel;
	}
}

$(document).ready(function ()
{
	$.plugin('cufon', {
		files: ['js/Gotham_Medium_350.font.js',
			'js/Chronicle_Text_325.font.js',
			'js/Gotham_Light_300.font.js'],
		selectors: ['*'],
		init: function ()
		{
			//$("#loadBar").append("<div>fonts..</div>");
		},
		callback: function ()
		{
			//Cufon.replace('.title', { fontFamily: 'Gotham Medium' });
			//Cufon.replace('.subTitle', { fontFamily: 'Gotham Light' });
			//Cufon.replace('.textBlock', { fontFamily: 'Chronicle Text G1' });
			//Cufon.replace('.redCaps', { fontFamily: 'Gotham Medium' });
			//Cufon.now();

			$.plugin('jCarousel').get();
		}
	});

	$.plugin('jCarousel', {
		files: ['js/jquery.jcarousel.pack.js',
			'css/jquery.jcarousel.css',
			'css/jcarousel-skin.css'],
		selectors: ['*'],
		init: function ()
		{
			//$("#loadBar").append("<div>carousel..</div>");
		},
		callback: function ()
		{
			/*
			$('.carousel').jcarousel({
			scroll: 8,
			visible:8,
			//size: 15,
			animation:2000
			});
			*/
			$.plugin('misc').get();
		}
	});

	$.plugin('misc', {
		files: ['js/jquery.disable.text.select.pack.js',
			'js/jquery.easing.1.3.js'],
		selectors: ['*'],
		init: function ()
		{
		},
		callback: function ()
		{
			$('*').disableTextSelect();
			//showPage();
		}
	});
	$.plugin('cufon').get();

	$("area").mouseleave(function ()
	{

		$("#textBox").css('display', 'none');
	});
	var currentBrand;
	var lastLeft = 0;

	$('area').hover(function (e)
	{
		$('#direction').hide();
		brand = $(this).attr('alt');

		if (brand != currentBrand)
		{
			currentBrand = brand;

			$("#textBox #textTitle").html($("#" + brand + " .info .textTitle").html());
			$("#textBox #textSubTitle").html($("#" + brand + " .info .textSubTitle").text());
			$("#textBox #textCopy").html($("#" + brand + " .info .textCopy").text());
			$("#" + brand).prependTo("#collections");

			if (!$("#" + brand + "Scroll").hasClass("jcarousel-list"))
			{

				if (($("." + brand).length) < 9)
				{
					$("#" + brand + "Scroll").jcarousel({
						scroll: 8,
						animation: 2000,
						initCallback: onInitCarousel
					});
				} else
				{
					$("#" + brand + "Scroll").jcarousel({
						scroll: 8,
						visible: 8,
						size: ($("." + brand).length) + 1,
						animation: 2000,
						initCallback: onInitCarousel
					});
				}
			}
		}
		var posx = 0;
		var posy = 0;
		if (!e) var e = window.event;
		if (e.pageX || e.pageY)
		{
			posx = e.pageX - (document.body.scrollLeft + document.documentElement.scrollLeft);
			posy = e.pageY - (document.body.scrollLeft + document.documentElement.scrollLeft);
		}
		else if (e.clientX || e.clientY)
		{
			posx = e.clientX; //+ document.body.scrollLeft + document.documentElement.scrollLeft;
			posy = e.clientY; //+ document.body.scrollTop + document.documentElement.scrollTop;
		}

		newLeft = posx - ((document.body.clientWidth / 2) - 485);

		newLeft += 145;
		if (newLeft > 750)
		{
			newLeft -= 480;
		}

		$("#textBox").css('left', newLeft);
		Cufon.replace("#textBox #textTitle", { fontFamily: 'Gotham Medium' });
		Cufon.replace("#textBox #textSubTitle", { fontFamily: 'Gotham Medium' });
		Cufon.replace("#textBox #textCopy", { fontFamily: 'Chronicle Text G1' });
		$("#textBox").css('display', 'block');
		$("#textBox").css('opacity', '0.97');


	}, function () { });

});


$(window).load(function()
{
	$('#preLoader').fadeOut(250);
});

