$('html').addClass('js');

// Document onload stuff here...
jQuery(function() {

	jQuery("#homenav a").hover(function() {
		jQuery(this).animate({
			color: "#66FFFF"
		}, 100);
	},
	function() {
		if (!jQuery(this).hasClass("sel")) {
			jQuery(this).animate({
				color: "#fff"
			}, 600);
		}
	});

	jQuery('#pane1').jScrollPane({

		scrollbarWidth: 20

	});

	jQuery('#preloader').css({

		"width": jQuery(document).width(),
		"height": jQuery(document).height()

	});

	jQuery('#preloader').fadeOut("slow");

	jQuery('#brandSelector').bind("change", function() {

		var value = jQuery(this).val();

		jQuery('div#pane1 > div').each(function() {

			jQuery(this).hide();

		});

		jQuery("div[title='" + value + "']").fadeIn(function() {

			jQuery("div#pane1").jScrollPane({

				scrollbarWidth: 20

			});
		});

	});

});

jQuery(document).ready(function() {

	var firstImage = jQuery('div.item.item_double:last img').eq(0);

	if (firstImage.hasClass("autoresize") ) {
		
//		var breadcrumb = jQuery("#breadcrumb");
//		var imgBox = jQuery('div.item.item_double').eq(1);
//		var imgWidth = firstImage.outerWidth();
//
//		alert(imgWidth);
//
//		breadcrumb.animate({
//			width: 390 + 10 + (imgWidth + 16)
//		}, "medium");
//
//		imgBox.animate({
//			width: imgWidth + 16
//		}, "medium");
		
	}


	jQuery('#hpSlideShow').cycle({
		fx: 'fade',
		before: function() {

			if (this.getAttribute("class") == "autoresize") {
				var breadcrumb = jQuery("#breadcrumb");
				var imgBox = jQuery('div.item.item_double').eq(1);
				var imgWidth = jQuery('#' + this.id).attr('realwidth');
				var imgWidth = jQuery('#' + this.id).outerWidth();

				breadcrumb.animate({
					width: 390 + 10 + (imgWidth + 16)
				}, "medium");

				imgBox.animate({
					width: imgWidth + 16
				}, "medium");

			}

		}
	});

	

});
